From: Ondrej Zajicek <santiago@crfreenet.org>
To: JosephChan@via.com.tw
Cc: linux-fbdev-devel@lists.sourceforge.net,
akpm@linux-foundation.org, geert@linux-m68k.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 7/9] viafb: VIA Frame Buffer Device Driver
Date: Thu, 8 May 2008 09:41:34 +0200 [thread overview]
Message-ID: <20080508074134.GB11121@localhost.localdomain> (raw)
In-Reply-To: <C80EF34A3D2E494DBAF9AC29C7AE4EB806F6775A@exchtp03.taipei.via.com.tw>
On Wed, May 07, 2008 at 07:09:44PM +0800, JosephChan@via.com.tw wrote:
> +static int viafb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
> +{
> + switch (cmd) {
> + case VIAFB_GET_CHIP_INFO: /*struct chip_information chip_info ; */
> + if (copy_to_user((void __user *)arg, &chip_info, sizeof(chip_info)))
> + return -EFAULT;
> + break;
> + case VIAFB_GET_INFO_SIZE:
> + return put_user(sizeof(viainfo), argp);
> + case VIAFB_GET_INFO:
> + return ioctl_get_viafb_info(arg);
...
> + case VIAFB_GET_RESOLUTION:
Some of these ioctls looks like they duplicate standard fbdev ioctls.
What is a reason for that?
> +int get_mode_index(int hres, int vres, int flag)
> +{
> + DEBUG_MSG(KERN_INFO "get_mode_index!\n");
> +
> + if (flag == 0) {
> + if (hres == 480 && vres == 640) {
> + resMode = VIA_RES_480X640;
> + mode = "480x640";
> + } else if (hres == 640 && vres == 480) {
> + resMode = VIA_RES_640X480;
> + mode = "640x480";
> + } else if (hres == 800 && vres == 480) {
> + resMode = VIA_RES_800X480;
> + mode = "800x480";
> + } else if (hres == 800 && vres == 600) {
> + resMode = VIA_RES_800X600;
> + mode = "800x600";
> + } else if (hres == 1024 && vres == 768) {
> + resMode = VIA_RES_1024X768;
> + mode = "1024x768";
...
This is particularly ugly function. Some loop through a table is perhaps
better than 250 lines of such if statements, isn't it?
> + if (!strncmp(this_opt, "mode=", 5)) {
> + mode = kmalloc(strlen(this_opt + 4), GFP_KERNEL);
> + strcpy(mode, this_opt + 5);
> + } else if (!strncmp(this_opt, "mode1=", 6)) {
> + mode1 = kmalloc(strlen(this_opt + 5), GFP_KERNEL);
> + strcpy(mode1, this_opt + 6);
> + } else if (!strncmp(this_opt, "bpp=", 4)) {
> + via_fb_bpp = simple_strtoul(this_opt + 4, NULL, 0);
> + } else if (!strncmp(this_opt, "bpp1=", 5)) {
> + via_fb_bpp1 = simple_strtoul(this_opt + 5, NULL, 0);
> + } else if (!strncmp(this_opt, "refresh=", 8)) {
> + refresh = simple_strtoul(this_opt + 8, NULL, 0);
> + } else if (!strncmp(this_opt, "refresh1=", 9)) {
> + refresh1 = simple_strtoul(this_opt + 9, NULL, 0);
Most drivers accept default mode specification like 1024x768-16@60
(see Documentation/fb/modedb.txt). Is there a reason to have separate
bpp= and refresh= ?
--
Elen sila lumenn' omentielvo
Ondrej 'SanTiago' Zajicek (email: santiago@crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
prev parent reply other threads:[~2008-05-08 7:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-07 11:09 [PATCH 7/9] viafb: VIA Frame Buffer Device Driver JosephChan
2008-05-07 16:50 ` [Linux-fbdev-devel] " Krzysztof Helt
2008-05-08 7:41 ` Ondrej Zajicek [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=20080508074134.GB11121@localhost.localdomain \
--to=santiago@crfreenet.org \
--cc=JosephChan@via.com.tw \
--cc=akpm@linux-foundation.org \
--cc=geert@linux-m68k.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--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