Commit 79715ebc authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[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.
parent ddae9dee
......@@ -1208,6 +1208,7 @@ static int ax8817x_bind(struct usb_interface *intf,
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);
......
......@@ -936,6 +936,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
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);
......
......@@ -1123,8 +1123,9 @@ static int kaweth_probe(
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;
}
......
......@@ -1262,7 +1262,6 @@ static int pegasus_probe(struct usb_interface *intf,
}
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 @@ static int pegasus_probe(struct usb_interface *intf,
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:
......
......@@ -830,6 +830,7 @@ static int rtl8150_probe(struct usb_interface *intf,
usb_set_intfdata(intf, dev);
SET_NETDEV_DEV(netdev, &intf->dev);
if (register_netdev(netdev) != 0) {
err("couldn't register the device");
goto out2;
......
......@@ -2602,7 +2602,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment