• Florian Fainelli's avatar
    net: core: add of_find_net_device_by_node() · aa836df9
    Florian Fainelli authored
    Add a helper function which allows getting the struct net_device pointer
    associated with a given struct device_node pointer. This is useful for
    instance for DSA Ethernet devices not backed by a platform_device, but a PCI
    device.
    
    Since we need to access net_class which is not accessible outside of
    net/core/net-sysfs.c, this helper function is also added here and gated
    with CONFIG_OF_NET.
    
    Network devices initialized with SET_NETDEV_DEV() are also taken into
    account by checking for dev->parent first and then falling back to
    checking the device pointer within struct net_device.
    Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    aa836df9
net-sysfs.c 34.6 KB