diff options
36 files changed, 202 insertions, 115 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 8ac25adf31b4..387dc6c8ad25 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -593,7 +593,6 @@ static void acm_port_destruct(struct tty_port *port) | |||
| 593 | 593 | ||
| 594 | dev_dbg(&acm->control->dev, "%s\n", __func__); | 594 | dev_dbg(&acm->control->dev, "%s\n", __func__); |
| 595 | 595 | ||
| 596 | tty_unregister_device(acm_tty_driver, acm->minor); | ||
| 597 | acm_release_minor(acm); | 596 | acm_release_minor(acm); |
| 598 | usb_put_intf(acm->control); | 597 | usb_put_intf(acm->control); |
| 599 | kfree(acm->country_codes); | 598 | kfree(acm->country_codes); |
| @@ -977,6 +976,8 @@ static int acm_probe(struct usb_interface *intf, | |||
| 977 | int num_rx_buf; | 976 | int num_rx_buf; |
| 978 | int i; | 977 | int i; |
| 979 | int combined_interfaces = 0; | 978 | int combined_interfaces = 0; |
| 979 | struct device *tty_dev; | ||
| 980 | int rv = -ENOMEM; | ||
| 980 | 981 | ||
| 981 | /* normal quirks */ | 982 | /* normal quirks */ |
| 982 | quirks = (unsigned long)id->driver_info; | 983 | quirks = (unsigned long)id->driver_info; |
| @@ -1339,11 +1340,24 @@ skip_countries: | |||
| 1339 | usb_set_intfdata(data_interface, acm); | 1340 | usb_set_intfdata(data_interface, acm); |
| 1340 | 1341 | ||
| 1341 | usb_get_intf(control_interface); | 1342 | usb_get_intf(control_interface); |
| 1342 | tty_port_register_device(&acm->port, acm_tty_driver, minor, | 1343 | tty_dev = tty_port_register_device(&acm->port, acm_tty_driver, minor, |
| 1343 | &control_interface->dev); | 1344 | &control_interface->dev); |
| 1345 | if (IS_ERR(tty_dev)) { | ||
| 1346 | rv = PTR_ERR(tty_dev); | ||
| 1347 | goto alloc_fail8; | ||
| 1348 | } | ||
| 1344 | 1349 | ||
| 1345 | return 0; | 1350 | return 0; |
| 1351 | alloc_fail8: | ||
| 1352 | if (acm->country_codes) { | ||
| 1353 | device_remove_file(&acm->control->dev, | ||
| 1354 | &dev_attr_wCountryCodes); | ||
| 1355 | device_remove_file(&acm->control->dev, | ||
| 1356 | &dev_attr_iCountryCodeRelDate); | ||
| 1357 | } | ||
| 1358 | device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); | ||
| 1346 | alloc_fail7: | 1359 | alloc_fail7: |
| 1360 | usb_set_intfdata(intf, NULL); | ||
| 1347 | for (i = 0; i < ACM_NW; i++) | 1361 | for (i = 0; i < ACM_NW; i++) |
| 1348 | usb_free_urb(acm->wb[i].urb); | 1362 | usb_free_urb(acm->wb[i].urb); |
| 1349 | alloc_fail6: | 1363 | alloc_fail6: |
| @@ -1359,7 +1373,7 @@ alloc_fail2: | |||
| 1359 | acm_release_minor(acm); | 1373 | acm_release_minor(acm); |
| 1360 | kfree(acm); | 1374 | kfree(acm); |
| 1361 | alloc_fail: | 1375 | alloc_fail: |
| 1362 | return -ENOMEM; | 1376 | return rv; |
| 1363 | } | 1377 | } |
| 1364 | 1378 | ||
| 1365 | static void stop_data_traffic(struct acm *acm) | 1379 | static void stop_data_traffic(struct acm *acm) |
| @@ -1411,6 +1425,8 @@ static void acm_disconnect(struct usb_interface *intf) | |||
| 1411 | 1425 | ||
| 1412 | stop_data_traffic(acm); | 1426 | stop_data_traffic(acm); |
| 1413 | 1427 | ||
| 1428 | tty_unregister_device(acm_tty_driver, acm->minor); | ||
| 1429 | |||
| 1414 | usb_free_urb(acm->ctrlurb); | 1430 | usb_free_urb(acm->ctrlurb); |
| 1415 | for (i = 0; i < ACM_NW; i++) | 1431 | for (i = 0; i < ACM_NW; i++) |
| 1416 | usb_free_urb(acm->wb[i].urb); | 1432 | usb_free_urb(acm->wb[i].urb); |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 622b4a48e732..2b487d4797bd 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
| @@ -173,6 +173,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 173 | struct hc_driver *driver; | 173 | struct hc_driver *driver; |
| 174 | struct usb_hcd *hcd; | 174 | struct usb_hcd *hcd; |
| 175 | int retval; | 175 | int retval; |
| 176 | int hcd_irq = 0; | ||
| 176 | 177 | ||
| 177 | if (usb_disabled()) | 178 | if (usb_disabled()) |
| 178 | return -ENODEV; | 179 | return -ENODEV; |
| @@ -187,15 +188,19 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 187 | return -ENODEV; | 188 | return -ENODEV; |
| 188 | dev->current_state = PCI_D0; | 189 | dev->current_state = PCI_D0; |
| 189 | 190 | ||
| 190 | /* The xHCI driver supports MSI and MSI-X, | 191 | /* |
| 191 | * so don't fail if the BIOS doesn't provide a legacy IRQ. | 192 | * The xHCI driver has its own irq management |
| 193 | * make sure irq setup is not touched for xhci in generic hcd code | ||
| 192 | */ | 194 | */ |
| 193 | if (!dev->irq && (driver->flags & HCD_MASK) != HCD_USB3) { | 195 | if ((driver->flags & HCD_MASK) != HCD_USB3) { |
| 194 | dev_err(&dev->dev, | 196 | if (!dev->irq) { |
| 195 | "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", | 197 | dev_err(&dev->dev, |
| 196 | pci_name(dev)); | 198 | "Found HC with no IRQ. Check BIOS/PCI %s setup!\n", |
| 197 | retval = -ENODEV; | 199 | pci_name(dev)); |
| 198 | goto disable_pci; | 200 | retval = -ENODEV; |
| 201 | goto disable_pci; | ||
| 202 | } | ||
| 203 | hcd_irq = dev->irq; | ||
| 199 | } | 204 | } |
| 200 | 205 | ||
| 201 | hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); | 206 | hcd = usb_create_hcd(driver, &dev->dev, pci_name(dev)); |
| @@ -245,7 +250,7 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 245 | 250 | ||
| 246 | pci_set_master(dev); | 251 | pci_set_master(dev); |
| 247 | 252 | ||
| 248 | retval = usb_add_hcd(hcd, dev->irq, IRQF_SHARED); | 253 | retval = usb_add_hcd(hcd, hcd_irq, IRQF_SHARED); |
| 249 | if (retval != 0) | 254 | if (retval != 0) |
| 250 | goto unmap_registers; | 255 | goto unmap_registers; |
| 251 | set_hs_companion(dev, hcd); | 256 | set_hs_companion(dev, hcd); |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 71beeb833558..cc9c49c57c80 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
| @@ -447,14 +447,13 @@ static void rndis_response_complete(struct usb_ep *ep, struct usb_request *req) | |||
| 447 | static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req) | 447 | static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req) |
| 448 | { | 448 | { |
| 449 | struct f_rndis *rndis = req->context; | 449 | struct f_rndis *rndis = req->context; |
| 450 | struct usb_composite_dev *cdev = rndis->port.func.config->cdev; | ||
| 451 | int status; | 450 | int status; |
| 452 | 451 | ||
| 453 | /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ | 452 | /* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */ |
| 454 | // spin_lock(&dev->lock); | 453 | // spin_lock(&dev->lock); |
| 455 | status = rndis_msg_parser(rndis->config, (u8 *) req->buf); | 454 | status = rndis_msg_parser(rndis->config, (u8 *) req->buf); |
| 456 | if (status < 0) | 455 | if (status < 0) |
| 457 | ERROR(cdev, "RNDIS command error %d, %d/%d\n", | 456 | pr_err("RNDIS command error %d, %d/%d\n", |
| 458 | status, req->actual, req->length); | 457 | status, req->actual, req->length); |
| 459 | // spin_unlock(&dev->lock); | 458 | // spin_unlock(&dev->lock); |
| 460 | } | 459 | } |
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 3953dd4d7186..3b343b23e4b0 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
| @@ -357,7 +357,7 @@ static int gfs_bind(struct usb_composite_dev *cdev) | |||
| 357 | goto error; | 357 | goto error; |
| 358 | gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id; | 358 | gfs_dev_desc.iProduct = gfs_strings[USB_GADGET_PRODUCT_IDX].id; |
| 359 | 359 | ||
| 360 | for (i = func_num; --i; ) { | 360 | for (i = func_num; i--; ) { |
| 361 | ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); | 361 | ret = functionfs_bind(ffs_tab[i].ffs_data, cdev); |
| 362 | if (unlikely(ret < 0)) { | 362 | if (unlikely(ret < 0)) { |
| 363 | while (++i < func_num) | 363 | while (++i < func_num) |
| @@ -413,7 +413,7 @@ static int gfs_unbind(struct usb_composite_dev *cdev) | |||
| 413 | gether_cleanup(); | 413 | gether_cleanup(); |
| 414 | gfs_ether_setup = false; | 414 | gfs_ether_setup = false; |
| 415 | 415 | ||
| 416 | for (i = func_num; --i; ) | 416 | for (i = func_num; i--; ) |
| 417 | if (ffs_tab[i].ffs_data) | 417 | if (ffs_tab[i].ffs_data) |
| 418 | functionfs_unbind(ffs_tab[i].ffs_data); | 418 | functionfs_unbind(ffs_tab[i].ffs_data); |
| 419 | 419 | ||
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c index d226058e3b88..32524b631959 100644 --- a/drivers/usb/gadget/net2272.c +++ b/drivers/usb/gadget/net2272.c | |||
| @@ -59,7 +59,7 @@ static const char * const ep_name[] = { | |||
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) | 61 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) |
| 62 | #ifdef CONFIG_USB_GADGET_NET2272_DMA | 62 | #ifdef CONFIG_USB_NET2272_DMA |
| 63 | /* | 63 | /* |
| 64 | * use_dma: the NET2272 can use an external DMA controller. | 64 | * use_dma: the NET2272 can use an external DMA controller. |
| 65 | * Note that since there is no generic DMA api, some functions, | 65 | * Note that since there is no generic DMA api, some functions, |
| @@ -1495,6 +1495,13 @@ stop_activity(struct net2272 *dev, struct usb_gadget_driver *driver) | |||
| 1495 | for (i = 0; i < 4; ++i) | 1495 | for (i = 0; i < 4; ++i) |
| 1496 | net2272_dequeue_all(&dev->ep[i]); | 1496 | net2272_dequeue_all(&dev->ep[i]); |
| 1497 | 1497 | ||
| 1498 | /* report disconnect; the driver is already quiesced */ | ||
| 1499 | if (driver) { | ||
| 1500 | spin_unlock(&dev->lock); | ||
| 1501 | driver->disconnect(&dev->gadget); | ||
| 1502 | spin_lock(&dev->lock); | ||
| 1503 | } | ||
| 1504 | |||
| 1498 | net2272_usb_reinit(dev); | 1505 | net2272_usb_reinit(dev); |
| 1499 | } | 1506 | } |
| 1500 | 1507 | ||
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index a1b650e11339..3bd0f992fb49 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
| @@ -1924,7 +1924,6 @@ static int net2280_start(struct usb_gadget *_gadget, | |||
| 1924 | err_func: | 1924 | err_func: |
| 1925 | device_remove_file (&dev->pdev->dev, &dev_attr_function); | 1925 | device_remove_file (&dev->pdev->dev, &dev_attr_function); |
| 1926 | err_unbind: | 1926 | err_unbind: |
| 1927 | driver->unbind (&dev->gadget); | ||
| 1928 | dev->gadget.dev.driver = NULL; | 1927 | dev->gadget.dev.driver = NULL; |
| 1929 | dev->driver = NULL; | 1928 | dev->driver = NULL; |
| 1930 | return retval; | 1929 | return retval; |
| @@ -1946,6 +1945,13 @@ stop_activity (struct net2280 *dev, struct usb_gadget_driver *driver) | |||
| 1946 | for (i = 0; i < 7; i++) | 1945 | for (i = 0; i < 7; i++) |
| 1947 | nuke (&dev->ep [i]); | 1946 | nuke (&dev->ep [i]); |
| 1948 | 1947 | ||
| 1948 | /* report disconnect; the driver is already quiesced */ | ||
| 1949 | if (driver) { | ||
| 1950 | spin_unlock(&dev->lock); | ||
| 1951 | driver->disconnect(&dev->gadget); | ||
| 1952 | spin_lock(&dev->lock); | ||
| 1953 | } | ||
| 1954 | |||
| 1949 | usb_reinit (dev); | 1955 | usb_reinit (dev); |
| 1950 | } | 1956 | } |
| 1951 | 1957 | ||
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index c5034d9c946b..b369292d4b90 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c | |||
| @@ -136,7 +136,7 @@ static struct portmaster { | |||
| 136 | pr_debug(fmt, ##arg) | 136 | pr_debug(fmt, ##arg) |
| 137 | #endif /* pr_vdebug */ | 137 | #endif /* pr_vdebug */ |
| 138 | #else | 138 | #else |
| 139 | #ifndef pr_vdebig | 139 | #ifndef pr_vdebug |
| 140 | #define pr_vdebug(fmt, arg...) \ | 140 | #define pr_vdebug(fmt, arg...) \ |
| 141 | ({ if (0) pr_debug(fmt, ##arg); }) | 141 | ({ if (0) pr_debug(fmt, ##arg); }) |
| 142 | #endif /* pr_vdebug */ | 142 | #endif /* pr_vdebug */ |
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 2a9cd369f71c..f8f62c3ed65e 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
| @@ -216,7 +216,7 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) | |||
| 216 | usb_gadget_disconnect(udc->gadget); | 216 | usb_gadget_disconnect(udc->gadget); |
| 217 | udc->driver->disconnect(udc->gadget); | 217 | udc->driver->disconnect(udc->gadget); |
| 218 | udc->driver->unbind(udc->gadget); | 218 | udc->driver->unbind(udc->gadget); |
| 219 | usb_gadget_udc_stop(udc->gadget, udc->driver); | 219 | usb_gadget_udc_stop(udc->gadget, NULL); |
| 220 | 220 | ||
| 221 | udc->driver = NULL; | 221 | udc->driver = NULL; |
| 222 | udc->dev.driver = NULL; | 222 | udc->dev.driver = NULL; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 5726cb144abf..416a6dce5e11 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -302,6 +302,7 @@ static void ehci_quiesce (struct ehci_hcd *ehci) | |||
| 302 | 302 | ||
| 303 | static void end_unlink_async(struct ehci_hcd *ehci); | 303 | static void end_unlink_async(struct ehci_hcd *ehci); |
| 304 | static void unlink_empty_async(struct ehci_hcd *ehci); | 304 | static void unlink_empty_async(struct ehci_hcd *ehci); |
| 305 | static void unlink_empty_async_suspended(struct ehci_hcd *ehci); | ||
| 305 | static void ehci_work(struct ehci_hcd *ehci); | 306 | static void ehci_work(struct ehci_hcd *ehci); |
| 306 | static void start_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); | 307 | static void start_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); |
| 307 | static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); | 308 | static void end_unlink_intr(struct ehci_hcd *ehci, struct ehci_qh *qh); |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 4d3b294f203e..7d06e77f6c4f 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
| @@ -328,7 +328,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
| 328 | ehci->rh_state = EHCI_RH_SUSPENDED; | 328 | ehci->rh_state = EHCI_RH_SUSPENDED; |
| 329 | 329 | ||
| 330 | end_unlink_async(ehci); | 330 | end_unlink_async(ehci); |
| 331 | unlink_empty_async(ehci); | 331 | unlink_empty_async_suspended(ehci); |
| 332 | ehci_handle_intr_unlinks(ehci); | 332 | ehci_handle_intr_unlinks(ehci); |
| 333 | end_free_itds(ehci); | 333 | end_free_itds(ehci); |
| 334 | 334 | ||
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 5464665f0b6a..23d136904285 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
| @@ -1316,6 +1316,19 @@ static void unlink_empty_async(struct ehci_hcd *ehci) | |||
| 1316 | } | 1316 | } |
| 1317 | } | 1317 | } |
| 1318 | 1318 | ||
| 1319 | /* The root hub is suspended; unlink all the async QHs */ | ||
| 1320 | static void unlink_empty_async_suspended(struct ehci_hcd *ehci) | ||
| 1321 | { | ||
| 1322 | struct ehci_qh *qh; | ||
| 1323 | |||
| 1324 | while (ehci->async->qh_next.qh) { | ||
| 1325 | qh = ehci->async->qh_next.qh; | ||
| 1326 | WARN_ON(!list_empty(&qh->qtd_list)); | ||
| 1327 | single_unlink_async(ehci, qh); | ||
| 1328 | } | ||
| 1329 | start_iaa_cycle(ehci, false); | ||
| 1330 | } | ||
| 1331 | |||
| 1319 | /* makes sure the async qh will become idle */ | 1332 | /* makes sure the async qh will become idle */ |
| 1320 | /* caller must own ehci->lock */ | 1333 | /* caller must own ehci->lock */ |
| 1321 | 1334 | ||
diff --git a/drivers/usb/host/ehci-timer.c b/drivers/usb/host/ehci-timer.c index 20dbdcbe9b0f..c3fa1305f830 100644 --- a/drivers/usb/host/ehci-timer.c +++ b/drivers/usb/host/ehci-timer.c | |||
| @@ -304,7 +304,7 @@ static void ehci_iaa_watchdog(struct ehci_hcd *ehci) | |||
| 304 | * (a) SMP races against real IAA firing and retriggering, and | 304 | * (a) SMP races against real IAA firing and retriggering, and |
| 305 | * (b) clean HC shutdown, when IAA watchdog was pending. | 305 | * (b) clean HC shutdown, when IAA watchdog was pending. |
| 306 | */ | 306 | */ |
| 307 | if (ehci->async_iaa) { | 307 | if (1) { |
| 308 | u32 cmd, status; | 308 | u32 cmd, status; |
| 309 | 309 | ||
| 310 | /* If we get here, IAA is *REALLY* late. It's barely | 310 | /* If we get here, IAA is *REALLY* late. It's barely |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index f1f01a834ba7..849470b18831 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -350,7 +350,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) | |||
| 350 | * generate interrupts. Don't even try to enable MSI. | 350 | * generate interrupts. Don't even try to enable MSI. |
| 351 | */ | 351 | */ |
| 352 | if (xhci->quirks & XHCI_BROKEN_MSI) | 352 | if (xhci->quirks & XHCI_BROKEN_MSI) |
| 353 | return 0; | 353 | goto legacy_irq; |
| 354 | 354 | ||
| 355 | /* unregister the legacy interrupt */ | 355 | /* unregister the legacy interrupt */ |
| 356 | if (hcd->irq) | 356 | if (hcd->irq) |
| @@ -371,6 +371,7 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) | |||
| 371 | return -EINVAL; | 371 | return -EINVAL; |
| 372 | } | 372 | } |
| 373 | 373 | ||
| 374 | legacy_irq: | ||
| 374 | /* fall back to legacy interrupt*/ | 375 | /* fall back to legacy interrupt*/ |
| 375 | ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, | 376 | ret = request_irq(pdev->irq, &usb_hcd_irq, IRQF_SHARED, |
| 376 | hcd->irq_descr, hcd); | 377 | hcd->irq_descr, hcd); |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index f791bd0aee6c..2c510e4a7d4c 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
| @@ -206,8 +206,8 @@ struct xhci_op_regs { | |||
| 206 | /* bits 12:31 are reserved (and should be preserved on writes). */ | 206 | /* bits 12:31 are reserved (and should be preserved on writes). */ |
| 207 | 207 | ||
| 208 | /* IMAN - Interrupt Management Register */ | 208 | /* IMAN - Interrupt Management Register */ |
| 209 | #define IMAN_IP (1 << 1) | 209 | #define IMAN_IE (1 << 1) |
| 210 | #define IMAN_IE (1 << 0) | 210 | #define IMAN_IP (1 << 0) |
| 211 | 211 | ||
| 212 | /* USBSTS - USB status - status bitmasks */ | 212 | /* USBSTS - USB status - status bitmasks */ |
| 213 | /* HC not running - set to 1 when run/stop bit is cleared. */ | 213 | /* HC not running - set to 1 when run/stop bit is cleared. */ |
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 7c71769d71ff..41613a2b35e8 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
| @@ -327,7 +327,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) | |||
| 327 | u8 devctl = musb_readb(mregs, MUSB_DEVCTL); | 327 | u8 devctl = musb_readb(mregs, MUSB_DEVCTL); |
| 328 | int err; | 328 | int err; |
| 329 | 329 | ||
| 330 | err = musb->int_usb & USB_INTR_VBUSERROR; | 330 | err = musb->int_usb & MUSB_INTR_VBUSERROR; |
| 331 | if (err) { | 331 | if (err) { |
| 332 | /* | 332 | /* |
| 333 | * The Mentor core doesn't debounce VBUS as needed | 333 | * The Mentor core doesn't debounce VBUS as needed |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index be18537c5f14..83eddedcd9be 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
| @@ -141,7 +141,9 @@ static inline void map_dma_buffer(struct musb_request *request, | |||
| 141 | static inline void unmap_dma_buffer(struct musb_request *request, | 141 | static inline void unmap_dma_buffer(struct musb_request *request, |
| 142 | struct musb *musb) | 142 | struct musb *musb) |
| 143 | { | 143 | { |
| 144 | if (!is_buffer_mapped(request)) | 144 | struct musb_ep *musb_ep = request->ep; |
| 145 | |||
| 146 | if (!is_buffer_mapped(request) || !musb_ep->dma) | ||
| 145 | return; | 147 | return; |
| 146 | 148 | ||
| 147 | if (request->request.dma == DMA_ADDR_INVALID) { | 149 | if (request->request.dma == DMA_ADDR_INVALID) { |
| @@ -195,7 +197,10 @@ __acquires(ep->musb->lock) | |||
| 195 | 197 | ||
| 196 | ep->busy = 1; | 198 | ep->busy = 1; |
| 197 | spin_unlock(&musb->lock); | 199 | spin_unlock(&musb->lock); |
| 198 | unmap_dma_buffer(req, musb); | 200 | |
| 201 | if (!dma_mapping_error(&musb->g.dev, request->dma)) | ||
| 202 | unmap_dma_buffer(req, musb); | ||
| 203 | |||
| 199 | if (request->status == 0) | 204 | if (request->status == 0) |
| 200 | dev_dbg(musb->controller, "%s done request %p, %d/%d\n", | 205 | dev_dbg(musb->controller, "%s done request %p, %d/%d\n", |
| 201 | ep->end_point.name, request, | 206 | ep->end_point.name, request, |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index cbd904b8fba5..4775f8209e55 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
| @@ -62,7 +62,6 @@ static int is_irda(struct usb_serial *serial) | |||
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | struct ark3116_private { | 64 | struct ark3116_private { |
| 65 | wait_queue_head_t delta_msr_wait; | ||
| 66 | struct async_icount icount; | 65 | struct async_icount icount; |
| 67 | int irda; /* 1 for irda device */ | 66 | int irda; /* 1 for irda device */ |
| 68 | 67 | ||
| @@ -146,7 +145,6 @@ static int ark3116_port_probe(struct usb_serial_port *port) | |||
| 146 | if (!priv) | 145 | if (!priv) |
| 147 | return -ENOMEM; | 146 | return -ENOMEM; |
| 148 | 147 | ||
| 149 | init_waitqueue_head(&priv->delta_msr_wait); | ||
| 150 | mutex_init(&priv->hw_lock); | 148 | mutex_init(&priv->hw_lock); |
| 151 | spin_lock_init(&priv->status_lock); | 149 | spin_lock_init(&priv->status_lock); |
| 152 | 150 | ||
| @@ -456,10 +454,14 @@ static int ark3116_ioctl(struct tty_struct *tty, | |||
| 456 | case TIOCMIWAIT: | 454 | case TIOCMIWAIT: |
| 457 | for (;;) { | 455 | for (;;) { |
| 458 | struct async_icount prev = priv->icount; | 456 | struct async_icount prev = priv->icount; |
| 459 | interruptible_sleep_on(&priv->delta_msr_wait); | 457 | interruptible_sleep_on(&port->delta_msr_wait); |
| 460 | /* see if a signal did it */ | 458 | /* see if a signal did it */ |
| 461 | if (signal_pending(current)) | 459 | if (signal_pending(current)) |
| 462 | return -ERESTARTSYS; | 460 | return -ERESTARTSYS; |
| 461 | |||
| 462 | if (port->serial->disconnected) | ||
| 463 | return -EIO; | ||
| 464 | |||
| 463 | if ((prev.rng == priv->icount.rng) && | 465 | if ((prev.rng == priv->icount.rng) && |
| 464 | (prev.dsr == priv->icount.dsr) && | 466 | (prev.dsr == priv->icount.dsr) && |
| 465 | (prev.dcd == priv->icount.dcd) && | 467 | (prev.dcd == priv->icount.dcd) && |
| @@ -580,7 +582,7 @@ static void ark3116_update_msr(struct usb_serial_port *port, __u8 msr) | |||
| 580 | priv->icount.dcd++; | 582 | priv->icount.dcd++; |
| 581 | if (msr & UART_MSR_TERI) | 583 | if (msr & UART_MSR_TERI) |
| 582 | priv->icount.rng++; | 584 | priv->icount.rng++; |
| 583 | wake_up_interruptible(&priv->delta_msr_wait); | 585 | wake_up_interruptible(&port->delta_msr_wait); |
| 584 | } | 586 | } |
| 585 | } | 587 | } |
| 586 | 588 | ||
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index d255f66e708e..07d4650a32ab 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
| @@ -80,7 +80,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
| 80 | 80 | ||
| 81 | struct ch341_private { | 81 | struct ch341_private { |
| 82 | spinlock_t lock; /* access lock */ | 82 | spinlock_t lock; /* access lock */ |
| 83 | wait_queue_head_t delta_msr_wait; /* wait queue for modem status */ | ||
| 84 | unsigned baud_rate; /* set baud rate */ | 83 | unsigned baud_rate; /* set baud rate */ |
| 85 | u8 line_control; /* set line control value RTS/DTR */ | 84 | u8 line_control; /* set line control value RTS/DTR */ |
| 86 | u8 line_status; /* active status of modem control inputs */ | 85 | u8 line_status; /* active status of modem control inputs */ |
| @@ -252,7 +251,6 @@ static int ch341_port_probe(struct usb_serial_port *port) | |||
| 252 | return -ENOMEM; | 251 | return -ENOMEM; |
| 253 | 252 | ||
| 254 | spin_lock_init(&priv->lock); | 253 | spin_lock_init(&priv->lock); |
| 255 | init_waitqueue_head(&priv->delta_msr_wait); | ||
| 256 | priv->baud_rate = DEFAULT_BAUD_RATE; | 254 | priv->baud_rate = DEFAULT_BAUD_RATE; |
| 257 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; | 255 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; |
| 258 | 256 | ||
| @@ -298,7 +296,7 @@ static void ch341_dtr_rts(struct usb_serial_port *port, int on) | |||
| 298 | priv->line_control &= ~(CH341_BIT_RTS | CH341_BIT_DTR); | 296 | priv->line_control &= ~(CH341_BIT_RTS | CH341_BIT_DTR); |
| 299 | spin_unlock_irqrestore(&priv->lock, flags); | 297 | spin_unlock_irqrestore(&priv->lock, flags); |
| 300 | ch341_set_handshake(port->serial->dev, priv->line_control); | 298 | ch341_set_handshake(port->serial->dev, priv->line_control); |
| 301 | wake_up_interruptible(&priv->delta_msr_wait); | 299 | wake_up_interruptible(&port->delta_msr_wait); |
| 302 | } | 300 | } |
| 303 | 301 | ||
| 304 | static void ch341_close(struct usb_serial_port *port) | 302 | static void ch341_close(struct usb_serial_port *port) |
| @@ -491,7 +489,7 @@ static void ch341_read_int_callback(struct urb *urb) | |||
| 491 | tty_kref_put(tty); | 489 | tty_kref_put(tty); |
| 492 | } | 490 | } |
| 493 | 491 | ||
| 494 | wake_up_interruptible(&priv->delta_msr_wait); | 492 | wake_up_interruptible(&port->delta_msr_wait); |
| 495 | } | 493 | } |
| 496 | 494 | ||
| 497 | exit: | 495 | exit: |
| @@ -517,11 +515,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
| 517 | spin_unlock_irqrestore(&priv->lock, flags); | 515 | spin_unlock_irqrestore(&priv->lock, flags); |
| 518 | 516 | ||
| 519 | while (!multi_change) { | 517 | while (!multi_change) { |
| 520 | interruptible_sleep_on(&priv->delta_msr_wait); | 518 | interruptible_sleep_on(&port->delta_msr_wait); |
| 521 | /* see if a signal did it */ | 519 | /* see if a signal did it */ |
| 522 | if (signal_pending(current)) | 520 | if (signal_pending(current)) |
| 523 | return -ERESTARTSYS; | 521 | return -ERESTARTSYS; |
| 524 | 522 | ||
| 523 | if (port->serial->disconnected) | ||
| 524 | return -EIO; | ||
| 525 | |||
| 525 | spin_lock_irqsave(&priv->lock, flags); | 526 | spin_lock_irqsave(&priv->lock, flags); |
| 526 | status = priv->line_status; | 527 | status = priv->line_status; |
| 527 | multi_change = priv->multi_status_change; | 528 | multi_change = priv->multi_status_change; |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 8efa19d0e9fb..ba7352e4187e 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
| @@ -111,7 +111,6 @@ struct cypress_private { | |||
| 111 | int baud_rate; /* stores current baud rate in | 111 | int baud_rate; /* stores current baud rate in |
| 112 | integer form */ | 112 | integer form */ |
| 113 | int isthrottled; /* if throttled, discard reads */ | 113 | int isthrottled; /* if throttled, discard reads */ |
| 114 | wait_queue_head_t delta_msr_wait; /* used for TIOCMIWAIT */ | ||
| 115 | char prev_status, diff_status; /* used for TIOCMIWAIT */ | 114 | char prev_status, diff_status; /* used for TIOCMIWAIT */ |
| 116 | /* we pass a pointer to this as the argument sent to | 115 | /* we pass a pointer to this as the argument sent to |
| 117 | cypress_set_termios old_termios */ | 116 | cypress_set_termios old_termios */ |
| @@ -449,7 +448,6 @@ static int cypress_generic_port_probe(struct usb_serial_port *port) | |||
| 449 | kfree(priv); | 448 | kfree(priv); |
| 450 | return -ENOMEM; | 449 | return -ENOMEM; |
| 451 | } | 450 | } |
| 452 | init_waitqueue_head(&priv->delta_msr_wait); | ||
| 453 | 451 | ||
| 454 | usb_reset_configuration(serial->dev); | 452 | usb_reset_configuration(serial->dev); |
| 455 | 453 | ||
| @@ -868,12 +866,16 @@ static int cypress_ioctl(struct tty_struct *tty, | |||
| 868 | switch (cmd) { | 866 | switch (cmd) { |
| 869 | /* This code comes from drivers/char/serial.c and ftdi_sio.c */ | 867 | /* This code comes from drivers/char/serial.c and ftdi_sio.c */ |
| 870 | case TIOCMIWAIT: | 868 | case TIOCMIWAIT: |
| 871 | while (priv != NULL) { | 869 | for (;;) { |
| 872 | interruptible_sleep_on(&priv->delta_msr_wait); | 870 | interruptible_sleep_on(&port->delta_msr_wait); |
| 873 | /* see if a signal did it */ | 871 | /* see if a signal did it */ |
| 874 | if (signal_pending(current)) | 872 | if (signal_pending(current)) |
| 875 | return -ERESTARTSYS; | 873 | return -ERESTARTSYS; |
| 876 | else { | 874 | |
| 875 | if (port->serial->disconnected) | ||
| 876 | return -EIO; | ||
| 877 | |||
| 878 | { | ||
| 877 | char diff = priv->diff_status; | 879 | char diff = priv->diff_status; |
| 878 | if (diff == 0) | 880 | if (diff == 0) |
| 879 | return -EIO; /* no change => error */ | 881 | return -EIO; /* no change => error */ |
| @@ -1187,7 +1189,7 @@ static void cypress_read_int_callback(struct urb *urb) | |||
| 1187 | if (priv->current_status != priv->prev_status) { | 1189 | if (priv->current_status != priv->prev_status) { |
| 1188 | priv->diff_status |= priv->current_status ^ | 1190 | priv->diff_status |= priv->current_status ^ |
| 1189 | priv->prev_status; | 1191 | priv->prev_status; |
| 1190 | wake_up_interruptible(&priv->delta_msr_wait); | 1192 | wake_up_interruptible(&port->delta_msr_wait); |
| 1191 | priv->prev_status = priv->current_status; | 1193 | priv->prev_status = priv->current_status; |
| 1192 | } | 1194 | } |
| 1193 | spin_unlock_irqrestore(&priv->lock, flags); | 1195 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index b1b2dc64b50b..a172ad5c5ce8 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c | |||
| @@ -47,7 +47,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
| 47 | 47 | ||
| 48 | struct f81232_private { | 48 | struct f81232_private { |
| 49 | spinlock_t lock; | 49 | spinlock_t lock; |
| 50 | wait_queue_head_t delta_msr_wait; | ||
| 51 | u8 line_control; | 50 | u8 line_control; |
| 52 | u8 line_status; | 51 | u8 line_status; |
| 53 | }; | 52 | }; |
| @@ -111,7 +110,7 @@ static void f81232_process_read_urb(struct urb *urb) | |||
| 111 | line_status = priv->line_status; | 110 | line_status = priv->line_status; |
| 112 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 111 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
| 113 | spin_unlock_irqrestore(&priv->lock, flags); | 112 | spin_unlock_irqrestore(&priv->lock, flags); |
| 114 | wake_up_interruptible(&priv->delta_msr_wait); | 113 | wake_up_interruptible(&port->delta_msr_wait); |
| 115 | 114 | ||
| 116 | if (!urb->actual_length) | 115 | if (!urb->actual_length) |
| 117 | return; | 116 | return; |
| @@ -256,11 +255,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
| 256 | spin_unlock_irqrestore(&priv->lock, flags); | 255 | spin_unlock_irqrestore(&priv->lock, flags); |
| 257 | 256 | ||
| 258 | while (1) { | 257 | while (1) { |
| 259 | interruptible_sleep_on(&priv->delta_msr_wait); | 258 | interruptible_sleep_on(&port->delta_msr_wait); |
| 260 | /* see if a signal did it */ | 259 | /* see if a signal did it */ |
| 261 | if (signal_pending(current)) | 260 | if (signal_pending(current)) |
| 262 | return -ERESTARTSYS; | 261 | return -ERESTARTSYS; |
| 263 | 262 | ||
| 263 | if (port->serial->disconnected) | ||
| 264 | return -EIO; | ||
| 265 | |||
| 264 | spin_lock_irqsave(&priv->lock, flags); | 266 | spin_lock_irqsave(&priv->lock, flags); |
| 265 | status = priv->line_status; | 267 | status = priv->line_status; |
| 266 | spin_unlock_irqrestore(&priv->lock, flags); | 268 | spin_unlock_irqrestore(&priv->lock, flags); |
| @@ -322,7 +324,6 @@ static int f81232_port_probe(struct usb_serial_port *port) | |||
| 322 | return -ENOMEM; | 324 | return -ENOMEM; |
| 323 | 325 | ||
| 324 | spin_lock_init(&priv->lock); | 326 | spin_lock_init(&priv->lock); |
| 325 | init_waitqueue_head(&priv->delta_msr_wait); | ||
| 326 | 327 | ||
| 327 | usb_set_serial_port_data(port, priv); | 328 | usb_set_serial_port_data(port, priv); |
| 328 | 329 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index edd162df49ca..d4809d551473 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -69,9 +69,7 @@ struct ftdi_private { | |||
| 69 | int flags; /* some ASYNC_xxxx flags are supported */ | 69 | int flags; /* some ASYNC_xxxx flags are supported */ |
| 70 | unsigned long last_dtr_rts; /* saved modem control outputs */ | 70 | unsigned long last_dtr_rts; /* saved modem control outputs */ |
| 71 | struct async_icount icount; | 71 | struct async_icount icount; |
| 72 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
| 73 | char prev_status; /* Used for TIOCMIWAIT */ | 72 | char prev_status; /* Used for TIOCMIWAIT */ |
| 74 | bool dev_gone; /* Used to abort TIOCMIWAIT */ | ||
| 75 | char transmit_empty; /* If transmitter is empty or not */ | 73 | char transmit_empty; /* If transmitter is empty or not */ |
| 76 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface | 74 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface |
| 77 | (0 for FT232/245) */ | 75 | (0 for FT232/245) */ |
| @@ -1691,10 +1689,8 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) | |||
| 1691 | 1689 | ||
| 1692 | kref_init(&priv->kref); | 1690 | kref_init(&priv->kref); |
| 1693 | mutex_init(&priv->cfg_lock); | 1691 | mutex_init(&priv->cfg_lock); |
| 1694 | init_waitqueue_head(&priv->delta_msr_wait); | ||
| 1695 | 1692 | ||
| 1696 | priv->flags = ASYNC_LOW_LATENCY; | 1693 | priv->flags = ASYNC_LOW_LATENCY; |
| 1697 | priv->dev_gone = false; | ||
| 1698 | 1694 | ||
| 1699 | if (quirk && quirk->port_probe) | 1695 | if (quirk && quirk->port_probe) |
| 1700 | quirk->port_probe(priv); | 1696 | quirk->port_probe(priv); |
| @@ -1840,8 +1836,7 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port) | |||
| 1840 | { | 1836 | { |
| 1841 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1837 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
| 1842 | 1838 | ||
| 1843 | priv->dev_gone = true; | 1839 | wake_up_interruptible(&port->delta_msr_wait); |
| 1844 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
| 1845 | 1840 | ||
| 1846 | remove_sysfs_attrs(port); | 1841 | remove_sysfs_attrs(port); |
| 1847 | 1842 | ||
| @@ -1989,7 +1984,7 @@ static int ftdi_process_packet(struct usb_serial_port *port, | |||
| 1989 | if (diff_status & FTDI_RS0_RLSD) | 1984 | if (diff_status & FTDI_RS0_RLSD) |
| 1990 | priv->icount.dcd++; | 1985 | priv->icount.dcd++; |
| 1991 | 1986 | ||
| 1992 | wake_up_interruptible_all(&priv->delta_msr_wait); | 1987 | wake_up_interruptible(&port->delta_msr_wait); |
| 1993 | priv->prev_status = status; | 1988 | priv->prev_status = status; |
| 1994 | } | 1989 | } |
| 1995 | 1990 | ||
| @@ -2440,11 +2435,15 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
| 2440 | */ | 2435 | */ |
| 2441 | case TIOCMIWAIT: | 2436 | case TIOCMIWAIT: |
| 2442 | cprev = priv->icount; | 2437 | cprev = priv->icount; |
| 2443 | while (!priv->dev_gone) { | 2438 | for (;;) { |
| 2444 | interruptible_sleep_on(&priv->delta_msr_wait); | 2439 | interruptible_sleep_on(&port->delta_msr_wait); |
| 2445 | /* see if a signal did it */ | 2440 | /* see if a signal did it */ |
| 2446 | if (signal_pending(current)) | 2441 | if (signal_pending(current)) |
| 2447 | return -ERESTARTSYS; | 2442 | return -ERESTARTSYS; |
| 2443 | |||
| 2444 | if (port->serial->disconnected) | ||
| 2445 | return -EIO; | ||
| 2446 | |||
| 2448 | cnow = priv->icount; | 2447 | cnow = priv->icount; |
| 2449 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || | 2448 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
| 2450 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || | 2449 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
| @@ -2454,8 +2453,6 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
| 2454 | } | 2453 | } |
| 2455 | cprev = cnow; | 2454 | cprev = cnow; |
| 2456 | } | 2455 | } |
| 2457 | return -EIO; | ||
| 2458 | break; | ||
| 2459 | case TIOCSERGETLSR: | 2456 | case TIOCSERGETLSR: |
| 2460 | return get_lsr_info(port, (struct serial_struct __user *)arg); | 2457 | return get_lsr_info(port, (struct serial_struct __user *)arg); |
| 2461 | break; | 2458 | break; |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 1a07b12ef341..81caf5623ee2 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
| @@ -956,10 +956,7 @@ static void garmin_close(struct usb_serial_port *port) | |||
| 956 | if (!serial) | 956 | if (!serial) |
| 957 | return; | 957 | return; |
| 958 | 958 | ||
| 959 | mutex_lock(&port->serial->disc_mutex); | 959 | garmin_clear(garmin_data_p); |
| 960 | |||
| 961 | if (!port->serial->disconnected) | ||
| 962 | garmin_clear(garmin_data_p); | ||
| 963 | 960 | ||
| 964 | /* shutdown our urbs */ | 961 | /* shutdown our urbs */ |
| 965 | usb_kill_urb(port->read_urb); | 962 | usb_kill_urb(port->read_urb); |
| @@ -968,8 +965,6 @@ static void garmin_close(struct usb_serial_port *port) | |||
| 968 | /* keep reset state so we know that we must start a new session */ | 965 | /* keep reset state so we know that we must start a new session */ |
| 969 | if (garmin_data_p->state != STATE_RESET) | 966 | if (garmin_data_p->state != STATE_RESET) |
| 970 | garmin_data_p->state = STATE_DISCONNECTED; | 967 | garmin_data_p->state = STATE_DISCONNECTED; |
| 971 | |||
| 972 | mutex_unlock(&port->serial->disc_mutex); | ||
| 973 | } | 968 | } |
| 974 | 969 | ||
| 975 | 970 | ||
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index b00e5cbf741f..efd8b978128c 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
| @@ -110,7 +110,6 @@ struct edgeport_port { | |||
| 110 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 110 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
| 111 | wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */ | 111 | wait_queue_head_t wait_open; /* for handling sleeping while waiting for open to finish */ |
| 112 | wait_queue_head_t wait_command; /* for handling sleeping while waiting for command to finish */ | 112 | wait_queue_head_t wait_command; /* for handling sleeping while waiting for command to finish */ |
| 113 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ | ||
| 114 | 113 | ||
| 115 | struct async_icount icount; | 114 | struct async_icount icount; |
| 116 | struct usb_serial_port *port; /* loop back to the owner of this object */ | 115 | struct usb_serial_port *port; /* loop back to the owner of this object */ |
| @@ -884,7 +883,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
| 884 | /* initialize our wait queues */ | 883 | /* initialize our wait queues */ |
| 885 | init_waitqueue_head(&edge_port->wait_open); | 884 | init_waitqueue_head(&edge_port->wait_open); |
| 886 | init_waitqueue_head(&edge_port->wait_chase); | 885 | init_waitqueue_head(&edge_port->wait_chase); |
| 887 | init_waitqueue_head(&edge_port->delta_msr_wait); | ||
| 888 | init_waitqueue_head(&edge_port->wait_command); | 886 | init_waitqueue_head(&edge_port->wait_command); |
| 889 | 887 | ||
| 890 | /* initialize our icount structure */ | 888 | /* initialize our icount structure */ |
| @@ -1669,13 +1667,17 @@ static int edge_ioctl(struct tty_struct *tty, | |||
| 1669 | dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__, port->number); | 1667 | dev_dbg(&port->dev, "%s (%d) TIOCMIWAIT\n", __func__, port->number); |
| 1670 | cprev = edge_port->icount; | 1668 | cprev = edge_port->icount; |
| 1671 | while (1) { | 1669 | while (1) { |
| 1672 | prepare_to_wait(&edge_port->delta_msr_wait, | 1670 | prepare_to_wait(&port->delta_msr_wait, |
| 1673 | &wait, TASK_INTERRUPTIBLE); | 1671 | &wait, TASK_INTERRUPTIBLE); |
| 1674 | schedule(); | 1672 | schedule(); |
| 1675 | finish_wait(&edge_port->delta_msr_wait, &wait); | 1673 | finish_wait(&port->delta_msr_wait, &wait); |
| 1676 | /* see if a signal did it */ | 1674 | /* see if a signal did it */ |
| 1677 | if (signal_pending(current)) | 1675 | if (signal_pending(current)) |
| 1678 | return -ERESTARTSYS; | 1676 | return -ERESTARTSYS; |
| 1677 | |||
| 1678 | if (port->serial->disconnected) | ||
| 1679 | return -EIO; | ||
| 1680 | |||
| 1679 | cnow = edge_port->icount; | 1681 | cnow = edge_port->icount; |
| 1680 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 1682 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
| 1681 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 1683 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
| @@ -2051,7 +2053,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr) | |||
| 2051 | icount->dcd++; | 2053 | icount->dcd++; |
| 2052 | if (newMsr & EDGEPORT_MSR_DELTA_RI) | 2054 | if (newMsr & EDGEPORT_MSR_DELTA_RI) |
| 2053 | icount->rng++; | 2055 | icount->rng++; |
| 2054 | wake_up_interruptible(&edge_port->delta_msr_wait); | 2056 | wake_up_interruptible(&edge_port->port->delta_msr_wait); |
| 2055 | } | 2057 | } |
| 2056 | 2058 | ||
| 2057 | /* Save the new modem status */ | 2059 | /* Save the new modem status */ |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index c23776679f70..7777172206de 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
| @@ -87,9 +87,6 @@ struct edgeport_port { | |||
| 87 | int close_pending; | 87 | int close_pending; |
| 88 | int lsr_event; | 88 | int lsr_event; |
| 89 | struct async_icount icount; | 89 | struct async_icount icount; |
| 90 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while | ||
| 91 | waiting for msr change to | ||
| 92 | happen */ | ||
| 93 | struct edgeport_serial *edge_serial; | 90 | struct edgeport_serial *edge_serial; |
| 94 | struct usb_serial_port *port; | 91 | struct usb_serial_port *port; |
| 95 | __u8 bUartMode; /* Port type, 0: RS232, etc. */ | 92 | __u8 bUartMode; /* Port type, 0: RS232, etc. */ |
| @@ -1459,7 +1456,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr) | |||
| 1459 | icount->dcd++; | 1456 | icount->dcd++; |
| 1460 | if (msr & EDGEPORT_MSR_DELTA_RI) | 1457 | if (msr & EDGEPORT_MSR_DELTA_RI) |
| 1461 | icount->rng++; | 1458 | icount->rng++; |
| 1462 | wake_up_interruptible(&edge_port->delta_msr_wait); | 1459 | wake_up_interruptible(&edge_port->port->delta_msr_wait); |
| 1463 | } | 1460 | } |
| 1464 | 1461 | ||
| 1465 | /* Save the new modem status */ | 1462 | /* Save the new modem status */ |
| @@ -1754,7 +1751,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
| 1754 | dev = port->serial->dev; | 1751 | dev = port->serial->dev; |
| 1755 | 1752 | ||
| 1756 | memset(&(edge_port->icount), 0x00, sizeof(edge_port->icount)); | 1753 | memset(&(edge_port->icount), 0x00, sizeof(edge_port->icount)); |
| 1757 | init_waitqueue_head(&edge_port->delta_msr_wait); | ||
| 1758 | 1754 | ||
| 1759 | /* turn off loopback */ | 1755 | /* turn off loopback */ |
| 1760 | status = ti_do_config(edge_port, UMPC_SET_CLR_LOOPBACK, 0); | 1756 | status = ti_do_config(edge_port, UMPC_SET_CLR_LOOPBACK, 0); |
| @@ -2434,10 +2430,14 @@ static int edge_ioctl(struct tty_struct *tty, | |||
| 2434 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); | 2430 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); |
| 2435 | cprev = edge_port->icount; | 2431 | cprev = edge_port->icount; |
| 2436 | while (1) { | 2432 | while (1) { |
| 2437 | interruptible_sleep_on(&edge_port->delta_msr_wait); | 2433 | interruptible_sleep_on(&port->delta_msr_wait); |
| 2438 | /* see if a signal did it */ | 2434 | /* see if a signal did it */ |
| 2439 | if (signal_pending(current)) | 2435 | if (signal_pending(current)) |
| 2440 | return -ERESTARTSYS; | 2436 | return -ERESTARTSYS; |
| 2437 | |||
| 2438 | if (port->serial->disconnected) | ||
| 2439 | return -EIO; | ||
| 2440 | |||
| 2441 | cnow = edge_port->icount; | 2441 | cnow = edge_port->icount; |
| 2442 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 2442 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
| 2443 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 2443 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
| @@ -2649,6 +2649,7 @@ static struct usb_serial_driver edgeport_2port_device = { | |||
| 2649 | .set_termios = edge_set_termios, | 2649 | .set_termios = edge_set_termios, |
| 2650 | .tiocmget = edge_tiocmget, | 2650 | .tiocmget = edge_tiocmget, |
| 2651 | .tiocmset = edge_tiocmset, | 2651 | .tiocmset = edge_tiocmset, |
| 2652 | .get_icount = edge_get_icount, | ||
| 2652 | .write = edge_write, | 2653 | .write = edge_write, |
| 2653 | .write_room = edge_write_room, | 2654 | .write_room = edge_write_room, |
| 2654 | .chars_in_buffer = edge_chars_in_buffer, | 2655 | .chars_in_buffer = edge_chars_in_buffer, |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index a64d420f687b..06d5a60be2c4 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
| @@ -114,8 +114,6 @@ struct mct_u232_private { | |||
| 114 | unsigned char last_msr; /* Modem Status Register */ | 114 | unsigned char last_msr; /* Modem Status Register */ |
| 115 | unsigned int rx_flags; /* Throttling flags */ | 115 | unsigned int rx_flags; /* Throttling flags */ |
| 116 | struct async_icount icount; | 116 | struct async_icount icount; |
| 117 | wait_queue_head_t msr_wait; /* for handling sleeping while waiting | ||
| 118 | for msr change to happen */ | ||
| 119 | }; | 117 | }; |
| 120 | 118 | ||
| 121 | #define THROTTLED 0x01 | 119 | #define THROTTLED 0x01 |
| @@ -409,7 +407,6 @@ static int mct_u232_port_probe(struct usb_serial_port *port) | |||
| 409 | return -ENOMEM; | 407 | return -ENOMEM; |
| 410 | 408 | ||
| 411 | spin_lock_init(&priv->lock); | 409 | spin_lock_init(&priv->lock); |
| 412 | init_waitqueue_head(&priv->msr_wait); | ||
| 413 | 410 | ||
| 414 | usb_set_serial_port_data(port, priv); | 411 | usb_set_serial_port_data(port, priv); |
| 415 | 412 | ||
| @@ -601,7 +598,7 @@ static void mct_u232_read_int_callback(struct urb *urb) | |||
| 601 | tty_kref_put(tty); | 598 | tty_kref_put(tty); |
| 602 | } | 599 | } |
| 603 | #endif | 600 | #endif |
| 604 | wake_up_interruptible(&priv->msr_wait); | 601 | wake_up_interruptible(&port->delta_msr_wait); |
| 605 | spin_unlock_irqrestore(&priv->lock, flags); | 602 | spin_unlock_irqrestore(&priv->lock, flags); |
| 606 | exit: | 603 | exit: |
| 607 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 604 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
| @@ -810,13 +807,17 @@ static int mct_u232_ioctl(struct tty_struct *tty, | |||
| 810 | cprev = mct_u232_port->icount; | 807 | cprev = mct_u232_port->icount; |
| 811 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); | 808 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); |
| 812 | for ( ; ; ) { | 809 | for ( ; ; ) { |
| 813 | prepare_to_wait(&mct_u232_port->msr_wait, | 810 | prepare_to_wait(&port->delta_msr_wait, |
| 814 | &wait, TASK_INTERRUPTIBLE); | 811 | &wait, TASK_INTERRUPTIBLE); |
| 815 | schedule(); | 812 | schedule(); |
| 816 | finish_wait(&mct_u232_port->msr_wait, &wait); | 813 | finish_wait(&port->delta_msr_wait, &wait); |
| 817 | /* see if a signal did it */ | 814 | /* see if a signal did it */ |
| 818 | if (signal_pending(current)) | 815 | if (signal_pending(current)) |
| 819 | return -ERESTARTSYS; | 816 | return -ERESTARTSYS; |
| 817 | |||
| 818 | if (port->serial->disconnected) | ||
| 819 | return -EIO; | ||
| 820 | |||
| 820 | spin_lock_irqsave(&mct_u232_port->lock, flags); | 821 | spin_lock_irqsave(&mct_u232_port->lock, flags); |
| 821 | cnow = mct_u232_port->icount; | 822 | cnow = mct_u232_port->icount; |
| 822 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); | 823 | spin_unlock_irqrestore(&mct_u232_port->lock, flags); |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 809fb329eca5..b8051fa61911 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
| @@ -219,7 +219,6 @@ struct moschip_port { | |||
| 219 | char open; | 219 | char open; |
| 220 | char open_ports; | 220 | char open_ports; |
| 221 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 221 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
| 222 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ | ||
| 223 | int delta_msr_cond; | 222 | int delta_msr_cond; |
| 224 | struct async_icount icount; | 223 | struct async_icount icount; |
| 225 | struct usb_serial_port *port; /* loop back to the owner of this object */ | 224 | struct usb_serial_port *port; /* loop back to the owner of this object */ |
| @@ -423,6 +422,9 @@ static void mos7840_handle_new_msr(struct moschip_port *port, __u8 new_msr) | |||
| 423 | icount->rng++; | 422 | icount->rng++; |
| 424 | smp_wmb(); | 423 | smp_wmb(); |
| 425 | } | 424 | } |
| 425 | |||
| 426 | mos7840_port->delta_msr_cond = 1; | ||
| 427 | wake_up_interruptible(&port->port->delta_msr_wait); | ||
| 426 | } | 428 | } |
| 427 | } | 429 | } |
| 428 | 430 | ||
| @@ -1127,7 +1129,6 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
| 1127 | 1129 | ||
| 1128 | /* initialize our wait queues */ | 1130 | /* initialize our wait queues */ |
| 1129 | init_waitqueue_head(&mos7840_port->wait_chase); | 1131 | init_waitqueue_head(&mos7840_port->wait_chase); |
| 1130 | init_waitqueue_head(&mos7840_port->delta_msr_wait); | ||
| 1131 | 1132 | ||
| 1132 | /* initialize our icount structure */ | 1133 | /* initialize our icount structure */ |
| 1133 | memset(&(mos7840_port->icount), 0x00, sizeof(mos7840_port->icount)); | 1134 | memset(&(mos7840_port->icount), 0x00, sizeof(mos7840_port->icount)); |
| @@ -2017,8 +2018,6 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
| 2017 | mos7840_port->read_urb_busy = false; | 2018 | mos7840_port->read_urb_busy = false; |
| 2018 | } | 2019 | } |
| 2019 | } | 2020 | } |
| 2020 | wake_up(&mos7840_port->delta_msr_wait); | ||
| 2021 | mos7840_port->delta_msr_cond = 1; | ||
| 2022 | dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is End %x\n", __func__, | 2021 | dev_dbg(&port->dev, "%s - mos7840_port->shadowLCR is End %x\n", __func__, |
| 2023 | mos7840_port->shadowLCR); | 2022 | mos7840_port->shadowLCR); |
| 2024 | } | 2023 | } |
| @@ -2219,13 +2218,18 @@ static int mos7840_ioctl(struct tty_struct *tty, | |||
| 2219 | while (1) { | 2218 | while (1) { |
| 2220 | /* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */ | 2219 | /* interruptible_sleep_on(&mos7840_port->delta_msr_wait); */ |
| 2221 | mos7840_port->delta_msr_cond = 0; | 2220 | mos7840_port->delta_msr_cond = 0; |
| 2222 | wait_event_interruptible(mos7840_port->delta_msr_wait, | 2221 | wait_event_interruptible(port->delta_msr_wait, |
| 2223 | (mos7840_port-> | 2222 | (port->serial->disconnected || |
| 2223 | mos7840_port-> | ||
| 2224 | delta_msr_cond == 1)); | 2224 | delta_msr_cond == 1)); |
| 2225 | 2225 | ||
| 2226 | /* see if a signal did it */ | 2226 | /* see if a signal did it */ |
| 2227 | if (signal_pending(current)) | 2227 | if (signal_pending(current)) |
| 2228 | return -ERESTARTSYS; | 2228 | return -ERESTARTSYS; |
| 2229 | |||
| 2230 | if (port->serial->disconnected) | ||
| 2231 | return -EIO; | ||
| 2232 | |||
| 2229 | cnow = mos7840_port->icount; | 2233 | cnow = mos7840_port->icount; |
| 2230 | smp_rmb(); | 2234 | smp_rmb(); |
| 2231 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 2235 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index a958fd41b5b3..87c71ccfee87 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
| @@ -188,7 +188,6 @@ struct oti6858_private { | |||
| 188 | u8 setup_done; | 188 | u8 setup_done; |
| 189 | struct delayed_work delayed_setup_work; | 189 | struct delayed_work delayed_setup_work; |
| 190 | 190 | ||
| 191 | wait_queue_head_t intr_wait; | ||
| 192 | struct usb_serial_port *port; /* USB port with which associated */ | 191 | struct usb_serial_port *port; /* USB port with which associated */ |
| 193 | }; | 192 | }; |
| 194 | 193 | ||
| @@ -339,7 +338,6 @@ static int oti6858_port_probe(struct usb_serial_port *port) | |||
| 339 | return -ENOMEM; | 338 | return -ENOMEM; |
| 340 | 339 | ||
| 341 | spin_lock_init(&priv->lock); | 340 | spin_lock_init(&priv->lock); |
| 342 | init_waitqueue_head(&priv->intr_wait); | ||
| 343 | priv->port = port; | 341 | priv->port = port; |
| 344 | INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line); | 342 | INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line); |
| 345 | INIT_DELAYED_WORK(&priv->delayed_write_work, send_data); | 343 | INIT_DELAYED_WORK(&priv->delayed_write_work, send_data); |
| @@ -664,11 +662,15 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
| 664 | spin_unlock_irqrestore(&priv->lock, flags); | 662 | spin_unlock_irqrestore(&priv->lock, flags); |
| 665 | 663 | ||
| 666 | while (1) { | 664 | while (1) { |
| 667 | wait_event_interruptible(priv->intr_wait, | 665 | wait_event_interruptible(port->delta_msr_wait, |
| 666 | port->serial->disconnected || | ||
| 668 | priv->status.pin_state != prev); | 667 | priv->status.pin_state != prev); |
| 669 | if (signal_pending(current)) | 668 | if (signal_pending(current)) |
| 670 | return -ERESTARTSYS; | 669 | return -ERESTARTSYS; |
| 671 | 670 | ||
| 671 | if (port->serial->disconnected) | ||
| 672 | return -EIO; | ||
| 673 | |||
| 672 | spin_lock_irqsave(&priv->lock, flags); | 674 | spin_lock_irqsave(&priv->lock, flags); |
| 673 | status = priv->status.pin_state & PIN_MASK; | 675 | status = priv->status.pin_state & PIN_MASK; |
| 674 | spin_unlock_irqrestore(&priv->lock, flags); | 676 | spin_unlock_irqrestore(&priv->lock, flags); |
| @@ -763,7 +765,7 @@ static void oti6858_read_int_callback(struct urb *urb) | |||
| 763 | 765 | ||
| 764 | if (!priv->transient) { | 766 | if (!priv->transient) { |
| 765 | if (xs->pin_state != priv->status.pin_state) | 767 | if (xs->pin_state != priv->status.pin_state) |
| 766 | wake_up_interruptible(&priv->intr_wait); | 768 | wake_up_interruptible(&port->delta_msr_wait); |
| 767 | memcpy(&priv->status, xs, OTI6858_CTRL_PKT_SIZE); | 769 | memcpy(&priv->status, xs, OTI6858_CTRL_PKT_SIZE); |
| 768 | } | 770 | } |
| 769 | 771 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 54adc9125e5c..3b10018d89a3 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
| @@ -139,7 +139,6 @@ struct pl2303_serial_private { | |||
| 139 | 139 | ||
| 140 | struct pl2303_private { | 140 | struct pl2303_private { |
| 141 | spinlock_t lock; | 141 | spinlock_t lock; |
| 142 | wait_queue_head_t delta_msr_wait; | ||
| 143 | u8 line_control; | 142 | u8 line_control; |
| 144 | u8 line_status; | 143 | u8 line_status; |
| 145 | }; | 144 | }; |
| @@ -233,7 +232,6 @@ static int pl2303_port_probe(struct usb_serial_port *port) | |||
| 233 | return -ENOMEM; | 232 | return -ENOMEM; |
| 234 | 233 | ||
| 235 | spin_lock_init(&priv->lock); | 234 | spin_lock_init(&priv->lock); |
| 236 | init_waitqueue_head(&priv->delta_msr_wait); | ||
| 237 | 235 | ||
| 238 | usb_set_serial_port_data(port, priv); | 236 | usb_set_serial_port_data(port, priv); |
| 239 | 237 | ||
| @@ -607,11 +605,14 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
| 607 | spin_unlock_irqrestore(&priv->lock, flags); | 605 | spin_unlock_irqrestore(&priv->lock, flags); |
| 608 | 606 | ||
| 609 | while (1) { | 607 | while (1) { |
| 610 | interruptible_sleep_on(&priv->delta_msr_wait); | 608 | interruptible_sleep_on(&port->delta_msr_wait); |
| 611 | /* see if a signal did it */ | 609 | /* see if a signal did it */ |
| 612 | if (signal_pending(current)) | 610 | if (signal_pending(current)) |
| 613 | return -ERESTARTSYS; | 611 | return -ERESTARTSYS; |
| 614 | 612 | ||
| 613 | if (port->serial->disconnected) | ||
| 614 | return -EIO; | ||
| 615 | |||
| 615 | spin_lock_irqsave(&priv->lock, flags); | 616 | spin_lock_irqsave(&priv->lock, flags); |
| 616 | status = priv->line_status; | 617 | status = priv->line_status; |
| 617 | spin_unlock_irqrestore(&priv->lock, flags); | 618 | spin_unlock_irqrestore(&priv->lock, flags); |
| @@ -719,7 +720,7 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
| 719 | spin_unlock_irqrestore(&priv->lock, flags); | 720 | spin_unlock_irqrestore(&priv->lock, flags); |
| 720 | if (priv->line_status & UART_BREAK_ERROR) | 721 | if (priv->line_status & UART_BREAK_ERROR) |
| 721 | usb_serial_handle_break(port); | 722 | usb_serial_handle_break(port); |
| 722 | wake_up_interruptible(&priv->delta_msr_wait); | 723 | wake_up_interruptible(&port->delta_msr_wait); |
| 723 | 724 | ||
| 724 | tty = tty_port_tty_get(&port->port); | 725 | tty = tty_port_tty_get(&port->port); |
| 725 | if (!tty) | 726 | if (!tty) |
| @@ -783,7 +784,7 @@ static void pl2303_process_read_urb(struct urb *urb) | |||
| 783 | line_status = priv->line_status; | 784 | line_status = priv->line_status; |
| 784 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 785 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
| 785 | spin_unlock_irqrestore(&priv->lock, flags); | 786 | spin_unlock_irqrestore(&priv->lock, flags); |
| 786 | wake_up_interruptible(&priv->delta_msr_wait); | 787 | wake_up_interruptible(&port->delta_msr_wait); |
| 787 | 788 | ||
| 788 | if (!urb->actual_length) | 789 | if (!urb->actual_length) |
| 789 | return; | 790 | return; |
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index d643a4d4d770..75f125ddb0c9 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c | |||
| @@ -128,7 +128,6 @@ struct qt2_port_private { | |||
| 128 | u8 shadowLSR; | 128 | u8 shadowLSR; |
| 129 | u8 shadowMSR; | 129 | u8 shadowMSR; |
| 130 | 130 | ||
| 131 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
| 132 | struct async_icount icount; | 131 | struct async_icount icount; |
| 133 | 132 | ||
| 134 | struct usb_serial_port *port; | 133 | struct usb_serial_port *port; |
| @@ -506,8 +505,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
| 506 | spin_unlock_irqrestore(&priv->lock, flags); | 505 | spin_unlock_irqrestore(&priv->lock, flags); |
| 507 | 506 | ||
| 508 | while (1) { | 507 | while (1) { |
| 509 | wait_event_interruptible(priv->delta_msr_wait, | 508 | wait_event_interruptible(port->delta_msr_wait, |
| 510 | ((priv->icount.rng != prev.rng) || | 509 | (port->serial->disconnected || |
| 510 | (priv->icount.rng != prev.rng) || | ||
| 511 | (priv->icount.dsr != prev.dsr) || | 511 | (priv->icount.dsr != prev.dsr) || |
| 512 | (priv->icount.dcd != prev.dcd) || | 512 | (priv->icount.dcd != prev.dcd) || |
| 513 | (priv->icount.cts != prev.cts))); | 513 | (priv->icount.cts != prev.cts))); |
| @@ -515,6 +515,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
| 515 | if (signal_pending(current)) | 515 | if (signal_pending(current)) |
| 516 | return -ERESTARTSYS; | 516 | return -ERESTARTSYS; |
| 517 | 517 | ||
| 518 | if (port->serial->disconnected) | ||
| 519 | return -EIO; | ||
| 520 | |||
| 518 | spin_lock_irqsave(&priv->lock, flags); | 521 | spin_lock_irqsave(&priv->lock, flags); |
| 519 | cur = priv->icount; | 522 | cur = priv->icount; |
| 520 | spin_unlock_irqrestore(&priv->lock, flags); | 523 | spin_unlock_irqrestore(&priv->lock, flags); |
| @@ -827,7 +830,6 @@ static int qt2_port_probe(struct usb_serial_port *port) | |||
| 827 | 830 | ||
| 828 | spin_lock_init(&port_priv->lock); | 831 | spin_lock_init(&port_priv->lock); |
| 829 | spin_lock_init(&port_priv->urb_lock); | 832 | spin_lock_init(&port_priv->urb_lock); |
| 830 | init_waitqueue_head(&port_priv->delta_msr_wait); | ||
| 831 | port_priv->port = port; | 833 | port_priv->port = port; |
| 832 | 834 | ||
| 833 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); | 835 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); |
| @@ -970,7 +972,7 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch) | |||
| 970 | if (newMSR & UART_MSR_TERI) | 972 | if (newMSR & UART_MSR_TERI) |
| 971 | port_priv->icount.rng++; | 973 | port_priv->icount.rng++; |
| 972 | 974 | ||
| 973 | wake_up_interruptible(&port_priv->delta_msr_wait); | 975 | wake_up_interruptible(&port->delta_msr_wait); |
| 974 | } | 976 | } |
| 975 | } | 977 | } |
| 976 | 978 | ||
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 91ff8e3bddbd..549ef68ff5fa 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
| @@ -149,7 +149,6 @@ enum spcp8x5_type { | |||
| 149 | struct spcp8x5_private { | 149 | struct spcp8x5_private { |
| 150 | spinlock_t lock; | 150 | spinlock_t lock; |
| 151 | enum spcp8x5_type type; | 151 | enum spcp8x5_type type; |
| 152 | wait_queue_head_t delta_msr_wait; | ||
| 153 | u8 line_control; | 152 | u8 line_control; |
| 154 | u8 line_status; | 153 | u8 line_status; |
| 155 | }; | 154 | }; |
| @@ -179,7 +178,6 @@ static int spcp8x5_port_probe(struct usb_serial_port *port) | |||
| 179 | return -ENOMEM; | 178 | return -ENOMEM; |
| 180 | 179 | ||
| 181 | spin_lock_init(&priv->lock); | 180 | spin_lock_init(&priv->lock); |
| 182 | init_waitqueue_head(&priv->delta_msr_wait); | ||
| 183 | priv->type = type; | 181 | priv->type = type; |
| 184 | 182 | ||
| 185 | usb_set_serial_port_data(port , priv); | 183 | usb_set_serial_port_data(port , priv); |
| @@ -475,7 +473,7 @@ static void spcp8x5_process_read_urb(struct urb *urb) | |||
| 475 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | 473 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; |
| 476 | spin_unlock_irqrestore(&priv->lock, flags); | 474 | spin_unlock_irqrestore(&priv->lock, flags); |
| 477 | /* wake up the wait for termios */ | 475 | /* wake up the wait for termios */ |
| 478 | wake_up_interruptible(&priv->delta_msr_wait); | 476 | wake_up_interruptible(&port->delta_msr_wait); |
| 479 | 477 | ||
| 480 | if (!urb->actual_length) | 478 | if (!urb->actual_length) |
| 481 | return; | 479 | return; |
| @@ -526,12 +524,15 @@ static int spcp8x5_wait_modem_info(struct usb_serial_port *port, | |||
| 526 | 524 | ||
| 527 | while (1) { | 525 | while (1) { |
| 528 | /* wake up in bulk read */ | 526 | /* wake up in bulk read */ |
| 529 | interruptible_sleep_on(&priv->delta_msr_wait); | 527 | interruptible_sleep_on(&port->delta_msr_wait); |
| 530 | 528 | ||
| 531 | /* see if a signal did it */ | 529 | /* see if a signal did it */ |
| 532 | if (signal_pending(current)) | 530 | if (signal_pending(current)) |
| 533 | return -ERESTARTSYS; | 531 | return -ERESTARTSYS; |
| 534 | 532 | ||
| 533 | if (port->serial->disconnected) | ||
| 534 | return -EIO; | ||
| 535 | |||
| 535 | spin_lock_irqsave(&priv->lock, flags); | 536 | spin_lock_irqsave(&priv->lock, flags); |
| 536 | status = priv->line_status; | 537 | status = priv->line_status; |
| 537 | spin_unlock_irqrestore(&priv->lock, flags); | 538 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index b57cf841c5b6..4b2a19757b4d 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
| @@ -61,7 +61,6 @@ struct ssu100_port_private { | |||
| 61 | spinlock_t status_lock; | 61 | spinlock_t status_lock; |
| 62 | u8 shadowLSR; | 62 | u8 shadowLSR; |
| 63 | u8 shadowMSR; | 63 | u8 shadowMSR; |
| 64 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | ||
| 65 | struct async_icount icount; | 64 | struct async_icount icount; |
| 66 | }; | 65 | }; |
| 67 | 66 | ||
| @@ -355,8 +354,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
| 355 | spin_unlock_irqrestore(&priv->status_lock, flags); | 354 | spin_unlock_irqrestore(&priv->status_lock, flags); |
| 356 | 355 | ||
| 357 | while (1) { | 356 | while (1) { |
| 358 | wait_event_interruptible(priv->delta_msr_wait, | 357 | wait_event_interruptible(port->delta_msr_wait, |
| 359 | ((priv->icount.rng != prev.rng) || | 358 | (port->serial->disconnected || |
| 359 | (priv->icount.rng != prev.rng) || | ||
| 360 | (priv->icount.dsr != prev.dsr) || | 360 | (priv->icount.dsr != prev.dsr) || |
| 361 | (priv->icount.dcd != prev.dcd) || | 361 | (priv->icount.dcd != prev.dcd) || |
| 362 | (priv->icount.cts != prev.cts))); | 362 | (priv->icount.cts != prev.cts))); |
| @@ -364,6 +364,9 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
| 364 | if (signal_pending(current)) | 364 | if (signal_pending(current)) |
| 365 | return -ERESTARTSYS; | 365 | return -ERESTARTSYS; |
| 366 | 366 | ||
| 367 | if (port->serial->disconnected) | ||
| 368 | return -EIO; | ||
| 369 | |||
| 367 | spin_lock_irqsave(&priv->status_lock, flags); | 370 | spin_lock_irqsave(&priv->status_lock, flags); |
| 368 | cur = priv->icount; | 371 | cur = priv->icount; |
| 369 | spin_unlock_irqrestore(&priv->status_lock, flags); | 372 | spin_unlock_irqrestore(&priv->status_lock, flags); |
| @@ -445,7 +448,6 @@ static int ssu100_port_probe(struct usb_serial_port *port) | |||
| 445 | return -ENOMEM; | 448 | return -ENOMEM; |
| 446 | 449 | ||
| 447 | spin_lock_init(&priv->status_lock); | 450 | spin_lock_init(&priv->status_lock); |
| 448 | init_waitqueue_head(&priv->delta_msr_wait); | ||
| 449 | 451 | ||
| 450 | usb_set_serial_port_data(port, priv); | 452 | usb_set_serial_port_data(port, priv); |
| 451 | 453 | ||
| @@ -537,7 +539,7 @@ static void ssu100_update_msr(struct usb_serial_port *port, u8 msr) | |||
| 537 | priv->icount.dcd++; | 539 | priv->icount.dcd++; |
| 538 | if (msr & UART_MSR_TERI) | 540 | if (msr & UART_MSR_TERI) |
| 539 | priv->icount.rng++; | 541 | priv->icount.rng++; |
| 540 | wake_up_interruptible(&priv->delta_msr_wait); | 542 | wake_up_interruptible(&port->delta_msr_wait); |
| 541 | } | 543 | } |
| 542 | } | 544 | } |
| 543 | 545 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 39cb9b807c3c..73deb029fc05 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
| @@ -74,7 +74,6 @@ struct ti_port { | |||
| 74 | int tp_flags; | 74 | int tp_flags; |
| 75 | int tp_closing_wait;/* in .01 secs */ | 75 | int tp_closing_wait;/* in .01 secs */ |
| 76 | struct async_icount tp_icount; | 76 | struct async_icount tp_icount; |
| 77 | wait_queue_head_t tp_msr_wait; /* wait for msr change */ | ||
| 78 | wait_queue_head_t tp_write_wait; | 77 | wait_queue_head_t tp_write_wait; |
| 79 | struct ti_device *tp_tdev; | 78 | struct ti_device *tp_tdev; |
| 80 | struct usb_serial_port *tp_port; | 79 | struct usb_serial_port *tp_port; |
| @@ -432,7 +431,6 @@ static int ti_port_probe(struct usb_serial_port *port) | |||
| 432 | else | 431 | else |
| 433 | tport->tp_uart_base_addr = TI_UART2_BASE_ADDR; | 432 | tport->tp_uart_base_addr = TI_UART2_BASE_ADDR; |
| 434 | tport->tp_closing_wait = closing_wait; | 433 | tport->tp_closing_wait = closing_wait; |
| 435 | init_waitqueue_head(&tport->tp_msr_wait); | ||
| 436 | init_waitqueue_head(&tport->tp_write_wait); | 434 | init_waitqueue_head(&tport->tp_write_wait); |
| 437 | if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, GFP_KERNEL)) { | 435 | if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, GFP_KERNEL)) { |
| 438 | kfree(tport); | 436 | kfree(tport); |
| @@ -784,9 +782,13 @@ static int ti_ioctl(struct tty_struct *tty, | |||
| 784 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); | 782 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); |
| 785 | cprev = tport->tp_icount; | 783 | cprev = tport->tp_icount; |
| 786 | while (1) { | 784 | while (1) { |
| 787 | interruptible_sleep_on(&tport->tp_msr_wait); | 785 | interruptible_sleep_on(&port->delta_msr_wait); |
| 788 | if (signal_pending(current)) | 786 | if (signal_pending(current)) |
| 789 | return -ERESTARTSYS; | 787 | return -ERESTARTSYS; |
| 788 | |||
| 789 | if (port->serial->disconnected) | ||
| 790 | return -EIO; | ||
| 791 | |||
| 790 | cnow = tport->tp_icount; | 792 | cnow = tport->tp_icount; |
| 791 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 793 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
| 792 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 794 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
| @@ -1392,7 +1394,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr) | |||
| 1392 | icount->dcd++; | 1394 | icount->dcd++; |
| 1393 | if (msr & TI_MSR_DELTA_RI) | 1395 | if (msr & TI_MSR_DELTA_RI) |
| 1394 | icount->rng++; | 1396 | icount->rng++; |
| 1395 | wake_up_interruptible(&tport->tp_msr_wait); | 1397 | wake_up_interruptible(&tport->tp_port->delta_msr_wait); |
| 1396 | spin_unlock_irqrestore(&tport->tp_lock, flags); | 1398 | spin_unlock_irqrestore(&tport->tp_lock, flags); |
| 1397 | } | 1399 | } |
| 1398 | 1400 | ||
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a19ed74d770d..2e70efa08b77 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
| @@ -151,6 +151,7 @@ static void destroy_serial(struct kref *kref) | |||
| 151 | } | 151 | } |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | usb_put_intf(serial->interface); | ||
| 154 | usb_put_dev(serial->dev); | 155 | usb_put_dev(serial->dev); |
| 155 | kfree(serial); | 156 | kfree(serial); |
| 156 | } | 157 | } |
| @@ -620,7 +621,7 @@ static struct usb_serial *create_serial(struct usb_device *dev, | |||
| 620 | } | 621 | } |
| 621 | serial->dev = usb_get_dev(dev); | 622 | serial->dev = usb_get_dev(dev); |
| 622 | serial->type = driver; | 623 | serial->type = driver; |
| 623 | serial->interface = interface; | 624 | serial->interface = usb_get_intf(interface); |
| 624 | kref_init(&serial->kref); | 625 | kref_init(&serial->kref); |
| 625 | mutex_init(&serial->disc_mutex); | 626 | mutex_init(&serial->disc_mutex); |
| 626 | serial->minor = SERIAL_TTY_NO_MINOR; | 627 | serial->minor = SERIAL_TTY_NO_MINOR; |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index da04a074e790..1799335288bd 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
| @@ -496,6 +496,13 @@ UNUSUAL_DEV( 0x04e8, 0x5122, 0x0000, 0x9999, | |||
| 496 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 496 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
| 497 | US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), | 497 | US_FL_MAX_SECTORS_64 | US_FL_BULK_IGNORE_TAG), |
| 498 | 498 | ||
| 499 | /* Added by Dmitry Artamonow <mad_soft@inbox.ru> */ | ||
| 500 | UNUSUAL_DEV( 0x04e8, 0x5136, 0x0000, 0x9999, | ||
| 501 | "Samsung", | ||
| 502 | "YP-Z3", | ||
| 503 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
| 504 | US_FL_MAX_SECTORS_64), | ||
| 505 | |||
| 499 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. | 506 | /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. |
| 500 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and | 507 | * Device uses standards-violating 32-byte Bulk Command Block Wrappers and |
| 501 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. | 508 | * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index ef9be7e1e190..1819b59aab2a 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
| @@ -66,6 +66,7 @@ | |||
| 66 | * port. | 66 | * port. |
| 67 | * @flags: usb serial port flags | 67 | * @flags: usb serial port flags |
| 68 | * @write_wait: a wait_queue_head_t used by the port. | 68 | * @write_wait: a wait_queue_head_t used by the port. |
| 69 | * @delta_msr_wait: modem-status-change wait queue | ||
| 69 | * @work: work queue entry for the line discipline waking up. | 70 | * @work: work queue entry for the line discipline waking up. |
| 70 | * @throttled: nonzero if the read urb is inactive to throttle the device | 71 | * @throttled: nonzero if the read urb is inactive to throttle the device |
| 71 | * @throttle_req: nonzero if the tty wants to throttle us | 72 | * @throttle_req: nonzero if the tty wants to throttle us |
| @@ -112,6 +113,7 @@ struct usb_serial_port { | |||
| 112 | 113 | ||
| 113 | unsigned long flags; | 114 | unsigned long flags; |
| 114 | wait_queue_head_t write_wait; | 115 | wait_queue_head_t write_wait; |
| 116 | wait_queue_head_t delta_msr_wait; | ||
| 115 | struct work_struct work; | 117 | struct work_struct work; |
| 116 | char throttled; | 118 | char throttled; |
| 117 | char throttle_req; | 119 | char throttle_req; |
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h index 6f033a415ecb..5c295c26ad37 100644 --- a/include/linux/usb/ulpi.h +++ b/include/linux/usb/ulpi.h | |||
| @@ -181,8 +181,16 @@ | |||
| 181 | 181 | ||
| 182 | /*-------------------------------------------------------------------------*/ | 182 | /*-------------------------------------------------------------------------*/ |
| 183 | 183 | ||
| 184 | #if IS_ENABLED(CONFIG_USB_ULPI) | ||
| 184 | struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, | 185 | struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, |
| 185 | unsigned int flags); | 186 | unsigned int flags); |
| 187 | #else | ||
| 188 | static inline struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, | ||
| 189 | unsigned int flags) | ||
| 190 | { | ||
| 191 | return NULL; | ||
| 192 | } | ||
| 193 | #endif | ||
| 186 | 194 | ||
| 187 | #ifdef CONFIG_USB_ULPI_VIEWPORT | 195 | #ifdef CONFIG_USB_ULPI_VIEWPORT |
| 188 | /* access ops for controllers with a viewport register */ | 196 | /* access ops for controllers with a viewport register */ |
