From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Christian_K=F6nig?= Subject: Re: [PATCH 1/4] drm/radeon: fix and simplify pot argument checks v2 Date: Wed, 24 Oct 2012 17:31:12 +0200 Message-ID: <508809C0.8030008@vodafone.de> References: <3734404.KGNTnGMGHd@kschotri> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from outgoing.email.vodafone.de (outgoing.email.vodafone.de [139.7.28.128]) by gabe.freedesktop.org (Postfix) with ESMTP id 46F7E9E821 for ; Wed, 24 Oct 2012 08:31:16 -0700 (PDT) In-Reply-To: <3734404.KGNTnGMGHd@kschotri> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Klaus Schnass Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org 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. > >> + >> +/** >> * 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@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel >