[PATCH 1/4] drm/radeon: fix and simplify pot argument checks v2
Klaus Schnass
devh at devilshawk.net
Tue Oct 23 09:45:45 PDT 2012
> /**
>+ * 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.
>+ */
>+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
>+
>+/**
> * 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)
> static 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:
>- 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
More information about the dri-devel
mailing list