On Fri, 15 Oct 2004, Lee Revell wrote:
> On Fri, 2004-10-15 at 13:36, Paul Fulghum wrote:
> > Unique device names are useful for identifying
> > which device instance is on a particular interrupt
> > (/proc/interrupts), but other drivers beside uhci_hcd
> > use a constant name so I guess that is legal :-)
> >
>
> I agree that this would be a useful enhancement to the uhci_hcd driver.
> For example:
>
> CPU0
> 0: 183247514 XT-PIC timer 0/47514
> 1: 67096 XT-PIC i8042 58/67096
> 2: 0 XT-PIC cascade 0/0
> 8: 82425669 XT-PIC rtc 0/25669
> 10: 163607273 XT-PIC uhci_hcd, EMU10K1 0/7273
> 11: 1912890 XT-PIC uhci_hcd, eth0 0/12890
> 12: 0 XT-PIC uhci_hcd 0/0
> 15: 244330 XT-PIC ide1 0/44329
>
> The front panel USB port shares an interrupt with the sound card, the
> rear with eth0. Fome some of my testing it would be helpful if these
> just had numbers that I could mentally associate with a USB port. Right
> now I have to move the mouse and watch the interrupt count.
Here is a preliminary patch to add the bus number on to the end of the
driver name for the IRQ action registration. It's not complete (the
non-PCI host controller drivers will need to be changed) but it will give
you the idea. What do people think?
Alan Stern
===== drivers/usb/core/hcd-pci.c 1.61 vs edited =====
--- 1.61/drivers/usb/core/hcd-pci.c 2004-09-30 02:09:24 -04:00
+++ edited/drivers/usb/core/hcd-pci.c 2004-10-19 12:23:52 -04:00
@@ -148,7 +148,7 @@
pci_set_drvdata (dev, hcd);
hcd->driver = driver;
- hcd->description = driver->description;
+ hcd->driver_desc = driver->description;
hcd->self.bus_name = pci_name(dev);
#ifdef CONFIG_PCI_NAMES
hcd->product_desc = dev->pretty_name;
@@ -173,7 +173,20 @@
}
hcd->state = USB_STATE_HALT;
+ usb_bus_init (&hcd->self);
+ hcd->self.op = &usb_hcd_operations;
+ hcd->self.hcpriv = (void *) hcd;
+ hcd->self.release = &hcd_pci_release;
+ init_timer (&hcd->rh_timer);
+
+ INIT_LIST_HEAD (&hcd->dev_list);
+
+ if (usb_register_bus (&hcd->self))
+ goto clean_3;
+
pci_set_master (dev);
+ snprintf(hcd->description, sizeof(hcd->description),
+ "%s%d", driver->description, hcd->self.busnum);
#ifndef __sparc__
sprintf (buf, "%d", dev->irq);
#else
@@ -184,6 +197,7 @@
if (retval != 0) {
dev_err (hcd->self.controller,
"request interrupt %s failed\n", bufp);
+ usb_deregister_bus (&hcd->self);
goto clean_3;
}
hcd->irq = dev->irq;
@@ -191,16 +205,6 @@
dev_info (hcd->self.controller, "irq %s, %s 0x%lx\n", bufp,
(driver->flags & HCD_MEMORY) ? "pci mem" : "io base",
resource);
-
- usb_bus_init (&hcd->self);
- hcd->self.op = &usb_hcd_operations;
- hcd->self.hcpriv = (void *) hcd;
- hcd->self.release = &hcd_pci_release;
- init_timer (&hcd->rh_timer);
-
- INIT_LIST_HEAD (&hcd->dev_list);
-
- usb_register_bus (&hcd->self);
if ((retval = driver->start (hcd)) < 0) {
dev_err (hcd->self.controller, "init error %d\n", retval);
===== drivers/usb/core/hcd.c 1.160 vs edited =====
--- 1.160/drivers/usb/core/hcd.c 2004-10-11 13:51:58 -04:00
+++ edited/drivers/usb/core/hcd.c 2004-10-19 12:21:58 -04:00
@@ -312,7 +312,7 @@
// id 3 == vendor description
} else if (id == 3) {
sprintf (buf, "%s %s %s", UTS_SYSNAME, UTS_RELEASE,
- hcd->description);
+ hcd->driver_desc);
// unsupported IDs --> "protocol stall"
} else
===== drivers/usb/core/hcd.h 1.89 vs edited =====
--- 1.89/drivers/usb/core/hcd.h 2004-09-30 02:09:24 -04:00
+++ edited/drivers/usb/core/hcd.h 2004-10-19 12:21:25 -04:00
@@ -63,7 +63,8 @@
struct usb_bus self; /* hcd is-a bus */
const char *product_desc; /* product/vendor string */
- const char *description; /* "ehci-hcd" etc */
+ const char *driver_desc; /* "ehci-hcd" etc */
+ char description[16]; /* driver + bus # */
struct timer_list rh_timer; /* drives root hub */
struct list_head dev_list; /* devices on this bus */
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel