Commit 4daab117 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge kroah.com:/home/greg/linux/BK/bleeding_edge-2.5

into kroah.com:/home/greg/linux/BK/gregkh-2.5
parents 22e962f9 c031637c
14 April 2000
david-b@pacbell.net
This is an overview of how to use the "dc2xx" USB driver with certain
digital still cameras from Kodak and other vendors.
CAMERAS
This driver will mostly be used with Kodak DC-2xx series digital still
cameras, but it should be trivial to tell it about several non-Kodak
USB-enabled cameras.
You'll most likely want to hook it up to recent versions of "gPhoto"
(www.gphoto.org), since version 0.4 and later know how to use it to talk
to Kodak DC-240 and DC-280 cameras over USB.
In addition the DC-220, DC-260, DC-265, and DC-290 are also recognized.
However, like other cameras using the "Digita OS" (from www.flashpoint.com)
there is no gPhoto support for this camera. There is a python script
for accessing these cameras (see archives of the linux-usb mailing list)
and a "Digita Services" library that can also use this driver.
The HP PhotoSmart C500 should also work, since it's another Digita camera
with USB support.
USB HARDWARE
Recent kernels have had no particular problems using this driver with
either OHCI or UHCI chipsets, and have worked on the PowerMac platform.
Note that in some cases changes in BIOS settings may be needed before
your USB works. At least one user has reported a need for SMP-related
settings as well, and some old hardware may not handle USB correctly.
SETUP
Configure in the DC2XX USB driver, and have it in your kernel. It works
as a module, or compiled in directly.
Create at least one device, perhaps like this (both read and write):
# mknod -m 0660 /dev/usb/dc2xx0 c 180 80
# mknod -m 0660 /dev/usb/dc2xx1 c 180 81
...
NOTE: you would normally configure PAM so that the user logged in at
the console is granted ownership of these devices. console.perms(5)
explains how to do this.
The driver supports multiple device nodes. The USB framework supports
a maximum of sixteen device nodes (up to minor device number 96).
When you plug in one camera, it will use the first device node (dc2xx0
in the example above). A second camera will use the second device node,
and so on.
SANITY TESTING
First: if you've got /proc support, make sure that the driver has hooked
itself up correctly.
- You should see an entry in /proc/bus/usb/drivers for "dc2xx",
if you enabled USB /proc support and correctly mounted the
usbdevfs on /proc/bus/usb.
Second: when you connect your camera to the computer, does it get recognized
by the driver? (Make sure the camera is powered on!)
- if you've got /proc/bus/usb/devices, you should see an entry
something like this. The "ProdID" may be different if you didn't
plug in a DC-240, as may the strings presented, but "Driver=dc2xx"
had better be there.
T: Lev=01 Prnt=00 Port=00 Cnt=01 Dev#= 1 Spd=12 MxCh= 0
D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=040a ProdID=0120 Rev= 1.08
S: Manufacturer=Eastman Kodak Company
S: Product=KODAK DC240 Zoom Digital Camera
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=00(>ifc ) Sub=00 Prot=00 Driver=dc2xx
E: Ad=01(O) Atr=02(Bulk) MxPS= 64 Ivl= 0ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl= 0ms
- see if "dmesg" output tells you that you plugged in your camera.
Manufacturer: Eastman Kodak Company
Product: KODAK DC240 Zoom Digital Camera
dc2xx.c: USB Camera #0 connected
Third: (optional) can you use gPhoto to talk to the camera?
- When you configure your camera, tell it to use "/dev/usb/dc2xx0"
(or whatever name you used). Right now, gPhoto emits a diagnostic
message (non-GUI) saying that it since it didn't act like a TTY,
it's assuming it's got a USB connection.
- With the camera turned on, get the "camera summary". It'll
talk to the camera -- and tell you you're using USB.
If you got that far, you should be able to use everything fine.
ADDITIONAL INFORMATION
You may find that you need more driver-specific information, which is
currently accessible through a link from http://www.linux-usb.org/
along with other Linux USB resources.
...@@ -310,7 +310,7 @@ static int rh_string ( ...@@ -310,7 +310,7 @@ static int rh_string (
// serial number // serial number
} else if (id == 1) { } else if (id == 1) {
strcpy (buf, hcd->bus_name); strcpy (buf, hcd->self.bus_name);
// product description // product description
} else if (id == 2) { } else if (id == 2) {
...@@ -406,7 +406,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb) ...@@ -406,7 +406,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
case DeviceOutRequest | USB_REQ_SET_ADDRESS: case DeviceOutRequest | USB_REQ_SET_ADDRESS:
// wValue == urb->dev->devaddr // wValue == urb->dev->devaddr
dbg ("%s root hub device address %d", dbg ("%s root hub device address %d",
hcd->bus_name, wValue); hcd->self.bus_name, wValue);
break; break;
/* INTERFACE REQUESTS (no defined feature/status flags) */ /* INTERFACE REQUESTS (no defined feature/status flags) */
...@@ -520,7 +520,7 @@ static void rh_report_status (unsigned long ptr) ...@@ -520,7 +520,7 @@ static void rh_report_status (unsigned long ptr)
&& rh_status_urb (hcd, urb) != 0) { && rh_status_urb (hcd, urb) != 0) {
/* another driver snuck in? */ /* another driver snuck in? */
dbg ("%s, can't resubmit roothub status urb?", dbg ("%s, can't resubmit roothub status urb?",
hcd->bus_name); hcd->self.bus_name);
spin_unlock_irqrestore (&hcd_data_lock, flags); spin_unlock_irqrestore (&hcd_data_lock, flags);
BUG (); BUG ();
} }
...@@ -1051,8 +1051,7 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id) ...@@ -1051,8 +1051,7 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
usb_init_bus (&hcd->self); usb_init_bus (&hcd->self);
hcd->self.op = &hcd_operations; hcd->self.op = &hcd_operations;
hcd->self.hcpriv = (void *) hcd; hcd->self.hcpriv = (void *) hcd;
hcd->bus = &hcd->self; hcd->self.bus_name = dev->slot_name;
hcd->bus_name = dev->slot_name;
hcd->product_desc = dev->name; hcd->product_desc = dev->name;
INIT_LIST_HEAD (&hcd->dev_list); INIT_LIST_HEAD (&hcd->dev_list);
...@@ -1089,16 +1088,15 @@ void usb_hcd_pci_remove (struct pci_dev *dev) ...@@ -1089,16 +1088,15 @@ void usb_hcd_pci_remove (struct pci_dev *dev)
hcd = pci_get_drvdata(dev); hcd = pci_get_drvdata(dev);
if (!hcd) if (!hcd)
return; return;
info ("remove: %s, state %x", hcd->bus_name, hcd->state); info ("remove: %s, state %x", hcd->self.bus_name, hcd->state);
if (in_interrupt ()) BUG (); if (in_interrupt ()) BUG ();
hub = hcd->bus->root_hub; hub = hcd->self.root_hub;
hcd->state = USB_STATE_QUIESCING; hcd->state = USB_STATE_QUIESCING;
dbg ("%s: roothub graceful disconnect", hcd->bus_name); dbg ("%s: roothub graceful disconnect", hcd->self.bus_name);
usb_disconnect (&hub); usb_disconnect (&hub);
// usb_disconnect (&hcd->bus->root_hub);
hcd->driver->stop (hcd); hcd->driver->stop (hcd);
hcd->state = USB_STATE_HALT; hcd->state = USB_STATE_HALT;
...@@ -1113,10 +1111,9 @@ void usb_hcd_pci_remove (struct pci_dev *dev) ...@@ -1113,10 +1111,9 @@ void usb_hcd_pci_remove (struct pci_dev *dev)
pci_resource_len (dev, hcd->region)); pci_resource_len (dev, hcd->region));
} }
usb_deregister_bus (hcd->bus); usb_deregister_bus (&hcd->self);
if (atomic_read (&hcd->self.refcnt) != 1) if (atomic_read (&hcd->self.refcnt) != 1)
err ("usb_hcd_pci_remove %s, count != 1", hcd->bus_name); err ("usb_hcd_pci_remove %s, count != 1", hcd->self.bus_name);
hcd->bus = NULL;
hcd->driver->hcd_free (hcd); hcd->driver->hcd_free (hcd);
} }
...@@ -1164,7 +1161,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state) ...@@ -1164,7 +1161,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
int retval; int retval;
hcd = pci_get_drvdata(dev); hcd = pci_get_drvdata(dev);
info ("suspend %s to state %d", hcd->bus_name, state); info ("suspend %s to state %d", hcd->self.bus_name, state);
pci_save_state (dev, hcd->pci_state); pci_save_state (dev, hcd->pci_state);
...@@ -1193,12 +1190,12 @@ int usb_hcd_pci_resume (struct pci_dev *dev) ...@@ -1193,12 +1190,12 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
int retval; int retval;
hcd = pci_get_drvdata(dev); hcd = pci_get_drvdata(dev);
info ("resume %s", hcd->bus_name); info ("resume %s", hcd->self.bus_name);
/* guard against multiple resumes (APM bug?) */ /* guard against multiple resumes (APM bug?) */
atomic_inc (&hcd->resume_count); atomic_inc (&hcd->resume_count);
if (atomic_read (&hcd->resume_count) != 1) { if (atomic_read (&hcd->resume_count) != 1) {
err ("concurrent PCI resumes for %s", hcd->bus_name); err ("concurrent PCI resumes for %s", hcd->self.bus_name);
retval = 0; retval = 0;
goto done; goto done;
} }
...@@ -1215,7 +1212,7 @@ int usb_hcd_pci_resume (struct pci_dev *dev) ...@@ -1215,7 +1212,7 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
retval = hcd->driver->resume (hcd); retval = hcd->driver->resume (hcd);
if (!HCD_IS_RUNNING (hcd->state)) { if (!HCD_IS_RUNNING (hcd->state)) {
dbg ("resume %s failure, retval %d", hcd->bus_name, retval); dbg ("resume %s failure, retval %d", hcd->self.bus_name, retval);
hc_died (hcd); hc_died (hcd);
// FIXME: recover, reset etc. // FIXME: recover, reset etc.
} else { } else {
...@@ -1290,7 +1287,7 @@ static void hc_died (struct usb_hcd *hcd) ...@@ -1290,7 +1287,7 @@ static void hc_died (struct usb_hcd *hcd)
list_for_each (urblist, &dev->urb_list) { list_for_each (urblist, &dev->urb_list) {
urb = list_entry (urblist, struct urb, urb_list); urb = list_entry (urblist, struct urb, urb_list);
dbg ("shutdown %s urb %p pipe %x, current status %d", dbg ("shutdown %s urb %p pipe %x, current status %d",
hcd->bus_name, urb, urb->pipe, urb->status); hcd->self.bus_name, urb, urb->pipe, urb->status);
if (urb->status == -EINPROGRESS) if (urb->status == -EINPROGRESS)
urb->status = -ESHUTDOWN; urb->status = -ESHUTDOWN;
} }
...@@ -1534,7 +1531,7 @@ static int hcd_submit_urb (struct urb *urb, int mem_flags) ...@@ -1534,7 +1531,7 @@ static int hcd_submit_urb (struct urb *urb, int mem_flags)
* since we report some queuing/setup errors ourselves * since we report some queuing/setup errors ourselves
*/ */
urb = usb_get_urb (urb); urb = usb_get_urb (urb);
if (urb->dev == hcd->bus->root_hub) if (urb->dev == hcd->self.root_hub)
status = rh_urb_enqueue (hcd, urb); status = rh_urb_enqueue (hcd, urb);
else else
status = hcd->driver->urb_enqueue (hcd, urb, mem_flags); status = hcd->driver->urb_enqueue (hcd, urb, mem_flags);
...@@ -1686,7 +1683,7 @@ if (retval && urb->status == -ENOENT) err ("whoa! retval %d", retval); ...@@ -1686,7 +1683,7 @@ if (retval && urb->status == -ENOENT) err ("whoa! retval %d", retval);
&& HCD_IS_RUNNING (hcd->state) && HCD_IS_RUNNING (hcd->state)
&& !retval) { && !retval) {
dbg ("%s: wait for giveback urb %p", dbg ("%s: wait for giveback urb %p",
hcd->bus_name, urb); hcd->self.bus_name, urb);
wait_for_completion (&splice.done); wait_for_completion (&splice.done);
} else if ((urb->transfer_flags & USB_ASYNC_UNLINK) && retval == 0) { } else if ((urb->transfer_flags & USB_ASYNC_UNLINK) && retval == 0) {
return -EINPROGRESS; return -EINPROGRESS;
...@@ -1698,7 +1695,7 @@ if (retval && urb->status == -ENOENT) err ("whoa! retval %d", retval); ...@@ -1698,7 +1695,7 @@ if (retval && urb->status == -ENOENT) err ("whoa! retval %d", retval);
bye: bye:
if (retval) if (retval)
dbg ("%s: hcd_unlink_urb fail %d", dbg ("%s: hcd_unlink_urb fail %d",
hcd ? hcd->bus_name : "(no bus?)", hcd ? hcd->self.bus_name : "(no bus?)",
retval); retval);
return retval; return retval;
} }
...@@ -1731,7 +1728,7 @@ static int hcd_free_dev (struct usb_device *udev) ...@@ -1731,7 +1728,7 @@ static int hcd_free_dev (struct usb_device *udev)
/* device driver problem with refcounts? */ /* device driver problem with refcounts? */
if (!list_empty (&dev->urb_list)) { if (!list_empty (&dev->urb_list)) {
dbg ("free busy dev, %s devnum %d (bug!)", dbg ("free busy dev, %s devnum %d (bug!)",
hcd->bus_name, udev->devnum); hcd->self.bus_name, udev->devnum);
return -EINVAL; return -EINVAL;
} }
......
...@@ -35,10 +35,8 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */ ...@@ -35,10 +35,8 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */
/* /*
* housekeeping * housekeeping
*/ */
struct usb_bus *bus; /* FIXME only use "self" */
struct usb_bus self; /* hcd is-a bus */ struct usb_bus self; /* hcd is-a bus */
const char *bus_name;
const char *product_desc; /* product/vendor string */ const char *product_desc; /* product/vendor string */
const char *description; /* "ehci-hcd" etc */ const char *description; /* "ehci-hcd" etc */
......
...@@ -765,23 +765,23 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port, ...@@ -765,23 +765,23 @@ static void usb_hub_port_connect_change(struct usb_hub *hubstate, int port,
* devices by location for diagnostics, tools, etc. The * devices by location for diagnostics, tools, etc. The
* string is a path along hub ports, from the root. Each * string is a path along hub ports, from the root. Each
* device's id will be stable until USB is re-cabled, and * device's id will be stable until USB is re-cabled, and
* hubs are often labled with these port numbers. * hubs are often labeled with these port numbers.
* *
* Initial size: "/NN" times five hubs + NUL = 16 bytes max * Initial size: ".NN" times five hubs + NUL = 16 bytes max
* (quite rare, since most hubs have 4-6 ports). * (quite rare, since most hubs have 4-6 ports).
*/ */
pdev = dev->parent; pdev = dev->parent;
if (pdev->devpath [1] != '\0') /* parent not root */ if (pdev->devpath [0] != '/') /* parent not root */
len = snprintf (dev->devpath, sizeof dev->devpath, len = snprintf (dev->devpath, sizeof dev->devpath,
"%s/%d", pdev->devpath, port + 1); "%s.%d", pdev->devpath, port + 1);
else /* root == "/", root port 2 == "/2" */ else /* root == "/", root port 2 == "2", port 3 that hub "/2.3" */
len = snprintf (dev->devpath, sizeof dev->devpath, len = snprintf (dev->devpath, sizeof dev->devpath,
"/%d", port + 1); "%d", port + 1);
if (len == sizeof dev->devpath) if (len == sizeof dev->devpath)
warn ("devpath size! usb/%03d/%03d path %s", warn ("devpath size! usb/%03d/%03d path %s",
dev->bus->busnum, dev->devnum, dev->devpath); dev->bus->busnum, dev->devnum, dev->devpath);
info("new USB device on bus %d path %s, assigned address %d", info("new USB device %s-%s, assigned address %d",
dev->bus->busnum, dev->devpath, dev->devnum); dev->bus->bus_name, dev->devpath, dev->devnum);
/* put the device in the global device tree */ /* put the device in the global device tree */
dev->dev.parent = &dev->parent->dev; dev->dev.parent = &dev->parent->dev;
......
...@@ -2407,56 +2407,6 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) ...@@ -2407,56 +2407,6 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
return err; return err;
} }
/**
* usb_make_path - returns device path in the hub tree
* @dev: the device whose path is being constructed
* @buf: where to put the string
* @size: how big is "buf"?
* Context: !in_interrupt ()
*
* Returns length of the string (>= 0) or out of memory status (< 0).
*
* NOTE: prefer to use use dev->devpath directly.
*/
int usb_make_path(struct usb_device *dev, char *buf, size_t size)
{
struct usb_device *pdev = dev->parent;
char *tmp;
char *port;
int i;
if (!(port = kmalloc(size, GFP_KERNEL)))
return -ENOMEM;
if (!(tmp = kmalloc(size, GFP_KERNEL))) {
kfree(port);
return -ENOMEM;
}
*port = 0;
while (pdev) {
for (i = 0; i < pdev->maxchild; i++)
if (pdev->children[i] == dev)
break;
if (pdev->children[i] != dev) {
kfree(port);
kfree(tmp);
return -ENODEV;
}
strcpy(tmp, port);
snprintf(port, size, strlen(port) ? "%d.%s" : "%d", i + 1, tmp);
dev = pdev;
pdev = dev->parent;
}
snprintf(buf, size, "usb%d:%s", dev->bus->busnum, port);
kfree(port);
kfree(tmp);
return strlen(buf);
}
/* /*
* By the time we get here, the device has gotten a new device ID * By the time we get here, the device has gotten a new device ID
* 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
......
...@@ -55,7 +55,7 @@ static void dbg_hcs_params (struct ehci_hcd *ehci, char *label) ...@@ -55,7 +55,7 @@ static void dbg_hcs_params (struct ehci_hcd *ehci, char *label)
strcat(buf, tmp); strcat(buf, tmp);
} }
dbg ("%s: %s portroute %s", dbg ("%s: %s portroute %s",
ehci->hcd.bus_name, label, ehci->hcd.self.bus_name, label,
buf); buf);
} }
} }
......
...@@ -248,7 +248,7 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -248,7 +248,7 @@ static int ehci_start (struct usb_hcd *hcd)
ehci->tasklet.data = (unsigned long) ehci; ehci->tasklet.data = (unsigned long) ehci;
/* wire up the root hub */ /* wire up the root hub */
hcd->bus->root_hub = udev = usb_alloc_dev (NULL, hcd->bus); hcd->self.root_hub = udev = usb_alloc_dev (NULL, &hcd->self);
if (!udev) { if (!udev) {
done2: done2:
ehci_mem_cleanup (ehci); ehci_mem_cleanup (ehci);
...@@ -288,8 +288,7 @@ static int ehci_start (struct usb_hcd *hcd) ...@@ -288,8 +288,7 @@ static int ehci_start (struct usb_hcd *hcd)
while (readl (&ehci->regs->status) & (STS_ASS | STS_PSS)) while (readl (&ehci->regs->status) & (STS_ASS | STS_PSS))
udelay (100); udelay (100);
ehci_reset (ehci); ehci_reset (ehci);
// usb_disconnect (udev); hcd->self.root_hub = 0;
hcd->bus->root_hub = 0;
usb_free_dev (udev); usb_free_dev (udev);
retval = -ENODEV; retval = -ENODEV;
goto done2; goto done2;
...@@ -304,7 +303,7 @@ static void ehci_stop (struct usb_hcd *hcd) ...@@ -304,7 +303,7 @@ static void ehci_stop (struct usb_hcd *hcd)
{ {
struct ehci_hcd *ehci = hcd_to_ehci (hcd); struct ehci_hcd *ehci = hcd_to_ehci (hcd);
dbg ("%s: stop", hcd->bus_name); dbg ("%s: stop", hcd->self.bus_name);
if (hcd->state == USB_STATE_RUNNING) if (hcd->state == USB_STATE_RUNNING)
ehci_ready (ehci); ehci_ready (ehci);
...@@ -339,7 +338,7 @@ static int ehci_suspend (struct usb_hcd *hcd, u32 state) ...@@ -339,7 +338,7 @@ static int ehci_suspend (struct usb_hcd *hcd, u32 state)
int ports; int ports;
int i; int i;
dbg ("%s: suspend to %d", hcd->bus_name, state); dbg ("%s: suspend to %d", hcd->self.bus_name, state);
ports = HCS_N_PORTS (ehci->hcs_params); ports = HCS_N_PORTS (ehci->hcs_params);
...@@ -356,7 +355,7 @@ static int ehci_suspend (struct usb_hcd *hcd, u32 state) ...@@ -356,7 +355,7 @@ static int ehci_suspend (struct usb_hcd *hcd, u32 state)
if ((temp & PORT_PE) == 0 if ((temp & PORT_PE) == 0
|| (temp & PORT_OWNER) != 0) || (temp & PORT_OWNER) != 0)
continue; continue;
dbg ("%s: suspend port %d", hcd->bus_name, i); dbg ("%s: suspend port %d", hcd->self.bus_name, i);
temp |= PORT_SUSPEND; temp |= PORT_SUSPEND;
writel (temp, &ehci->regs->port_status [i]); writel (temp, &ehci->regs->port_status [i]);
} }
...@@ -380,7 +379,7 @@ static int ehci_resume (struct usb_hcd *hcd) ...@@ -380,7 +379,7 @@ static int ehci_resume (struct usb_hcd *hcd)
int ports; int ports;
int i; int i;
dbg ("%s: resume", hcd->bus_name); dbg ("%s: resume", hcd->self.bus_name);
ports = HCS_N_PORTS (ehci->hcs_params); ports = HCS_N_PORTS (ehci->hcs_params);
...@@ -400,7 +399,7 @@ static int ehci_resume (struct usb_hcd *hcd) ...@@ -400,7 +399,7 @@ static int ehci_resume (struct usb_hcd *hcd)
if ((temp & PORT_PE) == 0 if ((temp & PORT_PE) == 0
|| (temp & PORT_SUSPEND) != 0) || (temp & PORT_SUSPEND) != 0)
continue; continue;
dbg ("%s: resume port %d", hcd->bus_name, i); dbg ("%s: resume port %d", hcd->self.bus_name, i);
temp |= PORT_RESUME; temp |= PORT_RESUME;
writel (temp, &ehci->regs->port_status [i]); writel (temp, &ehci->regs->port_status [i]);
readl (&ehci->regs->command); /* unblock posted writes */ readl (&ehci->regs->command); /* unblock posted writes */
...@@ -472,7 +471,7 @@ static void ehci_irq (struct usb_hcd *hcd) ...@@ -472,7 +471,7 @@ static void ehci_irq (struct usb_hcd *hcd)
/* PCI errors [4.15.2.4] */ /* PCI errors [4.15.2.4] */
if (unlikely ((status & STS_FATAL) != 0)) { if (unlikely ((status & STS_FATAL) != 0)) {
err ("%s: fatal error, state %x", hcd->bus_name, hcd->state); err ("%s: fatal error, state %x", hcd->self.bus_name, hcd->state);
ehci_reset (ehci); ehci_reset (ehci);
// generic layer kills/unlinks all urbs // generic layer kills/unlinks all urbs
// then tasklet cleans up the rest // then tasklet cleans up the rest
...@@ -547,7 +546,7 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb) ...@@ -547,7 +546,7 @@ static int ehci_urb_dequeue (struct usb_hcd *hcd, struct urb *urb)
unsigned long flags; unsigned long flags;
dbg ("%s urb_dequeue %p qh state %d", dbg ("%s urb_dequeue %p qh state %d",
hcd->bus_name, urb, qh->qh_state); hcd->self.bus_name, urb, qh->qh_state);
switch (usb_pipetype (urb->pipe)) { switch (usb_pipetype (urb->pipe)) {
case PIPE_CONTROL: case PIPE_CONTROL:
...@@ -608,7 +607,7 @@ static void ehci_free_config (struct usb_hcd *hcd, struct usb_device *udev) ...@@ -608,7 +607,7 @@ static void ehci_free_config (struct usb_hcd *hcd, struct usb_device *udev)
/* ASSERT: nobody can be submitting urbs for this any more */ /* ASSERT: nobody can be submitting urbs for this any more */
dbg ("%s: free_config devnum %d", hcd->bus_name, udev->devnum); dbg ("%s: free_config devnum %d", hcd->self.bus_name, udev->devnum);
spin_lock_irqsave (&ehci->lock, flags); spin_lock_irqsave (&ehci->lock, flags);
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
......
...@@ -41,14 +41,14 @@ static int check_reset_complete ( ...@@ -41,14 +41,14 @@ static int check_reset_complete (
/* if reset finished and it's still not enabled -- handoff */ /* if reset finished and it's still not enabled -- handoff */
if (!(port_status & PORT_PE)) { if (!(port_status & PORT_PE)) {
dbg ("%s port %d full speed, give to companion, 0x%x", dbg ("%s port %d full speed, give to companion, 0x%x",
ehci->hcd.bus_name, index + 1, port_status); ehci->hcd.self.bus_name, index + 1, port_status);
// what happens if HCS_N_CC(params) == 0 ? // what happens if HCS_N_CC(params) == 0 ?
port_status |= PORT_OWNER; port_status |= PORT_OWNER;
writel (port_status, &ehci->regs->port_status [index]); writel (port_status, &ehci->regs->port_status [index]);
} else } else
dbg ("%s port %d high speed", ehci->hcd.bus_name, index + 1); dbg ("%s port %d high speed", ehci->hcd.self.bus_name, index + 1);
return port_status; return port_status;
} }
...@@ -306,11 +306,11 @@ static int ehci_hub_control ( ...@@ -306,11 +306,11 @@ static int ehci_hub_control (
if ((temp & (PORT_PE|PORT_CONNECT)) == PORT_CONNECT if ((temp & (PORT_PE|PORT_CONNECT)) == PORT_CONNECT
&& PORT_USB11 (temp)) { && PORT_USB11 (temp)) {
dbg ("%s port %d low speed, give to companion", dbg ("%s port %d low speed, give to companion",
hcd->bus_name, wIndex + 1); hcd->self.bus_name, wIndex + 1);
temp |= PORT_OWNER; temp |= PORT_OWNER;
} else { } else {
vdbg ("%s port %d reset", vdbg ("%s port %d reset",
hcd->bus_name, wIndex + 1); hcd->self.bus_name, wIndex + 1);
temp |= PORT_RESET; temp |= PORT_RESET;
temp &= ~PORT_PE; temp &= ~PORT_PE;
......
...@@ -733,7 +733,7 @@ submit_async ( ...@@ -733,7 +733,7 @@ submit_async (
epnum |= 0x10; epnum |= 0x10;
vdbg ("%s: submit_async urb %p len %d ep %d-%s qtd %p [qh %p]", vdbg ("%s: submit_async urb %p len %d ep %d-%s qtd %p [qh %p]",
ehci->hcd.bus_name, urb, urb->transfer_buffer_length, ehci->hcd.self.bus_name, urb, urb->transfer_buffer_length,
epnum & 0x0f, (epnum & 0x10) ? "in" : "out", epnum & 0x0f, (epnum & 0x10) ? "in" : "out",
qtd, dev ? dev->ep [epnum] : (void *)~0); qtd, dev ? dev->ep [epnum] : (void *)~0);
......
...@@ -89,7 +89,7 @@ void ohci_dump_periodic (struct ohci_hcd *ohci, char *label) ...@@ -89,7 +89,7 @@ void ohci_dump_periodic (struct ohci_hcd *ohci, char *label)
continue; continue;
printed = 1; printed = 1;
printk (KERN_DEBUG "%s, ohci %s frame %2d:", printk (KERN_DEBUG "%s, ohci %s frame %2d:",
label, ohci->hcd.bus_name, i); label, ohci->hcd.self.bus_name, i);
while (*ed_p != 0 && j--) { while (*ed_p != 0 && j--) {
struct ed *ed = dma_to_ed (ohci, le32_to_cpup(ed_p)); struct ed *ed = dma_to_ed (ohci, le32_to_cpup(ed_p));
printk (" %p/%08x;", ed, ed->hwINFO); printk (" %p/%08x;", ed, ed->hwINFO);
...@@ -99,7 +99,7 @@ void ohci_dump_periodic (struct ohci_hcd *ohci, char *label) ...@@ -99,7 +99,7 @@ void ohci_dump_periodic (struct ohci_hcd *ohci, char *label)
} }
if (!printed) if (!printed)
printk (KERN_DEBUG "%s, ohci %s, empty periodic schedule\n", printk (KERN_DEBUG "%s, ohci %s, empty periodic schedule\n",
label, ohci->hcd.bus_name); label, ohci->hcd.self.bus_name);
} }
#endif #endif
...@@ -229,7 +229,7 @@ static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose) ...@@ -229,7 +229,7 @@ static void ohci_dump_roothub (struct ohci_hcd *controller, int verbose)
static void ohci_dump (struct ohci_hcd *controller, int verbose) static void ohci_dump (struct ohci_hcd *controller, int verbose)
{ {
dbg ("OHCI controller %s state", controller->hcd.bus_name); dbg ("OHCI controller %s state", controller->hcd.self.bus_name);
// dumps some of the state we know about // dumps some of the state we know about
ohci_dump_status (controller); ohci_dump_status (controller);
......
...@@ -379,7 +379,7 @@ static int hc_reset (struct ohci_hcd *ohci) ...@@ -379,7 +379,7 @@ static int hc_reset (struct ohci_hcd *ohci)
writel (OHCI_INTR_MIE, &ohci->regs->intrdisable); writel (OHCI_INTR_MIE, &ohci->regs->intrdisable);
dbg ("USB HC reset_hc %s: ctrl = 0x%x ;", dbg ("USB HC reset_hc %s: ctrl = 0x%x ;",
ohci->hcd.bus_name, ohci->hcd.self.bus_name,
readl (&ohci->regs->control)); readl (&ohci->regs->control));
/* Reset USB (needed by some controllers) */ /* Reset USB (needed by some controllers) */
...@@ -449,7 +449,7 @@ static int hc_start (struct ohci_hcd *ohci) ...@@ -449,7 +449,7 @@ static int hc_start (struct ohci_hcd *ohci)
mdelay ((roothub_a (ohci) >> 23) & 0x1fe); mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
/* connect the virtual root hub */ /* connect the virtual root hub */
ohci->hcd.bus->root_hub = udev = usb_alloc_dev (NULL, ohci->hcd.bus); ohci->hcd.self.root_hub = udev = usb_alloc_dev (NULL, &ohci->hcd.self);
ohci->hcd.state = USB_STATE_READY; ohci->hcd.state = USB_STATE_READY;
if (!udev) { if (!udev) {
ohci->disabled = 1; ohci->disabled = 1;
...@@ -491,7 +491,7 @@ static void ohci_irq (struct usb_hcd *hcd) ...@@ -491,7 +491,7 @@ static void ohci_irq (struct usb_hcd *hcd)
if (ints & OHCI_INTR_UE) { if (ints & OHCI_INTR_UE) {
ohci->disabled++; ohci->disabled++;
err ("OHCI Unrecoverable Error, %s disabled", hcd->bus_name); err ("OHCI Unrecoverable Error, %s disabled", hcd->self.bus_name);
// e.g. due to PCI Master/Target Abort // e.g. due to PCI Master/Target Abort
#ifdef DEBUG #ifdef DEBUG
...@@ -530,7 +530,7 @@ static void ohci_stop (struct usb_hcd *hcd) ...@@ -530,7 +530,7 @@ static void ohci_stop (struct usb_hcd *hcd)
struct ohci_hcd *ohci = hcd_to_ohci (hcd); struct ohci_hcd *ohci = hcd_to_ohci (hcd);
dbg ("%s: stop %s controller%s", dbg ("%s: stop %s controller%s",
hcd->bus_name, hcd->self.bus_name,
hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS), hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS),
ohci->disabled ? " (disabled)" : "" ohci->disabled ? " (disabled)" : ""
); );
...@@ -571,7 +571,7 @@ ohci_start (struct usb_hcd *hcd) ...@@ -571,7 +571,7 @@ ohci_start (struct usb_hcd *hcd)
&& hcd->pdev->device == 0x740c) { && hcd->pdev->device == 0x740c) {
ohci->flags = OHCI_QUIRK_AMD756; ohci->flags = OHCI_QUIRK_AMD756;
info ("%s: AMD756 erratum 4 workaround", info ("%s: AMD756 erratum 4 workaround",
hcd->bus_name); hcd->self.bus_name);
} }
/* Apple's OHCI driver has a lot of bizarre workarounds /* Apple's OHCI driver has a lot of bizarre workarounds
...@@ -581,7 +581,7 @@ ohci_start (struct usb_hcd *hcd) ...@@ -581,7 +581,7 @@ ohci_start (struct usb_hcd *hcd)
else if (hcd->pdev->vendor == 0x1045 else if (hcd->pdev->vendor == 0x1045
&& hcd->pdev->device == 0xc861) { && hcd->pdev->device == 0xc861) {
info ("%s: WARNING: OPTi workarounds unavailable", info ("%s: WARNING: OPTi workarounds unavailable",
hcd->bus_name); hcd->self.bus_name);
} }
} }
#else #else
...@@ -601,7 +601,7 @@ ohci_start (struct usb_hcd *hcd) ...@@ -601,7 +601,7 @@ ohci_start (struct usb_hcd *hcd)
} }
if (hc_start (ohci) < 0) { if (hc_start (ohci) < 0) {
err ("can't start %s", ohci->hcd.bus_name); err ("can't start %s", ohci->hcd.self.bus_name);
ohci_stop (hcd); ohci_stop (hcd);
return -EBUSY; return -EBUSY;
} }
...@@ -623,13 +623,13 @@ static int ohci_suspend (struct usb_hcd *hcd, u32 state) ...@@ -623,13 +623,13 @@ static int ohci_suspend (struct usb_hcd *hcd, u32 state)
u16 cmd; u16 cmd;
if ((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER) { if ((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER) {
dbg ("can't suspend %s (state is %s)", hcd->bus_name, dbg ("can't suspend %s (state is %s)", hcd->self.bus_name,
hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS)); hcfs2string (ohci->hc_control & OHCI_CTRL_HCFS));
return -EIO; return -EIO;
} }
/* act as if usb suspend can always be used */ /* act as if usb suspend can always be used */
dbg ("%s: suspend to %d", hcd->bus_name, state); dbg ("%s: suspend to %d", hcd->self.bus_name, state);
ohci->sleeping = 1; ohci->sleeping = 1;
/* First stop processing */ /* First stop processing */
...@@ -664,16 +664,16 @@ static int ohci_suspend (struct usb_hcd *hcd, u32 state) ...@@ -664,16 +664,16 @@ static int ohci_suspend (struct usb_hcd *hcd, u32 state)
switch (readl (&ohci->regs->control) & OHCI_CTRL_HCFS) { switch (readl (&ohci->regs->control) & OHCI_CTRL_HCFS) {
case OHCI_USB_RESET: case OHCI_USB_RESET:
dbg ("%s suspend->reset ?", hcd->bus_name); dbg ("%s suspend->reset ?", hcd->self.bus_name);
break; break;
case OHCI_USB_RESUME: case OHCI_USB_RESUME:
dbg ("%s suspend->resume ?", hcd->bus_name); dbg ("%s suspend->resume ?", hcd->self.bus_name);
break; break;
case OHCI_USB_OPER: case OHCI_USB_OPER:
dbg ("%s suspend->operational ?", hcd->bus_name); dbg ("%s suspend->operational ?", hcd->self.bus_name);
break; break;
case OHCI_USB_SUSPEND: case OHCI_USB_SUSPEND:
dbg ("%s suspended", hcd->bus_name); dbg ("%s suspended", hcd->self.bus_name);
break; break;
} }
...@@ -711,8 +711,8 @@ static int hc_restart (struct ohci_hcd *ohci) ...@@ -711,8 +711,8 @@ static int hc_restart (struct ohci_hcd *ohci)
ohci->disabled = 1; ohci->disabled = 1;
ohci->sleeping = 0; ohci->sleeping = 0;
if (ohci->hcd.bus->root_hub) if (ohci->hcd.self.root_hub)
usb_disconnect (&ohci->hcd.bus->root_hub); usb_disconnect (&ohci->hcd.self.root_hub);
/* empty the interrupt branches */ /* empty the interrupt branches */
for (i = 0; i < NUM_INTS; i++) ohci->ohci_int_load [i] = 0; for (i = 0; i < NUM_INTS; i++) ohci->ohci_int_load [i] = 0;
...@@ -728,10 +728,10 @@ static int hc_restart (struct ohci_hcd *ohci) ...@@ -728,10 +728,10 @@ static int hc_restart (struct ohci_hcd *ohci)
ohci->ed_bulktail = NULL; ohci->ed_bulktail = NULL;
if ((temp = hc_reset (ohci)) < 0 || (temp = hc_start (ohci)) < 0) { if ((temp = hc_reset (ohci)) < 0 || (temp = hc_start (ohci)) < 0) {
err ("can't restart %s, %d", ohci->hcd.bus_name, temp); err ("can't restart %s, %d", ohci->hcd.self.bus_name, temp);
return temp; return temp;
} else } else
dbg ("restart %s completed", ohci->hcd.bus_name); dbg ("restart %s completed", ohci->hcd.self.bus_name);
return 0; return 0;
} }
...@@ -767,13 +767,13 @@ static int ohci_resume (struct usb_hcd *hcd) ...@@ -767,13 +767,13 @@ static int ohci_resume (struct usb_hcd *hcd)
switch (temp) { switch (temp) {
case OHCI_USB_RESET: // lost power case OHCI_USB_RESET: // lost power
info ("USB restart: %s", hcd->bus_name); info ("USB restart: %s", hcd->self.bus_name);
retval = hc_restart (ohci); retval = hc_restart (ohci);
break; break;
case OHCI_USB_SUSPEND: // host wakeup case OHCI_USB_SUSPEND: // host wakeup
case OHCI_USB_RESUME: // remote wakeup case OHCI_USB_RESUME: // remote wakeup
info ("USB continue: %s from %s wakeup", hcd->bus_name, info ("USB continue: %s from %s wakeup", hcd->self.bus_name,
(temp == OHCI_USB_SUSPEND) (temp == OHCI_USB_SUSPEND)
? "host" : "remote"); ? "host" : "remote");
ohci->hc_control = OHCI_USB_RESUME; ohci->hc_control = OHCI_USB_RESUME;
...@@ -786,7 +786,7 @@ static int ohci_resume (struct usb_hcd *hcd) ...@@ -786,7 +786,7 @@ static int ohci_resume (struct usb_hcd *hcd)
temp = readl (&ohci->regs->control); temp = readl (&ohci->regs->control);
temp = ohci->hc_control & OHCI_CTRL_HCFS; temp = ohci->hc_control & OHCI_CTRL_HCFS;
if (temp != OHCI_USB_RESUME) { if (temp != OHCI_USB_RESUME) {
err ("controller %s won't resume", hcd->bus_name); err ("controller %s won't resume", hcd->self.bus_name);
ohci->disabled = 1; ohci->disabled = 1;
retval = -EIO; retval = -EIO;
break; break;
...@@ -836,7 +836,7 @@ dbg ("sleeping = %d, disabled = %d", ohci->sleeping, ohci->disabled); ...@@ -836,7 +836,7 @@ dbg ("sleeping = %d, disabled = %d", ohci->sleeping, ohci->disabled);
break; break;
default: default:
warn ("odd PCI resume for %s", hcd->bus_name); warn ("odd PCI resume for %s", hcd->self.bus_name);
} }
return retval; return retval;
} }
......
...@@ -41,7 +41,7 @@ static u32 roothub_portstatus (struct ohci_hcd *hc, int i) ...@@ -41,7 +41,7 @@ static u32 roothub_portstatus (struct ohci_hcd *hc, int i)
#define dbg_port(hc,label,num,value) \ #define dbg_port(hc,label,num,value) \
dbg ("%s: %s roothub.portstatus [%d] " \ dbg ("%s: %s roothub.portstatus [%d] " \
"= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s", \ "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s", \
hc->hcd.bus_name, label, num, temp, \ hc->hcd.self.bus_name, label, num, temp, \
(temp & RH_PS_PRSC) ? " PRSC" : "", \ (temp & RH_PS_PRSC) ? " PRSC" : "", \
(temp & RH_PS_OCIC) ? " OCIC" : "", \ (temp & RH_PS_OCIC) ? " OCIC" : "", \
(temp & RH_PS_PSSC) ? " PSSC" : "", \ (temp & RH_PS_PSSC) ? " PSSC" : "", \
...@@ -71,7 +71,7 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf) ...@@ -71,7 +71,7 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
ports = roothub_a (ohci) & RH_A_NDP; ports = roothub_a (ohci) & RH_A_NDP;
if (ports > MAX_ROOT_PORTS) { if (ports > MAX_ROOT_PORTS) {
err ("%s: bogus NDP=%d", hcd->bus_name, ports); err ("%s: bogus NDP=%d", hcd->self.bus_name, ports);
err ("rereads as NDP=%d", err ("rereads as NDP=%d",
readl (&ohci->regs->roothub.a) & RH_A_NDP); readl (&ohci->regs->roothub.a) & RH_A_NDP);
/* retry later; "should not happen" */ /* retry later; "should not happen" */
......
...@@ -2799,6 +2799,7 @@ static int alloc_uhci(struct pci_dev *dev, unsigned int io_addr, unsigned int io ...@@ -2799,6 +2799,7 @@ static int alloc_uhci(struct pci_dev *dev, unsigned int io_addr, unsigned int io
uhci->bus = bus; uhci->bus = bus;
bus->hcpriv = uhci; bus->hcpriv = uhci;
bus->bus_name = dev->slot_name;
usb_register_bus(uhci->bus); usb_register_bus(uhci->bus);
......
...@@ -2400,6 +2400,7 @@ static ohci_t * __devinit hc_alloc_ohci (struct pci_dev *dev, void * mem_base) ...@@ -2400,6 +2400,7 @@ static ohci_t * __devinit hc_alloc_ohci (struct pci_dev *dev, void * mem_base)
return NULL; return NULL;
} }
ohci->bus->hcpriv = (void *) ohci; ohci->bus->hcpriv = (void *) ohci;
ohci->bus->bus_name = dev->slot_name;
return ohci; return ohci;
} }
......
...@@ -2977,6 +2977,7 @@ _static int __devinit alloc_uhci (struct pci_dev *dev, int irq, unsigned int io_ ...@@ -2977,6 +2977,7 @@ _static int __devinit alloc_uhci (struct pci_dev *dev, int irq, unsigned int io_
s->bus = bus; s->bus = bus;
bus->hcpriv = s; bus->hcpriv = s;
bus->bus_name = dev->slot_name;
/* UHCI specs says devices must have 2 ports, but goes on to say */ /* UHCI specs says devices must have 2 ports, but goes on to say */
/* they may have more but give no way to determine how many they */ /* they may have more but give no way to determine how many they */
......
CONFIG_USB_DC2XX
Say Y here if you want to connect this type of still camera to your
computer's USB port. See <file:Documentation/usb/dc2xx.txt> for
more information; some non-Kodak cameras may also work with this
driver, given application support (such as <http://www.gphoto.org/>).
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called dc2xx.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
CONFIG_USB_MDC800 CONFIG_USB_MDC800
Say Y here if you want to connect this type of still camera to Say Y here if you want to connect this type of still camera to
your computer's USB port. This driver can be used with gphoto 0.4.3 your computer's USB port. This driver can be used with gphoto 0.4.3
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# USB Imageing devices configuration # USB Imageing devices configuration
# #
comment 'USB Imaging devices' comment 'USB Imaging devices'
dep_tristate ' USB Kodak DC-2xx Camera support' CONFIG_USB_DC2XX $CONFIG_USB
dep_tristate ' USB Mustek MDC800 Digital Camera support (EXPERIMENTAL)' CONFIG_USB_MDC800 $CONFIG_USB $CONFIG_EXPERIMENTAL dep_tristate ' USB Mustek MDC800 Digital Camera support (EXPERIMENTAL)' CONFIG_USB_MDC800 $CONFIG_USB $CONFIG_EXPERIMENTAL
dep_tristate ' USB Scanner support' CONFIG_USB_SCANNER $CONFIG_USB dep_tristate ' USB Scanner support' CONFIG_USB_SCANNER $CONFIG_USB
dep_tristate ' Microtek X6USB scanner support' CONFIG_USB_MICROTEK $CONFIG_USB $CONFIG_SCSI dep_tristate ' Microtek X6USB scanner support' CONFIG_USB_MICROTEK $CONFIG_USB $CONFIG_SCSI
...@@ -10,10 +9,10 @@ dep_tristate ' HP53xx USB scanner support (EXPERIMENTAL)' CONFIG_USB_HPUSBSCSI ...@@ -10,10 +9,10 @@ dep_tristate ' HP53xx USB scanner support (EXPERIMENTAL)' CONFIG_USB_HPUSBSCSI
# Turn on CONFIG_USB_IMAGE if any of the drivers are compiled into the kernel to # Turn on CONFIG_USB_IMAGE if any of the drivers are compiled into the kernel to
# make our Makefile logic a bit simpler # make our Makefile logic a bit simpler
if [ "$CONFIG_USB_DC2XX" = "y" -o "$CONFIG_USB_MDC800" = "y" ]; then if [ "$CONFIG_USB_MDC800" = "y" -o "$CONFIG_USB_SCANNER" = "y" ]; then
define_bool CONFIG_USB_IMAGE y define_bool CONFIG_USB_IMAGE y
fi fi
if [ "$CONFIG_USB_SCANNER" = "y" -o "$CONFIG_USB_MICROTEK" = "y" -o "$CONFIG_USB_HPUSBSCSI" = "y" ]; then if [ "$CONFIG_USB_MICROTEK" = "y" -o "$CONFIG_USB_HPUSBSCSI" = "y" ]; then
define_bool CONFIG_USB_IMAGE y define_bool CONFIG_USB_IMAGE y
fi fi
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
O_TARGET := usb-image.o O_TARGET := usb-image.o
obj-$(CONFIG_USB_DC2XX) += dc2xx.o
obj-$(CONFIG_USB_MDC800) += mdc800.o obj-$(CONFIG_USB_MDC800) += mdc800.o
obj-$(CONFIG_USB_HPUSBSCSI) += hpusbscsi.o obj-$(CONFIG_USB_HPUSBSCSI) += hpusbscsi.o
obj-$(CONFIG_USB_MICROTEK) += microtek.o obj-$(CONFIG_USB_MICROTEK) += microtek.o
......
This diff is collapsed.
...@@ -655,7 +655,6 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -655,7 +655,6 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
{ {
struct catc *catc = dev->priv; struct catc *catc = dev->priv;
u32 cmd; u32 cmd;
char tmp[40];
if (get_user(cmd, (u32 *)useraddr)) if (get_user(cmd, (u32 *)useraddr))
return -EFAULT; return -EFAULT;
...@@ -666,8 +665,7 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -666,8 +665,7 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO}; struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strncpy(info.driver, SHORT_DRIVER_DESC, ETHTOOL_BUSINFO_LEN); strncpy(info.driver, SHORT_DRIVER_DESC, ETHTOOL_BUSINFO_LEN);
strncpy(info.version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN); strncpy(info.version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN);
sprintf(tmp, "usb%d:%d", catc->usbdev->bus->busnum, catc->usbdev->devnum); usb_make_path (catc->usbdev, info.bus_info, sizeof info.bus_info);
strncpy(info.bus_info, tmp,ETHTOOL_BUSINFO_LEN);
if (copy_to_user(useraddr, &info, sizeof(info))) if (copy_to_user(useraddr, &info, sizeof(info)))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -909,9 +907,9 @@ static void *catc_probe(struct usb_device *usbdev, unsigned int ifnum, const str ...@@ -909,9 +907,9 @@ static void *catc_probe(struct usb_device *usbdev, unsigned int ifnum, const str
f5u011_rxmode(catc, catc->rxmode); f5u011_rxmode(catc, catc->rxmode);
} }
dbg("Init done."); 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", 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]); for (i = 0; i < 5; i++) printk("%2.2x:", netdev->dev_addr[i]);
printk("%2.2x.\n", netdev->dev_addr[i]); printk("%2.2x.\n", netdev->dev_addr[i]);
return catc; return catc;
......
...@@ -798,7 +798,6 @@ static int pegasus_ethtool_ioctl(struct net_device *net, void *uaddr) ...@@ -798,7 +798,6 @@ static int pegasus_ethtool_ioctl(struct net_device *net, void *uaddr)
{ {
pegasus_t *pegasus; pegasus_t *pegasus;
int cmd; int cmd;
char tmp[128];
pegasus = net->priv; pegasus = net->priv;
if (get_user(cmd, (int *)uaddr)) if (get_user(cmd, (int *)uaddr))
...@@ -808,9 +807,7 @@ static int pegasus_ethtool_ioctl(struct net_device *net, void *uaddr) ...@@ -808,9 +807,7 @@ static int pegasus_ethtool_ioctl(struct net_device *net, void *uaddr)
struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO}; struct ethtool_drvinfo info = {ETHTOOL_GDRVINFO};
strncpy(info.driver, DRIVER_DESC, ETHTOOL_BUSINFO_LEN); strncpy(info.driver, DRIVER_DESC, ETHTOOL_BUSINFO_LEN);
strncpy(info.version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN); strncpy(info.version, DRIVER_VERSION, ETHTOOL_BUSINFO_LEN);
sprintf(tmp, "usb%d:%d", pegasus->usb->bus->busnum, usb_make_path (pegasus->usb, info.bus_info, sizeof info.bus_info);
pegasus->usb->devnum);
strncpy(info.bus_info, tmp, ETHTOOL_BUSINFO_LEN);
if (copy_to_user(uaddr, &info, sizeof(info))) if (copy_to_user(uaddr, &info, sizeof(info)))
return -EFAULT; return -EFAULT;
return 0; return 0;
......
This diff is collapsed.
...@@ -538,8 +538,7 @@ static int genelink_rx_fixup (struct usbnet *dev, struct sk_buff *skb) ...@@ -538,8 +538,7 @@ static int genelink_rx_fixup (struct usbnet *dev, struct sk_buff *skb)
// allocate the skb for the individual packet // allocate the skb for the individual packet
gl_skb = alloc_skb (size, GFP_ATOMIC); gl_skb = alloc_skb (size, GFP_ATOMIC);
if (gl_skb == 0) if (gl_skb) {
return 0;
// copy the packet data to the new skb // copy the packet data to the new skb
memcpy (gl_skb->data, packet->packet_data, size); memcpy (gl_skb->data, packet->packet_data, size);
...@@ -557,6 +556,7 @@ static int genelink_rx_fixup (struct usbnet *dev, struct sk_buff *skb) ...@@ -557,6 +556,7 @@ static int genelink_rx_fixup (struct usbnet *dev, struct sk_buff *skb)
// notify os of the received packet // notify os of the received packet
status = netif_rx (gl_skb); status = netif_rx (gl_skb);
}
// advance to the next packet // advance to the next packet
packet = (struct gl_packet *) packet = (struct gl_packet *)
...@@ -834,10 +834,10 @@ static void nc_dump_registers (struct usbnet *dev) ...@@ -834,10 +834,10 @@ static void nc_dump_registers (struct usbnet *dev)
static inline void nc_dump_usbctl (struct usbnet *dev, u16 usbctl) static inline void nc_dump_usbctl (struct usbnet *dev, u16 usbctl)
{ {
#ifdef DEBUG #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;" " this%s%s;"
" other%s%s; r/o 0x%x", " 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 & USBCTL_ENABLE_LANG) ? " lang" : "", (usbctl & USBCTL_ENABLE_LANG) ? " lang" : "",
(usbctl & USBCTL_ENABLE_MFGR) ? " mfgr" : "", (usbctl & USBCTL_ENABLE_MFGR) ? " mfgr" : "",
...@@ -879,10 +879,10 @@ static inline void nc_dump_usbctl (struct usbnet *dev, u16 usbctl) ...@@ -879,10 +879,10 @@ static inline void nc_dump_usbctl (struct usbnet *dev, u16 usbctl)
static inline void nc_dump_status (struct usbnet *dev, u16 status) static inline void nc_dump_status (struct usbnet *dev, u16 status)
{ {
#ifdef DEBUG #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;" " this (%c) PKT=%d%s%s%s;"
" other PKT=%d%s%s%s; unspec 0x%x", " 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, status,
// XXX the packet counts don't seem right // XXX the packet counts don't seem right
...@@ -917,8 +917,8 @@ static inline void nc_dump_status (struct usbnet *dev, u16 status) ...@@ -917,8 +917,8 @@ static inline void nc_dump_status (struct usbnet *dev, u16 status)
static inline void nc_dump_ttl (struct usbnet *dev, u16 ttl) static inline void nc_dump_ttl (struct usbnet *dev, u16 ttl)
{ {
#ifdef DEBUG #ifdef DEBUG
devdbg (dev, "net1080 %03d/%03d ttl 0x%x this = %d, other = %d", devdbg (dev, "net1080 %s-%s ttl 0x%x this = %d, other = %d",
dev->udev->bus->busnum, dev->udev->devnum, dev->udev->bus->bus_name, dev->udev->devpath,
ttl, ttl,
TTL_THIS (ttl), TTL_THIS (ttl),
...@@ -941,7 +941,8 @@ static int net1080_reset (struct usbnet *dev) ...@@ -941,7 +941,8 @@ static int net1080_reset (struct usbnet *dev)
// nc_dump_registers (dev); // nc_dump_registers (dev);
if ((retval = nc_register_read (dev, REG_STATUS, vp)) < 0) { 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; goto done;
} }
status = *vp; status = *vp;
...@@ -1504,10 +1505,9 @@ static int usbnet_open (struct net_device *net) ...@@ -1504,10 +1505,9 @@ static int usbnet_open (struct net_device *net)
// put into "known safe" state // put into "known safe" state
if (info->reset && (retval = info->reset (dev)) < 0) { 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, retval,
// FIXME busnum is unstable dev->udev->bus->bus_name, dev->udev->devpath,
dev->udev->bus->busnum, dev->udev->devpath,
info->description); info->description);
goto done; goto done;
} }
...@@ -1557,9 +1557,7 @@ static int usbnet_ethtool_ioctl (struct net_device *net, void *useraddr) ...@@ -1557,9 +1557,7 @@ static int usbnet_ethtool_ioctl (struct net_device *net, void *useraddr)
strncpy (info.version, DRIVER_VERSION, sizeof info.version); strncpy (info.version, DRIVER_VERSION, sizeof info.version);
strncpy (info.fw_version, dev->driver_info->description, strncpy (info.fw_version, dev->driver_info->description,
sizeof info.fw_version); sizeof info.fw_version);
snprintf (info.bus_info, sizeof info.bus_info, "USB bus%d%s", usb_make_path (dev->udev, info.bus_info, sizeof info.bus_info);
/* FIXME busnums are bogus/unstable IDs */
dev->udev->bus->busnum, dev->udev->devpath);
if (copy_to_user (useraddr, &info, sizeof (info))) if (copy_to_user (useraddr, &info, sizeof (info)))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -1847,9 +1845,8 @@ static void usbnet_disconnect (struct usb_device *udev, void *ptr) ...@@ -1847,9 +1845,8 @@ static void usbnet_disconnect (struct usb_device *udev, void *ptr)
{ {
struct usbnet *dev = (struct usbnet *) ptr; struct usbnet *dev = (struct usbnet *) ptr;
devinfo (dev, "unregister usbnet bus%d%s, %s", devinfo (dev, "unregister usbnet usb-%s-%s, %s",
// FIXME busnum is unstable udev->bus->bus_name, udev->devpath,
udev->bus->busnum, udev->devpath,
dev->driver_info->description); dev->driver_info->description);
unregister_netdev (&dev->net); unregister_netdev (&dev->net);
...@@ -1938,9 +1935,8 @@ usbnet_probe (struct usb_device *udev, unsigned ifnum, ...@@ -1938,9 +1935,8 @@ usbnet_probe (struct usb_device *udev, unsigned ifnum,
net->do_ioctl = usbnet_ioctl; net->do_ioctl = usbnet_ioctl;
register_netdev (&dev->net); register_netdev (&dev->net);
devinfo (dev, "register usbnet bus%d%s, %s", devinfo (dev, "register usbnet usb-%s-%s, %s",
// FIXME busnum is unstable udev->bus->bus_name, udev->devpath,
udev->bus->busnum, udev->devpath,
dev->driver_info->description); dev->driver_info->description);
// ok, it's ready to go. // ok, it's ready to go.
......
...@@ -14,8 +14,6 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o ...@@ -14,8 +14,6 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o
usb-storage-obj-$(CONFIG_USB_STORAGE_HP8200e) += shuttle_usbat.o usb-storage-obj-$(CONFIG_USB_STORAGE_HP8200e) += shuttle_usbat.o
usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR09) += sddr09.o usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR09) += sddr09.o
usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o
usb-storage-obj-$(CONFIG_USB_STORAGE_SHUTTLE_SMARTMEDIA) += shuttle_sm.o
usb-storage-obj-$(CONFIG_USB_STORAGE_SHUTTLE_COMPACTFLASH) += shuttle_cf.o
usb-storage-obj-$(CONFIG_USB_STORAGE_DPCM) += dpcm.o usb-storage-obj-$(CONFIG_USB_STORAGE_DPCM) += dpcm.o
usb-storage-obj-$(CONFIG_USB_STORAGE_ISD200) += isd200.o usb-storage-obj-$(CONFIG_USB_STORAGE_ISD200) += isd200.o
usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o
......
...@@ -890,7 +890,6 @@ extern int usb_string(struct usb_device *dev, int index, ...@@ -890,7 +890,6 @@ extern int usb_string(struct usb_device *dev, int index,
char *buf, size_t size); char *buf, size_t size);
extern int usb_set_configuration(struct usb_device *dev, int configuration); extern int usb_set_configuration(struct usb_device *dev, int configuration);
extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate);
extern int usb_make_path(struct usb_device *dev, char *buf, size_t size);
/* /*
* timeouts, in seconds, used for sending/receiving control messages * timeouts, in seconds, used for sending/receiving control messages
...@@ -917,6 +916,7 @@ struct usb_operations; ...@@ -917,6 +916,7 @@ struct usb_operations;
*/ */
struct usb_bus { struct usb_bus {
int busnum; /* Bus number (in order of reg) */ int busnum; /* Bus number (in order of reg) */
char *bus_name; /* stable id (PCI slot_name etc) */
#ifdef DEVNUM_ROUND_ROBIN #ifdef DEVNUM_ROUND_ROBIN
int devnum_next; /* Next open device number in round-robin allocation */ int devnum_next; /* Next open device number in round-robin allocation */
...@@ -1087,6 +1087,37 @@ const struct usb_device_id *usb_match_id(struct usb_device *dev, ...@@ -1087,6 +1087,37 @@ const struct usb_device_id *usb_match_id(struct usb_device *dev,
struct usb_interface *interface, struct usb_interface *interface,
const struct usb_device_id *id); const struct usb_device_id *id);
/**
* usb_make_path - returns stable device path in the usb tree
* @dev: the device whose path is being constructed
* @buf: where to put the string
* @size: how big is "buf"?
*
* Returns length of the string (> 0) or negative if size was too small.
*
* This identifier is intended to be "stable", reflecting physical paths in
* hardware such as physical bus addresses for host controllers or ports on
* USB hubs. That makes it stay the same until systems are physically
* reconfigured, by re-cabling a tree of USB devices or by moving USB host
* controllers. Adding and removing devices, including virtual root hubs
* in host controller driver modules, does not change these path identifers;
* neither does rebooting or re-enumerating. These are more useful identifiers
* than changeable ("unstable") ones like bus numbers or device addresses.
*
* With a partial exception for devices connected to USB 2.0 root hubs, these
* identifiers are also predictable: so long as the device tree isn't changed,
* plugging any USB device into a given hub port always gives it the same path.
* Because of the use of "companion" controllers, devices connected to ports on
* USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are
* high speed, and a different one if they are full or low speed.
*/
static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
{
int actual;
actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, dev->devpath);
return (actual >= size) ? -1 : actual;
}
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* /*
......
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