From 21033193a4bb45e499e58c70dff0408a2149c274 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 7 Dec 2003 19:10:51 -0800 Subject: [PATCH] USB: register usb-serial ports in the proper place in sysfs They should be bound to the interface the driver is attached to, not the device. --- drivers/usb/serial/usb-serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/usb') diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 96747544c788..ec610ee4aa1c 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -1242,7 +1242,7 @@ int usb_serial_probe(struct usb_interface *interface, /* register all of the individual ports with the driver core */ for (i = 0; i < num_ports; ++i) { port = serial->port[i]; - port->dev.parent = &serial->dev->dev; + port->dev.parent = &interface->dev; port->dev.driver = NULL; port->dev.bus = &usb_serial_bus_type; port->dev.release = &port_release; -- cgit v1.2.3 From 41888e962af026a557c4a274d41b86fb5d27c4ee Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sun, 7 Dec 2003 21:28:46 -0800 Subject: [PATCH] USB: fix remove device after set_configuration If a device can't be configured, the current test9 code forgets to clean it out of sysfs. This resolves that issue, so the retry in usb_new_device() stands a chance of working. The enumeration code still doesn't handle such errors well, but at least this way that hub port can be used for another device. --- drivers/usb/core/usb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/usb') diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 3fad1ec8b4a3..4bccdf023348 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -1120,6 +1120,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent) if (err) { dev_err(&dev->dev, "can't set config #%d, error %d\n", dev->config[0].desc.bConfigurationValue, err); + device_del(&dev->dev); goto fail; } -- cgit v1.2.3 From 830a91c95e5c62d8d9be53d37fa63b8f73371265 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 7 Dec 2003 21:58:14 -0800 Subject: [PATCH] USB: fix race with hub devices disconnecting while stuff is still happening to them. --- drivers/usb/core/hub.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/usb') diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index dc12ba0c9722..f665eadd35e7 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -692,6 +692,9 @@ static int hub_port_status(struct usb_device *dev, int port, struct usb_hub *hub = usb_get_intfdata(dev->actconfig->interface[0]); int ret; + if (!hub) + return -ENODEV; + ret = get_port_status(dev, port + 1, &hub->status->port); if (ret < 0) dev_err (hubdev (dev), -- cgit v1.2.3 From bc26e4e4e8ead1de0c183883a38ae8603f6e173e Mon Sep 17 00:00:00 2001 From: Matthew Dharm Date: Mon, 8 Dec 2003 17:35:37 -0800 Subject: [PATCH] USB storage: fix for jumpshot and datafab devices This patch fixes some obvious errors in the jumpshot and datafab drivers. This should close out Bugzilla bug #1408 > Date: Mon, 1 Dec 2003 12:14:53 -0500 (EST) > From: Alan Stern > Subject: Patch from Eduard Hasenleithner > To: Matthew Dharm > cc: USB Storage List > > Matt: > > Did you see this patch? It was posted to the usb-development mailing list > about a week ago, before I started making all my changes. It is clearly > correct and necessary. > > Alan Stern --- drivers/usb/storage/datafab.c | 2 +- drivers/usb/storage/jumpshot.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c index 02b13b3867c1..5036f7a32fa2 100644 --- a/drivers/usb/storage/datafab.c +++ b/drivers/usb/storage/datafab.c @@ -387,7 +387,7 @@ static int datafab_id_device(struct us_data *us, // we'll go ahead and extract the media capacity while we're here... // - rc = datafab_bulk_read(us, reply, sizeof(reply)); + rc = datafab_bulk_read(us, reply, 512); if (rc == USB_STOR_XFER_GOOD) { // capacity is at word offset 57-58 // diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c index 3b75a8a43eda..8149f27640be 100644 --- a/drivers/usb/storage/jumpshot.c +++ b/drivers/usb/storage/jumpshot.c @@ -317,7 +317,7 @@ static int jumpshot_id_device(struct us_data *us, } // read the reply - rc = jumpshot_bulk_read(us, reply, sizeof(reply)); + rc = jumpshot_bulk_read(us, reply, 512); if (rc != USB_STOR_XFER_GOOD) { rc = USB_STOR_TRANSPORT_ERROR; goto leave; -- cgit v1.2.3 From cee0c0dde7a644f8ecf201bc341e58e1772741b5 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 8 Dec 2003 17:42:34 -0800 Subject: [PATCH] USB: mark the scanner driver as obsolete On Mon, Dec 01, 2003 at 11:21:58AM -0800, Greg KH wrote: > Can't you use xsane without the scanner kernel driver? I thought the > latest versions used libusb/usbfs to talk directly to the hardware. > Because of this, the USB scanner driver is marked to be removed from the > kernel sometime in the near future. After a bit of mucking around (and possibly finding a bug with debian's libusb/xsane/hotplug interaction, nothing seems to run /etc/hotplug/usb/libusbscanner and thus only root can scan, anyone whose got this working please let me know), the problem does not exist if I only use libusb xsane. How about the following: --- drivers/usb/image/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/usb') diff --git a/drivers/usb/image/Kconfig b/drivers/usb/image/Kconfig index efe964efe12e..6263370d3ed9 100644 --- a/drivers/usb/image/Kconfig +++ b/drivers/usb/image/Kconfig @@ -18,13 +18,15 @@ config USB_MDC800 module will be called mdc800. config USB_SCANNER - tristate "USB Scanner support" + tristate "USB Scanner support (OBSOLETE)" depends on USB help Say Y here if you want to connect a USB scanner to your computer's USB port. Please read for more information. + This driver has been obsoleted by support via libusb. + To compile this driver as a module, choose M here: the module will be called scanner. -- cgit v1.2.3 From 697a025dc3c84aa4e389498ef2a6a8897bafacd7 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Mon, 8 Dec 2003 18:00:49 -0800 Subject: [PATCH] USB: fix sleping in interrupt bug in auerswald driver this fixes two instances of GFP_KERNEL from completion handlers. --- drivers/usb/misc/auerswald.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 4ef570f5cb84..a8f581e58df5 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c @@ -324,7 +324,7 @@ static void auerchain_complete (struct urb * urb, struct pt_regs *regs) urb = acep->urbp; dbg ("auerchain_complete: submitting next urb from chain"); urb->status = 0; /* needed! */ - result = usb_submit_urb(urb, GFP_KERNEL); + result = usb_submit_urb(urb, GFP_ATOMIC); /* check for submit errors */ if (result) { @@ -402,7 +402,7 @@ static int auerchain_submit_urb_list (pauerchain_t acp, struct urb * urb, int ea if (acep) { dbg("submitting urb immediate"); urb->status = 0; /* needed! */ - result = usb_submit_urb(urb, GFP_KERNEL); + result = usb_submit_urb(urb, GFP_ATOMIC); /* check for submit errors */ if (result) { urb->status = result; -- cgit v1.2.3 From 41b98670535687b465df7ae1da75f2911415e61a Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Mon, 8 Dec 2003 18:18:07 -0800 Subject: [PATCH] USB: fix race with signal delivery in usbfs apart from locking bugs, there are other races. This fixes one with signal delivery. The signal should be delivered _before_ the reciever is woken. --- drivers/usb/core/devio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/usb') diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index ecef33242859..68ca2b2abfee 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -261,7 +261,6 @@ static void async_completed(struct urb *urb, struct pt_regs *regs) spin_lock(&ps->lock); list_move_tail(&as->asynclist, &ps->async_completed); spin_unlock(&ps->lock); - wake_up(&ps->wait); if (as->signr) { sinfo.si_signo = as->signr; sinfo.si_errno = as->urb->status; @@ -269,6 +268,7 @@ static void async_completed(struct urb *urb, struct pt_regs *regs) sinfo.si_addr = (void *)as->userurb; send_sig_info(as->signr, &sinfo, as->task); } + wake_up(&ps->wait); } static void destroy_async (struct dev_state *ps, struct list_head *list) -- cgit v1.2.3 From f6b1ebe8146930855211c8e5ffdc986cc90c0502 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Mon, 8 Dec 2003 23:41:57 -0800 Subject: [PATCH] USB: fix bug not setting device state following usb_device_reset() --- drivers/usb/core/hub.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/usb') diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index f665eadd35e7..eba7d9fca67a 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1345,6 +1345,7 @@ int usb_physical_reset_device(struct usb_device *dev) dev->devpath, ret); return ret; } + dev->state = USB_STATE_CONFIGURED; for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { struct usb_interface *intf = dev->actconfig->interface[i]; -- cgit v1.2.3 From 08bceb43a596101b03501cebd1e6de166e846393 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Tue, 9 Dec 2003 01:40:44 -0800 Subject: [PATCH] USB: Fix connect/disconnect race This patch was integrated by you in 2.4 six months ago. Unfortunately it never got into 2.5. Without it you can end up with crashes such as http://bugs.debian.org/218670 --- drivers/usb/core/hub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index eba7d9fca67a..d019f21cec37 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -929,7 +929,6 @@ static void hub_port_connect_change(struct usb_hub *hubstate, int port, break; } - hub->children[port] = dev; dev->state = USB_STATE_POWERED; /* Reset the device, and detect its speed */ @@ -982,8 +981,10 @@ static void hub_port_connect_change(struct usb_hub *hubstate, int port, dev->dev.parent = dev->parent->dev.parent->parent; /* Run it through the hoops (find a driver, etc) */ - if (!usb_new_device(dev, &hub->dev)) + if (!usb_new_device(dev, &hub->dev)) { + hub->children[port] = dev; goto done; + } /* Free the configuration if there was an error */ usb_put_dev(dev); @@ -992,7 +993,6 @@ static void hub_port_connect_change(struct usb_hub *hubstate, int port, delay = HUB_LONG_RESET_TIME; } - hub->children[port] = NULL; hub_port_disable(hub, port); done: up(&usb_address0_sem); -- cgit v1.2.3 From 95cc041850e4b5ffbff4800f77c1af2e0dd768a0 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 9 Dec 2003 22:39:48 -0800 Subject: [PATCH] USB: fix bug for multiple opens on ttyUSB devices. This patch fixes the bug where running ppp over a ttyUSB device would fail. --- drivers/usb/serial/usb-serial.c | 48 +++++++++++------------------------------ 1 file changed, 13 insertions(+), 35 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index ec610ee4aa1c..c7a96102a73e 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -493,12 +493,15 @@ bailout: return retval; } -static void __serial_close(struct usb_serial_port *port, struct file *filp) +static void serial_close(struct tty_struct *tty, struct file * filp) { - if (!port->open_count) { - dbg ("%s - port not opened", __FUNCTION__); + struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; + struct usb_serial *serial = get_usb_serial (port, __FUNCTION__); + + if (!serial) return; - } + + dbg("%s - port %d", __FUNCTION__, port->number); --port->open_count; if (port->open_count <= 0) { @@ -506,30 +509,18 @@ static void __serial_close(struct usb_serial_port *port, struct file *filp) * port is being closed by the last owner */ port->serial->type->close(port, filp); port->open_count = 0; + + if (port->tty) { + if (port->tty->driver_data) + port->tty->driver_data = NULL; + port->tty = NULL; + } } module_put(port->serial->type->owner); kobject_put(&port->serial->kobj); } -static void serial_close(struct tty_struct *tty, struct file * filp) -{ - struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; - struct usb_serial *serial = get_usb_serial (port, __FUNCTION__); - - if (!serial) - return; - - dbg("%s - port %d", __FUNCTION__, port->number); - - /* if disconnect beat us to the punch here, there's nothing to do */ - if (tty && tty->driver_data) { - __serial_close(port, filp); - tty->driver_data = NULL; - } - port->tty = NULL; -} - static int serial_write (struct tty_struct * tty, int from_user, const unsigned char *buf, int count) { struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; @@ -848,19 +839,6 @@ static void destroy_serial (struct kobject *kobj) dbg ("%s - %s", __FUNCTION__, kobj->name); serial = to_usb_serial(kobj); - - /* fail all future close/read/write/ioctl/etc calls */ - for (i = 0; i < serial->num_ports; ++i) { - port = serial->port[i]; - if (port->tty != NULL) { - port->tty->driver_data = NULL; - while (port->open_count > 0) { - __serial_close(port, NULL); - } - port->tty = NULL; - } - } - serial_shutdown (serial); /* return the minor range that this device had */ -- cgit v1.2.3