[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090520153158.57785c82@bike.lwn.net>
Date: Wed, 20 May 2009 15:31:58 -0600
From: Jonathan Corbet <corbet@....net>
To: Wolfgang Grandegger <wg@...ndegger.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Oliver Hartkopp <oliver.hartkopp@...kswagen.de>
Subject: Re: [PATCH v2 4/7] [PATCH 4/8] can: Driver for the SJA1000 CAN
controller
On Sat, 16 May 2009 08:57:03 +0200
Wolfgang Grandegger <wg@...ndegger.com> wrote:
> > But "struct net_device" does not have a "priv" member. netdev_priv(dev)
> > always points to the beginning of the private data area. See:
> >
> > http://lxr.linux.no/linux+v2.6.29/include/linux/netdevice.h#L953
>
> I could use container_of() as you suggested, of course, if the "struct
> can_priv" remains the first member of "struct sja1000_priv". Would that
> already be an improvement?
Ah, OK, I'm a little slow, sorry. I do get what the problem is here.
Using container_of() in that situation doesn't help a whole lot. The
point is to get away from this assumption that struct can_priv is the
first element of the structure.
Perhaps what you have is as good as it gets for now, but please add a
comment to the structure noting that struct can_priv has to come first
and why.
Thanks,
jon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists