Re: ethernet<n> dt aliases implications in U-Boot and Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Is something like the following really that crazy of an idea?
> diff --git a/net/core/dev.c b/net/core/dev.c
> index e0878a500aa9..a679c74a63c6 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1151,6 +1151,15 @@ static int dev_alloc_name_ns(struct net *net,
>         int ret;
> 
>         BUG_ON(!net);
> +#ifdef CONFIG_OF
> +       if (dev->dev.parent && dev->dev.parent->of_node) {
> +               const char *name =
> of_get_property(dev->dev.parent->of_node, "label", NULL);
> +               if (name) {
> +                       strlcpy(dev->name, name, IFNAMSIZ);
> +                       return 0;
> +               }
> +       }
> +#endif
>         ret = __dev_alloc_name(net, name, buf);
>         if (ret >= 0)
>                 strlcpy(dev->name, buf, IFNAMSIZ);
> 
> I still like using the index from aliases/ethernet* instead as there
> is a precedence for that in other Linux drivers as well as U-Boot

I guess you are new to the netdev list :-)

This is one of those FAQ sort of things, discussed every
year. Anything like this is always NACKed. I don't see why this time
should be any different.

DSA is somewhat special because it is very old. It comes from before
the times of DT. Its DT binding was proposed relatively earl in DT
times, and would be rejected in modern days. But the rules of ABI mean
the label property will be valid forever. But i very much doubt it
will spread to interfaces in general.

     Andrew



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux