lkml.org 
[lkml]   [2004]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2.6] Natsemi - remove compilation warnings


On Thu, 30 Sep 2004, Jeff Garzik wrote:
> >
> > +static inline void __iomem *ns_ioaddr(struct net_device *dev)
> > +{
> > + return (void __iomem *) dev->base_addr;
> > +}
> > +
>
> hmmmm. Since dev->base_addr gets exported to userspace, I don't think
> it's that quick/easy to change.

Hmm? This maintains the _exact_ old semantics, ie we do exactly what it
used to do before. The inline function doesn't save the value off
anywhere, it's really just a nicer way to do a cast in _one_ place rather
than all over the world. Also, it ends up resulting in just _one_ place
that knows where to get the base address, instead of several places in
pretty much every function in the whole driver ;-P

> Wouldn't it be better to just phase out the base of dev->base_addr
> completely? I tend to prefer adding a "void __iomem *regs" to struct
> netdev_private, and ignore dev->base_addr completely.

Yes. I didn't want to change actual behaviour in a driver that I can't
even test, so I went for the semantically 100% equivalent cleanup patch
instead that just changes the syntax and gets rid of the warnings.

But that's the other advantage of the ns_ioaddr() accessor function:
somebody who does have the hw can now phase out "base_addr", and just
change that one one-liner function, and you can now get the base address
from anywhere you like ;)

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-11-18 23:46    [from the cache]
©2003-2011 Jasper Spaans