drm/radeon: fix and simplify pot argument checks v2
PATCH 1/4 drm/radeon: fix and simplify pot argument checks v2
Review
Quoted 13 lines
/**
+ *radeon_check_pot_argument- check that argument is a power of two
+ *
+ * @arg: value to check
+ *
+ * Validates that a certain argument is a power of two (all asics).
+ * Returns true if argument is valid.
+ */(quoted diff) +4
-0+static bool radeon_ckeck_pot_argument(int arg) +{ + return (arg & (arg - 1)) == 0; +}
comment says "check_pot_argument" but is called c_K_eck_pot_argument
Review static unsigned int radeon_vga_set_decode(void *cookie,
Quoted 6 lines
(quoted diff) +2
-0+ +/** * radeon_check_arguments - validate module params * * @rdev: radeon_device pointer@@ -845,52 +860,25 @@ static unsigned int radeon_vga_set_decode(void *cookie,
bool state)
Quoted 9 lines
(quoted diff) +0
-6static void radeon_check_arguments(struct radeon_device *rdev) { /* vramlimit must be a power of two */ - switch (radeon_vram_limit) { - case 0: - case 4: - case 8: - case 16: - case 32:
Review static unsigned int radeon_vga_set_decode(void *cookie, · line 863
Quoted 10 lines
(quoted diff) +1
-9- case 64: - case 128: - case 256: - case 512: - case 1024: - case 2048: - case 4096: - break; - default: + if (!radeon_ckeck_pot_argument(radeon_vram_limit)) {
check_pot_argument is also true for radeon_vram_limit = 1 and 2 which was missing from the previous case statement, was that intentional?
Best regards,
Klaus
Quoted 5 lines · Klaus Schnass
Quoted 5 lines
/**
+ *radeon_check_pot_argument- check that argument is a power of two
+ *
+ * @arg: value to check
+ *
Quoted 8 lines
Review
Quoted 7 lines
+ * Validates that a certain argument is a power of two (all asics).
+ * Returns true if argument is valid.
+ */(quoted diff) +4
-0+static bool radeon_ckeck_pot_argument(int arg) +{ + return (arg & (arg - 1)) == 0; +}comment says "
check_pot_argument" but is calledc_K_eck_pot_argument
Good catch, that's indeed a typo.
Quoted 21 lines
Review static unsigned int radeon_vga_set_decode(void *cookie,
Quoted 7 lines
(quoted diff) +2
-0+ +/** * radeon_check_arguments - validate module params * * @rdev: radeon_device pointer@@ -845,52 +860,25 @@ static unsigned int radeon_vga_set_decode(void *cookie,bool state)
Quoted 13 lines
(quoted diff) +0
-10static void radeon_check_arguments(struct radeon_device *rdev) { /* vramlimit must be a power of two */ - switch (radeon_vram_limit) { - case 0: - case 4: - case 8: - case 16: - case 32: - case 64: - case 128: - case 256: - case 512:
Quoted 8 lines
Review static unsigned int radeon_vga_set_decode(void *cookie, · line 863
Quoted 6 lines
(quoted diff) +1
-5- case 1024: - case 2048: - case 4096: - break; - default: + if (!radeon_ckeck_pot_argument(radeon_vram_limit)) {
check_pot_argumentis also true forradeon_vram_limit= 1 and 2 which was missing from the previous case statement, was that intentional?
Not really, but I don't see a reason why 1 and 2 MB limits shouldn't work (if your resolution is low enough).
Christian.
Quoted 8 lines
Best regards,
Klaus
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 17 lines · Christian König
Quoted 15 lines · Klaus Schnass
Review
Quoted 13 lines
/**
+ *radeon_check_pot_argument- check that argument is a power of two
+ *
+ * @arg: value to check
+ *
+ * Validates that a certain argument is a power of two (all asics).
+ * Returns true if argument is valid.
+ */(quoted diff) +4
-0+static bool radeon_ckeck_pot_argument(int arg) +{ + return (arg & (arg - 1)) == 0; +}comment says "
check_pot_argument" but is calledc_K_eck_pot_argument
Quoted 1 line
Good catch, that's indeed a typo.
I've fixed that up locally in my tree.
Alex
Quoted 55 lines
Quoted 33 lines
Review static unsigned int radeon_vga_set_decode(void · line 860
Quoted 10 lines
(quoted diff) +2
-0+ +/** * radeon_check_arguments - validate module params * * @rdev: radeon_device pointer@@ -845,52 +860,25 @@ static unsigned int radeon_vga_set_decode(void *cookie,bool state)
Quoted 10 lines
(quoted diff) +0
-6static void radeon_check_arguments(struct radeon_device *rdev) { /* vramlimit must be a power of two */ - switch (radeon_vram_limit) { - case 0: - case 4: - case 8: - case 16: - case 32:Review static unsigned int radeon_vga_set_decode(void · line 864
Quoted 10 lines
(quoted diff) +1
-9- case 64: - case 128: - case 256: - case 512: - case 1024: - case 2048: - case 4096: - break; - default: + if (!radeon_ckeck_pot_argument(radeon_vram_limit)) {Quoted 2 lines
check_pot_argumentis also true forradeon_vram_limit= 1 and 2 which was missing from the previous case statement, was that intentional?Not really, but I don't see a reason why 1 and 2 MB limits shouldn't work (if your resolution is low enough).
Christian.
Quoted 8 lines
Best regards,
Klaus
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel