ChangeSet 1.1455.1.23, 2003/07/15 14:53:33-07:00, david-b@pacbell.net [PATCH] USB: usb net drivers SET_NETDEV_DEV I noticed that Viro's "use alloc_etherdev" patch left a small problem: only "usbnet" did SET_NETDEV_DEV, and that used the wrong driver model device. This has all the usb network drivers use SET_NETDEV_DEV, so the /sys/class/net/*/{device,driver} files link to the relevant usb interface and to its device driver. drivers/usb/net/ax8817x.c | 1 + drivers/usb/net/catc.c | 1 + drivers/usb/net/kaweth.c | 3 ++- drivers/usb/net/pegasus.c | 3 ++- drivers/usb/net/rtl8150.c | 1 + drivers/usb/net/usbnet.c | 2 +- 6 files changed, 8 insertions(+), 3 deletions(-) diff -Nru a/drivers/usb/net/ax8817x.c b/drivers/usb/net/ax8817x.c --- a/drivers/usb/net/ax8817x.c Thu Jul 17 17:04:55 2003 +++ b/drivers/usb/net/ax8817x.c Thu Jul 17 17:04:56 2003 @@ -1208,6 +1208,7 @@ net->init = ax8817x_net_init; net->priv = ax_info; + SET_NETDEV_DEV(net, &intf->dev); ret = register_netdev(net); if (ret < 0) { err("%s: Failed net init (%d)\n", __FUNCTION__, ret); diff -Nru a/drivers/usb/net/catc.c b/drivers/usb/net/catc.c --- a/drivers/usb/net/catc.c Thu Jul 17 17:04:56 2003 +++ b/drivers/usb/net/catc.c Thu Jul 17 17:04:56 2003 @@ -936,6 +936,7 @@ printk("%2.2x.\n", netdev->dev_addr[i]); usb_set_intfdata(intf, catc); + SET_NETDEV_DEV(netdev, &intf->dev); if (register_netdev(netdev) != 0) { usb_set_intfdata(intf, NULL); usb_free_urb(catc->ctrl_urb); diff -Nru a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c --- a/drivers/usb/net/kaweth.c Thu Jul 17 17:04:56 2003 +++ b/drivers/usb/net/kaweth.c Thu Jul 17 17:04:56 2003 @@ -1123,8 +1123,9 @@ if (dma_supported (&intf->dev, 0xffffffffffffffffULL)) kaweth->net->features |= NETIF_F_HIGHDMA; + SET_NETDEV_DEV(netdev, &intf->dev); if (register_netdev(netdev) != 0) { - kaweth_err("Error calling init_etherdev."); + kaweth_err("Error registering netdev."); goto err_intfdata; } diff -Nru a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c --- a/drivers/usb/net/pegasus.c Thu Jul 17 17:04:56 2003 +++ b/drivers/usb/net/pegasus.c Thu Jul 17 17:04:56 2003 @@ -1262,7 +1262,6 @@ } set_ethernet_addr(pegasus); fill_skb_pool(pegasus); - printk("%s: %s\n", net->name, usb_dev_id[dev_index].name); if (pegasus->features & PEGASUS_II) { info("setup Pegasus II specific registers"); setup_pegasus_II(pegasus); @@ -1273,9 +1272,11 @@ pegasus->phy = 1; } usb_set_intfdata(intf, pegasus); + SET_NETDEV_DEV(net, &intf->dev); res = register_netdev(net); if (res) goto out4; + printk("%s: %s\n", net->name, usb_dev_id[dev_index].name); return 0; out4: diff -Nru a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c --- a/drivers/usb/net/rtl8150.c Thu Jul 17 17:04:56 2003 +++ b/drivers/usb/net/rtl8150.c Thu Jul 17 17:04:56 2003 @@ -830,6 +830,7 @@ usb_set_intfdata(intf, dev); + SET_NETDEV_DEV(netdev, &intf->dev); if (register_netdev(netdev) != 0) { err("couldn't register the device"); goto out2; diff -Nru a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c --- a/drivers/usb/net/usbnet.c Thu Jul 17 17:04:56 2003 +++ b/drivers/usb/net/usbnet.c Thu Jul 17 17:04:56 2003 @@ -2602,7 +2602,7 @@ dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1); - SET_NETDEV_DEV(dev->net, &dev->udev->dev); + SET_NETDEV_DEV(dev->net, &udev->dev); status = register_netdev (dev->net); if (status) goto out3;