Commit 5757f1dc authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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

This is because that field is going away shortly...
parent 92ddc68d
...@@ -147,7 +147,8 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id) ...@@ -147,7 +147,8 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
hcd->description = driver->description; hcd->description = driver->description;
hcd->pdev = dev; hcd->pdev = dev;
hcd->self.bus_name = pci_name(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->self.controller = &dev->dev;
hcd->controller = hcd->self.controller; hcd->controller = hcd->self.controller;
......
...@@ -597,10 +597,8 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -597,10 +597,8 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
usb_set_intfdata (intf, hub); usb_set_intfdata (intf, hub);
if (hub_configure(hub, endpoint) >= 0) { if (hub_configure(hub, endpoint) >= 0)
strcpy (intf->dev.name, "Hub");
return 0; return 0;
}
hub_disconnect (intf); hub_disconnect (intf);
return -ENODEV; return -ENODEV;
......
...@@ -978,68 +978,6 @@ int usb_set_address(struct usb_device *dev) ...@@ -978,68 +978,6 @@ int usb_set_address(struct usb_device *dev)
return retval; 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 * 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 * and is in the default state. We need to identify the thing and
...@@ -1181,9 +1119,12 @@ int usb_new_device(struct usb_device *dev, struct device *parent) ...@@ -1181,9 +1119,12 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
dev_dbg(&dev->dev, "new device strings: Mfr=%d, Product=%d, SerialNumber=%d\n", dev_dbg(&dev->dev, "new device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
dev->descriptor.iManufacturer, dev->descriptor.iProduct, dev->descriptor.iSerialNumber); dev->descriptor.iManufacturer, dev->descriptor.iProduct, dev->descriptor.iSerialNumber);
set_device_description (dev);
#ifdef DEBUG #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) if (dev->descriptor.iSerialNumber)
usb_show_string(dev, "SerialNumber", dev->descriptor.iSerialNumber); usb_show_string(dev, "SerialNumber", dev->descriptor.iSerialNumber);
#endif #endif
...@@ -1208,20 +1149,6 @@ int usb_new_device(struct usb_device *dev, struct device *parent) ...@@ -1208,20 +1149,6 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
sprintf (&interface->dev.bus_id[0], "%d-%s:%d", sprintf (&interface->dev.bus_id[0], "%d-%s:%d",
dev->bus->busnum, dev->devpath, dev->bus->busnum, dev->devpath,
desc->bInterfaceNumber); 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); dev_dbg (&dev->dev, "%s - registering interface %s\n", __FUNCTION__, interface->dev.bus_id);
device_add (&interface->dev); device_add (&interface->dev);
usb_create_driverfs_intf_files (interface); usb_create_driverfs_intf_files (interface);
......
...@@ -591,8 +591,8 @@ show_registers (struct class_device *class_dev, char *buf) ...@@ -591,8 +591,8 @@ show_registers (struct class_device *class_dev, char *buf)
/* Capability Registers */ /* Capability Registers */
i = readw (&ehci->caps->hci_version); i = readw (&ehci->caps->hci_version);
temp = snprintf (next, size, temp = snprintf (next, size,
"%s\nEHCI %x.%02x, hcd state %d (driver " DRIVER_VERSION ")\n", "PCI device %s\nEHCI %x.%02x, hcd state %d (driver " DRIVER_VERSION ")\n",
hcd->pdev->dev.name, pci_name(hcd->pdev),
i >> 8, i & 0x0ff, ehci->hcd.state); i >> 8, i & 0x0ff, ehci->hcd.state);
size -= temp; size -= temp;
next += temp; next += temp;
......
...@@ -44,6 +44,7 @@ static struct usb_hcd *ehci_hcd_alloc (void) ...@@ -44,6 +44,7 @@ static struct usb_hcd *ehci_hcd_alloc (void)
kmalloc (sizeof (struct ehci_hcd), GFP_KERNEL); kmalloc (sizeof (struct ehci_hcd), GFP_KERNEL);
if (ehci != 0) { if (ehci != 0) {
memset (ehci, 0, sizeof (struct ehci_hcd)); memset (ehci, 0, sizeof (struct ehci_hcd));
ehci->hcd.product_desc = "EHCI Host Controller";
return &ehci->hcd; return &ehci->hcd;
} }
return 0; return 0;
......
...@@ -30,6 +30,7 @@ static struct usb_hcd *ohci_hcd_alloc (void) ...@@ -30,6 +30,7 @@ static struct usb_hcd *ohci_hcd_alloc (void)
ohci = (struct ohci_hcd *) kmalloc (sizeof *ohci, GFP_KERNEL); ohci = (struct ohci_hcd *) kmalloc (sizeof *ohci, GFP_KERNEL);
if (ohci != 0) { if (ohci != 0) {
memset (ohci, 0, sizeof (struct ohci_hcd)); memset (ohci, 0, sizeof (struct ohci_hcd));
ohci->hcd.product_desc = "OHCI Host Controller";
return &ohci->hcd; return &ohci->hcd;
} }
return 0; return 0;
......
...@@ -2460,6 +2460,7 @@ static struct usb_hcd *uhci_hcd_alloc(void) ...@@ -2460,6 +2460,7 @@ static struct usb_hcd *uhci_hcd_alloc(void)
return NULL; return NULL;
memset(uhci, 0, sizeof(*uhci)); memset(uhci, 0, sizeof(*uhci));
uhci->hcd.product_desc = "UHCI Host Controller";
return &uhci->hcd; return &uhci->hcd;
} }
......
...@@ -1238,7 +1238,6 @@ int usb_serial_probe(struct usb_interface *interface, ...@@ -1238,7 +1238,6 @@ int usb_serial_probe(struct usb_interface *interface,
port->dev.bus = &usb_serial_bus_type; 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.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); dbg ("%s - registering %s", __FUNCTION__, port->dev.bus_id);
device_register (&port->dev); device_register (&port->dev);
} }
......
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