# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.369.105.16 -> 1.369.105.17
#       drivers/usb/net/usbnet.c        1.18    -> 1.19   
#       drivers/usb/net/rtl8150.c       1.3     -> 1.4    
#       drivers/usb/net/catc.c  1.12    -> 1.13   
#       drivers/usb/net/pegasus.c       1.22    -> 1.23   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/04/09      [EMAIL PROTECTED]     1.369.105.17
# [PATCH] USB net drivers, ethtool bus_info
# 
# USB net drivers, ethtool bus_info
# 
# This patch makes the USB network drivers that have ethtool support
# expose only those stable IDs ... no more references to unstable values
# like dev->bus->busnum (changes depending on order of modprobe)
# or dev->devnum (assigned not quite randomly during enumeration :).
# 
# This supports more intelligent policies for user mode tools, such
# as "always assign this address to the device on that port", as well
# as making troubleshooting more practical when there are multiple
# devices (of a given type) present ... you can tell which is which.
# --------------------------------------------
#
diff -Nru a/drivers/usb/net/catc.c b/drivers/usb/net/catc.c
--- a/drivers/usb/net/catc.c    Thu Apr 11 11:28:30 2002
+++ b/drivers/usb/net/catc.c    Thu Apr 11 11:28:30 2002
@@ -655,7 +655,6 @@
 {
         struct catc *catc = dev->priv;
         u32 cmd;
-       char tmp[40];
         
         if (get_user(cmd, (u32 *)useraddr))
                 return -EFAULT;
@@ -666,8 +665,7 @@
                 struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
                 strncpy(info.driver, SHORT_DRIVER_DESC, ETHTOOL_BUSINFO_LEN);
                 strncpy(info.version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN);
-               sprintf(tmp, "usb%d:%d", catc->usbdev->bus->busnum, 
catc->usbdev->devnum);
-                strncpy(info.bus_info, tmp,ETHTOOL_BUSINFO_LEN);
+               usb_make_path (catc->usbdev, info.bus_info, sizeof info.bus_info);
                 if (copy_to_user(useraddr, &info, sizeof(info)))
                         return -EFAULT;
                 return 0;
@@ -909,9 +907,9 @@
                f5u011_rxmode(catc, catc->rxmode);
        }
        dbg("Init done.");
-       printk(KERN_INFO "%s: %s USB Ethernet at usb%d:%d.%d, ",
+       printk(KERN_INFO "%s: %s USB Ethernet at usb-%s-%s/%d, ",
               netdev->name, (catc->is_f5u011) ? "Belkin F5U011" : "CATC EL1210A 
NetMate",
-              usbdev->bus->busnum, usbdev->devnum, ifnum);
+              usbdev->bus->bus_name, usbdev->devpath, ifnum);
        for (i = 0; i < 5; i++) printk("%2.2x:", netdev->dev_addr[i]);
        printk("%2.2x.\n", netdev->dev_addr[i]);
        return catc;
diff -Nru a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
--- a/drivers/usb/net/pegasus.c Thu Apr 11 11:28:30 2002
+++ b/drivers/usb/net/pegasus.c Thu Apr 11 11:28:30 2002
@@ -798,7 +798,6 @@
 {
        pegasus_t       *pegasus;
        int             cmd;
-       char            tmp[128];
 
        pegasus = net->priv;
        if (get_user(cmd, (int *)uaddr))
@@ -808,9 +807,7 @@
                struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
                strncpy(info.driver, DRIVER_DESC, ETHTOOL_BUSINFO_LEN);
                strncpy(info.version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN);
-               sprintf(tmp, "usb%d:%d", pegasus->usb->bus->busnum,
-                       pegasus->usb->devnum);
-               strncpy(info.bus_info, tmp, ETHTOOL_BUSINFO_LEN);
+               usb_make_path (pegasus->usb, info.bus_info, sizeof info.bus_info);
                if (copy_to_user(uaddr, &info, sizeof(info)))
                        return -EFAULT;
                return 0;
diff -Nru a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c
--- a/drivers/usb/net/rtl8150.c Thu Apr 11 11:28:30 2002
+++ b/drivers/usb/net/rtl8150.c Thu Apr 11 11:28:30 2002
@@ -552,7 +552,6 @@
 {
        rtl8150_t       *dev;
        int             cmd;
-       char            tmp[128];
 
        dev = netdev->priv;
        if (get_user(cmd, (int *)uaddr))
@@ -564,9 +563,7 @@
                
                strncpy(info.driver, DRIVER_DESC, ETHTOOL_BUSINFO_LEN);
                strncpy(info.version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN);
-               sprintf(tmp, "usb%d:%d", dev->udev->bus->busnum,
-                       dev->udev->devnum);
-               strncpy(info.bus_info, tmp, ETHTOOL_BUSINFO_LEN);
+               usb_make_path (dev->udev, info.bus_info, sizeof info.bus_info);
                if (copy_to_user(uaddr, &info, sizeof(info)))
                        return -EFAULT;
                return 0;
diff -Nru a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
--- a/drivers/usb/net/usbnet.c  Thu Apr 11 11:28:30 2002
+++ b/drivers/usb/net/usbnet.c  Thu Apr 11 11:28:30 2002
@@ -834,10 +834,10 @@
 static inline void nc_dump_usbctl (struct usbnet *dev, u16 usbctl)
 {
 #ifdef DEBUG
-       devdbg (dev, "net1080 %03d/%03d usbctl 0x%x:%s%s%s%s%s;"
+       devdbg (dev, "net1080 %s-%s usbctl 0x%x:%s%s%s%s%s;"
                        " this%s%s;"
                        " other%s%s; r/o 0x%x",
-               dev->udev->bus->busnum, dev->udev->devnum,
+               dev->udev->bus->bus_name, dev->udev->devpath,
                usbctl,
                (usbctl & USBCTL_ENABLE_LANG) ? " lang" : "",
                (usbctl & USBCTL_ENABLE_MFGR) ? " mfgr" : "",
@@ -879,10 +879,10 @@
 static inline void nc_dump_status (struct usbnet *dev, u16 status)
 {
 #ifdef DEBUG
-       devdbg (dev, "net1080 %03d/%03d status 0x%x:"
+       devdbg (dev, "net1080 %s-%s status 0x%x:"
                        " this (%c) PKT=%d%s%s%s;"
                        " other PKT=%d%s%s%s; unspec 0x%x",
-               dev->udev->bus->busnum, dev->udev->devnum,
+               dev->udev->bus->bus_name, dev->udev->devpath,
                status,
 
                // XXX the packet counts don't seem right
@@ -917,8 +917,8 @@
 static inline void nc_dump_ttl (struct usbnet *dev, u16 ttl)
 {
 #ifdef DEBUG
-       devdbg (dev, "net1080 %03d/%03d ttl 0x%x this = %d, other = %d",
-               dev->udev->bus->busnum, dev->udev->devnum,
+       devdbg (dev, "net1080 %s-%s ttl 0x%x this = %d, other = %d",
+               dev->udev->bus->bus_name, dev->udev->devpath,
                ttl,
 
                TTL_THIS (ttl),
@@ -941,7 +941,8 @@
        // nc_dump_registers (dev);
 
        if ((retval = nc_register_read (dev, REG_STATUS, vp)) < 0) {
-               dbg ("can't read dev %d status: %d", dev->udev->devnum, retval);
+               dbg ("can't read %s-%s status: %d",
+                       dev->udev->bus->bus_name, dev->udev->devpath, retval);
                goto done;
        }
        status = *vp;
@@ -1504,10 +1505,9 @@
 
        // put into "known safe" state
        if (info->reset && (retval = info->reset (dev)) < 0) {
-               devinfo (dev, "open reset fail (%d) usbnet bus%d%s, %s",
+               devinfo (dev, "open reset fail (%d) usbnet usb-%s-%s, %s",
                        retval,
-                       // FIXME busnum is unstable
-                       dev->udev->bus->busnum, dev->udev->devpath,
+                       dev->udev->bus->bus_name, dev->udev->devpath,
                        info->description);
                goto done;
        }
@@ -1557,9 +1557,7 @@
                strncpy (info.version, DRIVER_VERSION, sizeof info.version);
                strncpy (info.fw_version, dev->driver_info->description,
                        sizeof info.fw_version);
-               snprintf (info.bus_info, sizeof info.bus_info, "USB bus%d%s",
-                       /* FIXME busnums are bogus/unstable IDs */
-                       dev->udev->bus->busnum, dev->udev->devpath);
+               usb_make_path (dev->udev, info.bus_info, sizeof info.bus_info);
                if (copy_to_user (useraddr, &info, sizeof (info)))
                        return -EFAULT;
                return 0;
@@ -1847,9 +1845,8 @@
 {
        struct usbnet   *dev = (struct usbnet *) ptr;
 
-       devinfo (dev, "unregister usbnet bus%d%s, %s",
-               // FIXME busnum is unstable
-               udev->bus->busnum, udev->devpath,
+       devinfo (dev, "unregister usbnet usb-%s-%s, %s",
+               udev->bus->bus_name, udev->devpath,
                dev->driver_info->description);
        
        unregister_netdev (&dev->net);
@@ -1938,9 +1935,8 @@
        net->do_ioctl = usbnet_ioctl;
 
        register_netdev (&dev->net);
-       devinfo (dev, "register usbnet bus%d%s, %s",
-               // FIXME busnum is unstable
-               udev->bus->busnum, udev->devpath,
+       devinfo (dev, "register usbnet usb-%s-%s, %s",
+               udev->bus->bus_name, udev->devpath,
                dev->driver_info->description);
 
        // ok, it's ready to go.

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to