Re: [PATCH] can: rename LED trigger name on netdev renames

From: Fabio Baltieri
Date: Thu Sep 06 2012 - 16:44:54 EST


On Thu, Sep 06, 2012 at 09:31:07PM +0200, Oliver Hartkopp wrote:
> >> +
> >> +/*
> >> + * NETDEV rename notifier to rename the associated led triggers too
> >> + */
> >> +static int can_led_notifier(struct notifier_block *nb, unsigned long msg,
> >> + void *data)
> >> +{
> >> + struct net_device *netdev = (struct net_device *)data;
> >> + struct can_priv *priv = netdev_priv(netdev);
> >> + int busy = 0;
> >> +
> >> + if (!net_eq(dev_net(netdev), &init_net))
> >> + return NOTIFY_DONE;
> >> +
> >> + if (netdev->type != ARPHRD_CAN)
> >> + return NOTIFY_DONE;
> >> +
> >> + if (msg != NETDEV_CHANGENAME)
> >> + return NOTIFY_DONE;
> >
> > That's the main problem, which I also got stuck into when I did my first
> > can-led implementation. As LED structures are in netdev's private data,
> > you can only use it if your driver is based on the can-dev API, and
> > there are no way to be sure of that if you get outside driver's code
> > itself.
> >
> > This would give problems with vcan, slcan, and probabily other
> > non-mainlined drivers.
>
>
> Do you think, this is really a problem?
>
> If a driver decides not to use the can-dev framework it has to implement own
> solutions or just adopt can-dev.

Agreed, but this still means that we can't assume that
netdev_priv(netdev) to a netdev where netdev->type == ARPHRD_CAN points
to a struct can_priv, right?

Fabio
--
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/