From: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
JosephChan@via.com.tw, ScottFang@viatech.com.cn
Subject: Re: [PATCH 3/3] viafb: use read-only mode parsing
Date: Sun, 13 Sep 2009 21:04:58 +0200 [thread overview]
Message-ID: <4AAD425A.8010605@gmx.de> (raw)
In-Reply-To: <20090909133956.c682bf4a.akpm@linux-foundation.org>
Andrew Morton schrieb:
> On Mon, 7 Sep 2009 02:24:44 +0000
> Florian Tobias Schandinat <FlorianSchandinat@gmx.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
prev parent reply other threads:[~2009-09-13 19:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-07 2:24 [PATCH 1/3] viafb: make module parameters visible in sysfs Florian Tobias Schandinat
2009-09-07 2:24 ` [PATCH 2/3] viafb: remove unused structure member Florian Tobias Schandinat
2009-09-07 2:24 ` [PATCH 3/3] viafb: use read-only mode parsing Florian Tobias Schandinat
2009-09-09 20:39 ` Andrew Morton
2009-09-13 19:04 ` Florian Tobias Schandinat [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AAD425A.8010605@gmx.de \
--to=florianschandinat@gmx.de \
--cc=JosephChan@via.com.tw \
--cc=ScottFang@viatech.com.cn \
--cc=akpm@linux-foundation.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome