ChangeSet 1.1119.1.2, 2003/08/06 13:41:19-07:00, greg@kroah.com

[PATCH] USB: remove all struct device.name usage from the USB code.

This is because that field is going away shortly...


 drivers/usb/core/hcd-pci.c      |    3 -
 drivers/usb/core/hub.c          |    4 -
 drivers/usb/core/usb.c          |   81 +---------------------------------------
 drivers/usb/host/ehci-dbg.c     |    4 -
 drivers/usb/host/ehci-mem.c     |    1 
 drivers/usb/host/ohci-mem.c     |    1 
 drivers/usb/host/uhci-hcd.c     |    1 
 drivers/usb/serial/usb-serial.c |    1 
 8 files changed, 12 insertions(+), 84 deletions(-)


diff -Nru a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
--- a/drivers/usb/core/hcd-pci.c	Fri Aug  8 17:06:26 2003
+++ b/drivers/usb/core/hcd-pci.c	Fri Aug  8 17:06:26 2003
@@ -147,7 +147,8 @@
 	hcd->description = driver->description;
 	hcd->pdev = dev;
 	hcd->self.bus_name = pci_name(dev);
-	hcd->product_desc = dev->dev.name;
+	if (hcd->product_desc == NULL)
+		hcd->product_desc = "USB Host Controller";
 	hcd->self.controller = &dev->dev;
 	hcd->controller = hcd->self.controller;
 
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	Fri Aug  8 17:06:26 2003
+++ b/drivers/usb/core/hub.c	Fri Aug  8 17:06:26 2003
@@ -597,10 +597,8 @@
 
 	usb_set_intfdata (intf, hub);
 
-	if (hub_configure(hub, endpoint) >= 0) {
-		strcpy (intf->dev.name, "Hub");
+	if (hub_configure(hub, endpoint) >= 0)
 		return 0;
-	}
 
 	hub_disconnect (intf);
 	return -ENODEV;
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c	Fri Aug  8 17:06:26 2003
+++ b/drivers/usb/core/usb.c	Fri Aug  8 17:06:26 2003
@@ -978,68 +978,6 @@
 	return retval;
 }
 
-
-/* improve on the default device description, if we can ... and
- * while we're at it, maybe show the vendor and product strings.
- */
-static void set_device_description (struct usb_device *dev)
-{
-	void    *buf;
-	int	mfgr = dev->descriptor.iManufacturer;
-	int	prod = dev->descriptor.iProduct;
-	int	vendor_id = dev->descriptor.idVendor;
-	int	product_id = dev->descriptor.idProduct;
-	char	*mfgr_str, *prod_str;
-
-	/* set default; keep it if there are no strings, or kmalloc fails */
-	sprintf (dev->dev.name, "USB device %04x:%04x",
-		 vendor_id, product_id);
-
-	if (!(buf = kmalloc(256 * 2, GFP_KERNEL)))
-		return;
-	
-	prod_str = (char *) buf;
-	mfgr_str = (char *) buf + 256;
-
-	if (prod && usb_string (dev, prod, prod_str, 256) > 0) {
-#ifdef DEBUG
-		dev_printk (KERN_INFO, &dev->dev, "Product: %s\n", prod_str);
-#endif
-	} else {
-		prod_str = 0;
-	}
-
-	if (mfgr && usb_string (dev, mfgr, mfgr_str, 256) > 0) {
-#ifdef DEBUG
-		dev_printk (KERN_INFO, &dev->dev, "Manufacturer: %s\n", mfgr_str);
-#endif
-	} else {
-		mfgr_str = 0;
-	}
-
-	/* much like pci ... describe as either:
-	 * - both strings:   'product descr (vendor descr)'
-	 * - product only:   'product descr (USB device vvvv:pppp)'
-	 * - vendor only:    'USB device vvvv:pppp (vendor descr)'
-	 * - neither string: 'USB device vvvv:pppp'
-	 */
-
-	if (prod_str && mfgr_str) {
-		snprintf(dev->dev.name, sizeof dev->dev.name,
-			 "%s (%s)", prod_str, mfgr_str);
-	} else if (prod_str) {
-		snprintf(dev->dev.name, sizeof dev->dev.name,
-			 "%s (USB device %04x:%04x)",
-			 prod_str, vendor_id, product_id);
-	} else if (mfgr_str) {
-		snprintf(dev->dev.name, sizeof dev->dev.name,
-			 "USB device %04x:%04x (%s)",
-			 vendor_id, product_id, mfgr_str);
-	}
-
-	kfree(buf);
-}
-
 /*
  * By the time we get here, we chose a new device address
  * and is in the default state. We need to identify the thing and
@@ -1181,9 +1119,12 @@
 
 	dev_dbg(&dev->dev, "new device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
 		dev->descriptor.iManufacturer, dev->descriptor.iProduct, dev->descriptor.iSerialNumber);
-	set_device_description (dev);
 
 #ifdef DEBUG
+	if (dev->descriptor.iProduct)
+		usb_show_string(dev, "Product", dev->descriptor.iProduct);
+	if (dev->descriptor.iManufacturer)
+		usb_show_string(dev, "Manufacturer", dev->descriptor.iManufacturer);
 	if (dev->descriptor.iSerialNumber)
 		usb_show_string(dev, "SerialNumber", dev->descriptor.iSerialNumber);
 #endif
@@ -1208,20 +1149,6 @@
 		sprintf (&interface->dev.bus_id[0], "%d-%s:%d",
 			 dev->bus->busnum, dev->devpath,
 			 desc->bInterfaceNumber);
-		if (!desc->iInterface
-				|| usb_string (dev, desc->iInterface,
-					interface->dev.name,
-					sizeof interface->dev.name) <= 0) {
-			/* typically devices won't bother with interface
-			 * descriptions; this is the normal case.  an
-			 * interface's driver might describe it better.
-			 * (also: iInterface is per-altsetting ...)
-			 */
-			sprintf (&interface->dev.name[0],
-				"usb-%s-%s interface %d",
-				dev->bus->bus_name, dev->devpath,
-				desc->bInterfaceNumber);
-		}
 		dev_dbg (&dev->dev, "%s - registering interface %s\n", __FUNCTION__, interface->dev.bus_id);
 		device_add (&interface->dev);
 		usb_create_driverfs_intf_files (interface);
diff -Nru a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
--- a/drivers/usb/host/ehci-dbg.c	Fri Aug  8 17:06:26 2003
+++ b/drivers/usb/host/ehci-dbg.c	Fri Aug  8 17:06:26 2003
@@ -591,8 +591,8 @@
 	/* Capability Registers */
 	i = readw (&ehci->caps->hci_version);
 	temp = snprintf (next, size,
-		"%s\nEHCI %x.%02x, hcd state %d (driver " DRIVER_VERSION ")\n",
-		hcd->pdev->dev.name,
+		"PCI device %s\nEHCI %x.%02x, hcd state %d (driver " DRIVER_VERSION ")\n",
+		pci_name(hcd->pdev),
 		i >> 8, i & 0x0ff, ehci->hcd.state);
 	size -= temp;
 	next += temp;
diff -Nru a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
--- a/drivers/usb/host/ehci-mem.c	Fri Aug  8 17:06:26 2003
+++ b/drivers/usb/host/ehci-mem.c	Fri Aug  8 17:06:26 2003
@@ -44,6 +44,7 @@
 		kmalloc (sizeof (struct ehci_hcd), GFP_KERNEL);
 	if (ehci != 0) {
 		memset (ehci, 0, sizeof (struct ehci_hcd));
+		ehci->hcd.product_desc = "EHCI Host Controller";
 		return &ehci->hcd;
 	}
 	return 0;
diff -Nru a/drivers/usb/host/ohci-mem.c b/drivers/usb/host/ohci-mem.c
--- a/drivers/usb/host/ohci-mem.c	Fri Aug  8 17:06:26 2003
+++ b/drivers/usb/host/ohci-mem.c	Fri Aug  8 17:06:26 2003
@@ -30,6 +30,7 @@
 	ohci = (struct ohci_hcd *) kmalloc (sizeof *ohci, GFP_KERNEL);
 	if (ohci != 0) {
 		memset (ohci, 0, sizeof (struct ohci_hcd));
+		ohci->hcd.product_desc = "OHCI Host Controller";
 		return &ohci->hcd;
 	}
 	return 0;
diff -Nru a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
--- a/drivers/usb/host/uhci-hcd.c	Fri Aug  8 17:06:26 2003
+++ b/drivers/usb/host/uhci-hcd.c	Fri Aug  8 17:06:26 2003
@@ -2460,6 +2460,7 @@
 		return NULL;
 
 	memset(uhci, 0, sizeof(*uhci));
+	uhci->hcd.product_desc = "UHCI Host Controller";
 	return &uhci->hcd;
 }
 
diff -Nru a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
--- a/drivers/usb/serial/usb-serial.c	Fri Aug  8 17:06:26 2003
+++ b/drivers/usb/serial/usb-serial.c	Fri Aug  8 17:06:26 2003
@@ -1238,7 +1238,6 @@
 		port->dev.bus = &usb_serial_bus_type;
 
 		snprintf (&port->dev.bus_id[0], sizeof(port->dev.bus_id), "ttyUSB%d", port->number);
-		snprintf (&port->dev.name[0], sizeof(port->dev.name), "usb serial port %d", port->number);
 		dbg ("%s - registering %s", __FUNCTION__, port->dev.bus_id);
 		device_register (&port->dev);
 	}
