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)
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;
......
......@@ -597,10 +597,8 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
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;
......
......@@ -978,68 +978,6 @@ int usb_set_address(struct usb_device *dev)
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 @@ 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->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 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
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);
......
......@@ -591,8 +591,8 @@ show_registers (struct class_device *class_dev, char *buf)
/* 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;
......
......@@ -44,6 +44,7 @@ static struct usb_hcd *ehci_hcd_alloc (void)
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;
......
......@@ -30,6 +30,7 @@ static struct usb_hcd *ohci_hcd_alloc (void)
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;
......
......@@ -2460,6 +2460,7 @@ static struct usb_hcd *uhci_hcd_alloc(void)
return NULL;
memset(uhci, 0, sizeof(*uhci));
uhci->hcd.product_desc = "UHCI Host Controller";
return &uhci->hcd;
}
......
......@@ -1238,7 +1238,6 @@ int usb_serial_probe(struct usb_interface *interface,
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);
}
......
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