[PATCH 1/4] drm/radeon: fix and simplify pot argument checks v2

Alex Deucher alexdeucher at gmail.com
Wed Oct 24 08:38:00 PDT 2012


On Wed, Oct 24, 2012 at 11:31 AM, Christian König
<deathsimple at vodafone.de> wrote:
> On 23.10.2012 18:45, Klaus Schnass wrote:
>>>
>>> /**
>>> + * 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
>
> Good catch, that's indeed a typo.

I've fixed that up locally in my tree.

Alex

>
>
>>
>>> +
>>> +/**
>>>   * 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?
>
> 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.
>
>
>>
>> Best regards,
>> Klaus
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list