Thread (4 messages) 4 messages, 2 authors, 2004-03-02

Re: [janitor] remove casts in drivers/net/arm/

From: Jeff Garzik <hidden>
Date: 2004-03-02 19:07:36

Possibly related (same subject, not in this thread)

Randy.Dunlap wrote:
On Tue, 02 Mar 2004 13:54:36 -0500 Jeff Garzik wrote:

| Russell King wrote:
| > On Sun, Feb 29, 2004 at 02:34:36PM -0800, Randy.Dunlap wrote:
| > 
| >> drivers/net/arm/am79c961a.c |   18 +++++++++---------
| >> drivers/net/arm/ether1.c    |   18 +++++++++---------
| >> drivers/net/arm/ether3.c    |   18 +++++++++---------
| >> drivers/net/arm/etherh.c    |    4 ++--
| >> 4 files changed, 29 insertions(+), 29 deletions(-)
| > 
| > 
| > I think we should really consider using netdev_priv() in all these places
| > so the compiler knows that 'dev' and 'priv' are related.
| 
| 
| Good point.

I respectfully disagree, but if the maintainter won't merge
them as is, so be it.

I have trouble understanding why this:
	return (char *)dev + ((sizeof(struct net_device) + 31) & ~31);
is better than using a structure->field, i.e.,
	dev->priv

Can one of you enlighten me?

One is an additional pointer load and dereference, and one is a constant 
offset from the beginning of the dev structure, calculated at compile 
time.  netdev_priv() provides the same results as dev->priv but at less 
cost.

	Jeff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help