linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: James Simmons <jsimmons@infradead.org>
Cc: Tero Roponen <teanropo@jyu.fi>,
	linux-fbdev-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: fb: modedb uses wrong default_mode
Date: Mon, 20 Nov 2006 12:05:21 -0800	[thread overview]
Message-ID: <20061120120521.68724342.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0611201643460.17639@pentafluge.infradead.org>

On Mon, 20 Nov 2006 16:48:05 +0000 (GMT)
James Simmons <jsimmons@infradead.org> wrote:

> > > 	    db = modedb;
> > > 	dbsize = ARRAY_SIZE(modedb);
> > > 
> > > 	if (!default_mode)
> > > 	    default_mode = &db[DEFAULT_MODEDB_INDEX];
> > > 	if (!default_bpp)
> > > 	    default_bpp = 8;
> > > 
> > > db will always be set.
> > 
> > I think we do need dbsize, and that the code which I have now:
> 
> I really don't trust dbsize. The driver writer can pass in the wrong 
> number.

That would be a bug.

> Whereas ARRAY_SIZE will always be correct. Lets take the position 
> that we use dbsize then we need to test if dbsize is greater than the 
> really size of the modedb. The dbsize parameter was for the days before we
> had ARRAY_SIZE.
> 
> > int fb_find_mode(struct fb_var_screeninfo *var,
> > 		 struct fb_info *info, const char *mode_option,
> > 		 const struct fb_videomode *db, unsigned int dbsize,
> > 		 const struct fb_videomode *default_mode,
> > 		 unsigned int default_bpp)
> > {
> >     int i;
> > 
> >     /* Set up defaults */
> >     if (!db) {
> > 	db = modedb;
> > 	dbsize = ARRAY_SIZE(modedb);
> >     }
> 
>       if (dbsize > ARRAY_SIZE(db))
> 	dbsize = ARRAY_SIZE(db);

We can't do ARRAY_SIZE on a random pointer like this: the compiler needs to
see the full definition of the array itself, and that is back in the
caller's compilation unit.



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

  reply	other threads:[~2006-11-20 20:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.64.0611151933070.12799@jalava.cc.jyu.fi>
2006-11-15 23:29 ` [PATCH -mm] fb: modedb uses wrong default_mode Andrew Morton
2006-11-15 23:44   ` Jordan Crouse
2006-11-17 20:08     ` [Linux-fbdev-devel] " James Simmons
2006-11-17 20:40       ` Andrew Morton
2006-11-18 10:39         ` [Linux-fbdev-devel] " Tero Roponen
2006-11-20 16:48         ` James Simmons
2006-11-20 20:05           ` Andrew Morton [this message]
2006-11-20 20:37             ` James Simmons

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=20061120120521.68724342.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=teanropo@jyu.fi \
    /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;
as well as URLs for NNTP newsgroup(s).