ntb_netdev: set the net_device's parent
authorLogan Gunthorpe <logang@deltatee.com>
Mon, 5 Jun 2017 20:00:51 +0000 (14:00 -0600)
committerJon Mason <jdmason@kudzu.us>
Thu, 6 Jul 2017 15:30:08 +0000 (11:30 -0400)
At present, ntb_netdev devices end up under /sys/devices/virtual/net
completely unconnected to the ntb trees below them. This patch sets the
parent of the net_device (using SET_NETDEV_DEV) to the client_dev
device. This results in a better connected sysfs path for the network
device:

/sys/devices/pci0000:00/0000:00:03.0/0000:03:00.1/0000:03:00.1/ntb_netdev0/net/eth2

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Allen Hubbe <Allen.Hubbe@dell.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
drivers/net/ntb_netdev.c

index 4daf3d0926a82cfb52fd6cf774f0a467230c3246..0250aa9ae2cbc9b0878c89b856f3b591dea3b0a5 100644 (file)
@@ -418,6 +418,8 @@ static int ntb_netdev_probe(struct device *client_dev)
        if (!ndev)
                return -ENOMEM;
 
        if (!ndev)
                return -ENOMEM;
 
+       SET_NETDEV_DEV(ndev, client_dev);
+
        dev = netdev_priv(ndev);
        dev->ndev = ndev;
        dev->pdev = pdev;
        dev = netdev_priv(ndev);
        dev->ndev = ndev;
        dev->pdev = pdev;