[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4AAD425A.8010605@gmx.de>
Date: Sun, 13 Sep 2009 21:04:58 +0200
From: Florian Tobias Schandinat <FlorianSchandinat@....de>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org,
JosephChan@....com.tw, ScottFang@...tech.com.cn
Subject: Re: [PATCH 3/3] viafb: use read-only mode parsing
Andrew Morton schrieb:
> On Mon, 7 Sep 2009 02:24:44 +0000
> Florian Tobias Schandinat <FlorianSchandinat@....de> wrote:
>
>> +static void parse_mode(const char *str, u32 *xres, u32 *yres)
>> +{
>> + char *ptr;
>> +
>> + *xres = simple_strtoul(str, &ptr, 10);
>> + if (ptr[0] != 'x')
>> + goto out_default;
>> +
>> + *yres = simple_strtoul(&ptr[1], &ptr, 10);
>> + if (ptr[0])
>> + goto out_default;
>> +
>> + return;
>> +
>> +out_default:
>> + printk(KERN_WARNING "viafb received invalid mode string: %s\n", str);
>> + *xres = 640;
>> + *yres = 480;
>> +}
>
> One wonders if we could use sscanf here?
You're right.
But I am planning to add the optional arguments -<bpp> and @<refresh> to
make it easier to select a mode and slowly move towards generic modedb
format. I think that can be done easier with pointer handling than
sscanf usage but I don't have a strong opinion about it so feel free to
request me to change it.
Example: (new format)
viafb_mode=800x480-16@60
instead (old format)
viafb_mode=800x480 viafb_bpp=16 viafb_refresh=60
> The second simple_strtoul() could use strict_strtoul(), but that's not
> obviously superior IMO.
True.
Thanks,
Florian Tobias Schandinat
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists