Re: [PATCH v2 4/7] [PATCH 4/8] can: Driver for the SJA1000 CANcontroller
From: Jonathan Corbet
Date: Wed May 20 2009 - 17:32:23 EST
On Sat, 16 May 2009 08:57:03 +0200
Wolfgang Grandegger <wg@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/