diff options
Diffstat (limited to 'drivers/usb')
63 files changed, 1406 insertions, 1401 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 981f2132d128..6e49ec6f3adc 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -817,10 +817,6 @@ static const __u32 acm_tty_speed[] = { | |||
| 817 | 2500000, 3000000, 3500000, 4000000 | 817 | 2500000, 3000000, 3500000, 4000000 |
| 818 | }; | 818 | }; |
| 819 | 819 | ||
| 820 | static const __u8 acm_tty_size[] = { | ||
| 821 | 5, 6, 7, 8 | ||
| 822 | }; | ||
| 823 | |||
| 824 | static void acm_tty_set_termios(struct tty_struct *tty, | 820 | static void acm_tty_set_termios(struct tty_struct *tty, |
| 825 | struct ktermios *termios_old) | 821 | struct ktermios *termios_old) |
| 826 | { | 822 | { |
| @@ -834,7 +830,21 @@ static void acm_tty_set_termios(struct tty_struct *tty, | |||
| 834 | newline.bParityType = termios->c_cflag & PARENB ? | 830 | newline.bParityType = termios->c_cflag & PARENB ? |
| 835 | (termios->c_cflag & PARODD ? 1 : 2) + | 831 | (termios->c_cflag & PARODD ? 1 : 2) + |
| 836 | (termios->c_cflag & CMSPAR ? 2 : 0) : 0; | 832 | (termios->c_cflag & CMSPAR ? 2 : 0) : 0; |
| 837 | newline.bDataBits = acm_tty_size[(termios->c_cflag & CSIZE) >> 4]; | 833 | switch (termios->c_cflag & CSIZE) { |
| 834 | case CS5: | ||
| 835 | newline.bDataBits = 5; | ||
| 836 | break; | ||
| 837 | case CS6: | ||
| 838 | newline.bDataBits = 6; | ||
| 839 | break; | ||
| 840 | case CS7: | ||
| 841 | newline.bDataBits = 7; | ||
| 842 | break; | ||
| 843 | case CS8: | ||
| 844 | default: | ||
| 845 | newline.bDataBits = 8; | ||
| 846 | break; | ||
| 847 | } | ||
| 838 | /* FIXME: Needs to clear unsupported bits in the termios */ | 848 | /* FIXME: Needs to clear unsupported bits in the termios */ |
| 839 | acm->clocal = ((termios->c_cflag & CLOCAL) != 0); | 849 | acm->clocal = ((termios->c_cflag & CLOCAL) != 0); |
| 840 | 850 | ||
| @@ -1233,7 +1243,7 @@ made_compressed_probe: | |||
| 1233 | 1243 | ||
| 1234 | if (usb_endpoint_xfer_int(epwrite)) | 1244 | if (usb_endpoint_xfer_int(epwrite)) |
| 1235 | usb_fill_int_urb(snd->urb, usb_dev, | 1245 | usb_fill_int_urb(snd->urb, usb_dev, |
| 1236 | usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), | 1246 | usb_sndintpipe(usb_dev, epwrite->bEndpointAddress), |
| 1237 | NULL, acm->writesize, acm_write_bulk, snd, epwrite->bInterval); | 1247 | NULL, acm->writesize, acm_write_bulk, snd, epwrite->bInterval); |
| 1238 | else | 1248 | else |
| 1239 | usb_fill_bulk_urb(snd->urb, usb_dev, | 1249 | usb_fill_bulk_urb(snd->urb, usb_dev, |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index e0356cb859b5..b78fbe222b72 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
| @@ -1348,6 +1348,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
| 1348 | ret = -EFAULT; | 1348 | ret = -EFAULT; |
| 1349 | goto error; | 1349 | goto error; |
| 1350 | } | 1350 | } |
| 1351 | uurb->buffer += u; | ||
| 1351 | } | 1352 | } |
| 1352 | totlen -= u; | 1353 | totlen -= u; |
| 1353 | } | 1354 | } |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index ddd820d25288..6056db7af410 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
| @@ -367,6 +367,10 @@ static int usb_probe_interface(struct device *dev) | |||
| 367 | intf->condition = USB_INTERFACE_UNBOUND; | 367 | intf->condition = USB_INTERFACE_UNBOUND; |
| 368 | usb_cancel_queued_reset(intf); | 368 | usb_cancel_queued_reset(intf); |
| 369 | 369 | ||
| 370 | /* If the LPM disable succeeded, balance the ref counts. */ | ||
| 371 | if (!lpm_disable_error) | ||
| 372 | usb_unlocked_enable_lpm(udev); | ||
| 373 | |||
| 370 | /* Unbound interfaces are always runtime-PM-disabled and -suspended */ | 374 | /* Unbound interfaces are always runtime-PM-disabled and -suspended */ |
| 371 | if (driver->supports_autosuspend) | 375 | if (driver->supports_autosuspend) |
| 372 | pm_runtime_disable(dev); | 376 | pm_runtime_disable(dev); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 673ee4696262..1af04bdeaf0c 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -739,13 +739,16 @@ static void hub_tt_work(struct work_struct *work) | |||
| 739 | int limit = 100; | 739 | int limit = 100; |
| 740 | 740 | ||
| 741 | spin_lock_irqsave (&hub->tt.lock, flags); | 741 | spin_lock_irqsave (&hub->tt.lock, flags); |
| 742 | while (--limit && !list_empty (&hub->tt.clear_list)) { | 742 | while (!list_empty(&hub->tt.clear_list)) { |
| 743 | struct list_head *next; | 743 | struct list_head *next; |
| 744 | struct usb_tt_clear *clear; | 744 | struct usb_tt_clear *clear; |
| 745 | struct usb_device *hdev = hub->hdev; | 745 | struct usb_device *hdev = hub->hdev; |
| 746 | const struct hc_driver *drv; | 746 | const struct hc_driver *drv; |
| 747 | int status; | 747 | int status; |
| 748 | 748 | ||
| 749 | if (!hub->quiescing && --limit < 0) | ||
| 750 | break; | ||
| 751 | |||
| 749 | next = hub->tt.clear_list.next; | 752 | next = hub->tt.clear_list.next; |
| 750 | clear = list_entry (next, struct usb_tt_clear, clear_list); | 753 | clear = list_entry (next, struct usb_tt_clear, clear_list); |
| 751 | list_del (&clear->clear_list); | 754 | list_del (&clear->clear_list); |
| @@ -1210,7 +1213,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type) | |||
| 1210 | if (hub->has_indicators) | 1213 | if (hub->has_indicators) |
| 1211 | cancel_delayed_work_sync(&hub->leds); | 1214 | cancel_delayed_work_sync(&hub->leds); |
| 1212 | if (hub->tt.hub) | 1215 | if (hub->tt.hub) |
| 1213 | cancel_work_sync(&hub->tt.clear_work); | 1216 | flush_work(&hub->tt.clear_work); |
| 1214 | } | 1217 | } |
| 1215 | 1218 | ||
| 1216 | /* caller has locked the hub device */ | 1219 | /* caller has locked the hub device */ |
| @@ -3241,8 +3244,7 @@ static int usb_req_set_sel(struct usb_device *udev, enum usb3_link_state state) | |||
| 3241 | (state == USB3_LPM_U2 && | 3244 | (state == USB3_LPM_U2 && |
| 3242 | (u2_sel > USB3_LPM_MAX_U2_SEL_PEL || | 3245 | (u2_sel > USB3_LPM_MAX_U2_SEL_PEL || |
| 3243 | u2_pel > USB3_LPM_MAX_U2_SEL_PEL))) { | 3246 | u2_pel > USB3_LPM_MAX_U2_SEL_PEL))) { |
| 3244 | dev_dbg(&udev->dev, "Device-initiated %s disabled due " | 3247 | dev_dbg(&udev->dev, "Device-initiated %s disabled due to long SEL %llu us or PEL %llu us\n", |
| 3245 | "to long SEL %llu ms or PEL %llu ms\n", | ||
| 3246 | usb3_lpm_names[state], u1_sel, u1_pel); | 3248 | usb3_lpm_names[state], u1_sel, u1_pel); |
| 3247 | return -EINVAL; | 3249 | return -EINVAL; |
| 3248 | } | 3250 | } |
| @@ -3320,16 +3322,6 @@ static int usb_set_device_initiated_lpm(struct usb_device *udev, | |||
| 3320 | 3322 | ||
| 3321 | if (enable) { | 3323 | if (enable) { |
| 3322 | /* | 3324 | /* |
| 3323 | * First, let the device know about the exit latencies | ||
| 3324 | * associated with the link state we're about to enable. | ||
| 3325 | */ | ||
| 3326 | ret = usb_req_set_sel(udev, state); | ||
| 3327 | if (ret < 0) { | ||
| 3328 | dev_warn(&udev->dev, "Set SEL for device-initiated " | ||
| 3329 | "%s failed.\n", usb3_lpm_names[state]); | ||
| 3330 | return -EBUSY; | ||
| 3331 | } | ||
| 3332 | /* | ||
| 3333 | * Now send the control transfer to enable device-initiated LPM | 3325 | * Now send the control transfer to enable device-initiated LPM |
| 3334 | * for either U1 or U2. | 3326 | * for either U1 or U2. |
| 3335 | */ | 3327 | */ |
| @@ -3414,7 +3406,28 @@ static int usb_set_lpm_timeout(struct usb_device *udev, | |||
| 3414 | static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev, | 3406 | static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev, |
| 3415 | enum usb3_link_state state) | 3407 | enum usb3_link_state state) |
| 3416 | { | 3408 | { |
| 3417 | int timeout; | 3409 | int timeout, ret; |
| 3410 | __u8 u1_mel = udev->bos->ss_cap->bU1devExitLat; | ||
| 3411 | __le16 u2_mel = udev->bos->ss_cap->bU2DevExitLat; | ||
| 3412 | |||
| 3413 | /* If the device says it doesn't have *any* exit latency to come out of | ||
| 3414 | * U1 or U2, it's probably lying. Assume it doesn't implement that link | ||
| 3415 | * state. | ||
| 3416 | */ | ||
| 3417 | if ((state == USB3_LPM_U1 && u1_mel == 0) || | ||
| 3418 | (state == USB3_LPM_U2 && u2_mel == 0)) | ||
| 3419 | return; | ||
| 3420 | |||
| 3421 | /* | ||
| 3422 | * First, let the device know about the exit latencies | ||
| 3423 | * associated with the link state we're about to enable. | ||
| 3424 | */ | ||
| 3425 | ret = usb_req_set_sel(udev, state); | ||
| 3426 | if (ret < 0) { | ||
| 3427 | dev_warn(&udev->dev, "Set SEL for device-initiated %s failed.\n", | ||
| 3428 | usb3_lpm_names[state]); | ||
| 3429 | return; | ||
| 3430 | } | ||
| 3418 | 3431 | ||
| 3419 | /* We allow the host controller to set the U1/U2 timeout internally | 3432 | /* We allow the host controller to set the U1/U2 timeout internally |
| 3420 | * first, so that it can change its schedule to account for the | 3433 | * first, so that it can change its schedule to account for the |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index b415c0c859d3..c14ebc975ba4 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
| @@ -409,6 +409,10 @@ static void dwc3_core_exit(struct dwc3 *dwc) | |||
| 409 | { | 409 | { |
| 410 | dwc3_event_buffers_cleanup(dwc); | 410 | dwc3_event_buffers_cleanup(dwc); |
| 411 | dwc3_free_event_buffers(dwc); | 411 | dwc3_free_event_buffers(dwc); |
| 412 | |||
| 413 | usb_phy_shutdown(dwc->usb2_phy); | ||
| 414 | usb_phy_shutdown(dwc->usb3_phy); | ||
| 415 | |||
| 412 | } | 416 | } |
| 413 | 417 | ||
| 414 | #define DWC3_ALIGN_MASK (16 - 1) | 418 | #define DWC3_ALIGN_MASK (16 - 1) |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index c9e729a4bf65..7b7deddf6a52 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
| @@ -1904,7 +1904,7 @@ static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum) | |||
| 1904 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, ¶ms); | 1904 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, ¶ms); |
| 1905 | WARN_ON_ONCE(ret); | 1905 | WARN_ON_ONCE(ret); |
| 1906 | dep->resource_index = 0; | 1906 | dep->resource_index = 0; |
| 1907 | 1907 | dep->flags &= ~DWC3_EP_BUSY; | |
| 1908 | udelay(100); | 1908 | udelay(100); |
| 1909 | } | 1909 | } |
| 1910 | 1910 | ||
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index dfb51a45496c..e0ff51b89529 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
| @@ -952,6 +952,7 @@ endif | |||
| 952 | config USB_G_WEBCAM | 952 | config USB_G_WEBCAM |
| 953 | tristate "USB Webcam Gadget" | 953 | tristate "USB Webcam Gadget" |
| 954 | depends on VIDEO_DEV | 954 | depends on VIDEO_DEV |
| 955 | select USB_LIBCOMPOSITE | ||
| 955 | help | 956 | help |
| 956 | The Webcam Gadget acts as a composite USB Audio and Video Class | 957 | The Webcam Gadget acts as a composite USB Audio and Video Class |
| 957 | device. It provides a userspace API to process UVC control requests | 958 | device. It provides a userspace API to process UVC control requests |
diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c index f696fb9b136d..21a9861dabf0 100644 --- a/drivers/usb/gadget/lpc32xx_udc.c +++ b/drivers/usb/gadget/lpc32xx_udc.c | |||
| @@ -2930,10 +2930,10 @@ static void vbus_work(struct work_struct *work) | |||
| 2930 | 2930 | ||
| 2931 | /* Get the VBUS status from the transceiver */ | 2931 | /* Get the VBUS status from the transceiver */ |
| 2932 | value = i2c_smbus_read_byte_data(udc->isp1301_i2c_client, | 2932 | value = i2c_smbus_read_byte_data(udc->isp1301_i2c_client, |
| 2933 | ISP1301_I2C_OTG_CONTROL_2); | 2933 | ISP1301_I2C_INTERRUPT_SOURCE); |
| 2934 | 2934 | ||
| 2935 | /* VBUS on or off? */ | 2935 | /* VBUS on or off? */ |
| 2936 | if (value & OTG_B_SESS_VLD) | 2936 | if (value & INT_SESS_VLD) |
| 2937 | udc->vbus = 1; | 2937 | udc->vbus = 1; |
| 2938 | else | 2938 | else |
| 2939 | udc->vbus = 0; | 2939 | udc->vbus = 0; |
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c index 43ac7482fa91..c009263a47e3 100644 --- a/drivers/usb/gadget/net2272.c +++ b/drivers/usb/gadget/net2272.c | |||
| @@ -2069,8 +2069,10 @@ static irqreturn_t net2272_irq(int irq, void *_dev) | |||
| 2069 | #if defined(PLX_PCI_RDK2) | 2069 | #if defined(PLX_PCI_RDK2) |
| 2070 | /* see if PCI int for us by checking irqstat */ | 2070 | /* see if PCI int for us by checking irqstat */ |
| 2071 | intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT); | 2071 | intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT); |
| 2072 | if (!intcsr & (1 << NET2272_PCI_IRQ)) | 2072 | if (!intcsr & (1 << NET2272_PCI_IRQ)) { |
| 2073 | spin_unlock(&dev->lock); | ||
| 2073 | return IRQ_NONE; | 2074 | return IRQ_NONE; |
| 2075 | } | ||
| 2074 | /* check dma interrupts */ | 2076 | /* check dma interrupts */ |
| 2075 | #endif | 2077 | #endif |
| 2076 | /* Platform/devcice interrupt handler */ | 2078 | /* Platform/devcice interrupt handler */ |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 9bfde82078ec..0d2f35ca93f1 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
| @@ -222,7 +222,7 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd, | |||
| 222 | 222 | ||
| 223 | if (pdata->controller_ver < 0) { | 223 | if (pdata->controller_ver < 0) { |
| 224 | dev_warn(hcd->self.controller, "Could not get controller version\n"); | 224 | dev_warn(hcd->self.controller, "Could not get controller version\n"); |
| 225 | return; | 225 | return -ENODEV; |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); | 228 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); |
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 8e7eca62f169..9c2717d66730 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
| @@ -160,7 +160,7 @@ static const struct hc_driver ehci_orion_hc_driver = { | |||
| 160 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | 160 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, |
| 161 | }; | 161 | }; |
| 162 | 162 | ||
| 163 | static void __init | 163 | static void __devinit |
| 164 | ehci_orion_conf_mbus_windows(struct usb_hcd *hcd, | 164 | ehci_orion_conf_mbus_windows(struct usb_hcd *hcd, |
| 165 | const struct mbus_dram_target_info *dram) | 165 | const struct mbus_dram_target_info *dram) |
| 166 | { | 166 | { |
diff --git a/drivers/usb/host/ehci-vt8500.c b/drivers/usb/host/ehci-vt8500.c index 96722bfebc84..d3c9a3e397b9 100644 --- a/drivers/usb/host/ehci-vt8500.c +++ b/drivers/usb/host/ehci-vt8500.c | |||
| @@ -85,6 +85,8 @@ static const struct hc_driver vt8500_ehci_hc_driver = { | |||
| 85 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | 85 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | static u64 vt8500_ehci_dma_mask = DMA_BIT_MASK(32); | ||
| 89 | |||
| 88 | static int vt8500_ehci_drv_probe(struct platform_device *pdev) | 90 | static int vt8500_ehci_drv_probe(struct platform_device *pdev) |
| 89 | { | 91 | { |
| 90 | struct usb_hcd *hcd; | 92 | struct usb_hcd *hcd; |
| @@ -95,6 +97,14 @@ static int vt8500_ehci_drv_probe(struct platform_device *pdev) | |||
| 95 | if (usb_disabled()) | 97 | if (usb_disabled()) |
| 96 | return -ENODEV; | 98 | return -ENODEV; |
| 97 | 99 | ||
| 100 | /* | ||
| 101 | * Right now device-tree probed devices don't get dma_mask set. | ||
| 102 | * Since shared usb code relies on it, set it here for now. | ||
| 103 | * Once we have dma capability bindings this can go away. | ||
| 104 | */ | ||
| 105 | if (!pdev->dev.dma_mask) | ||
| 106 | pdev->dev.dma_mask = &vt8500_ehci_dma_mask; | ||
| 107 | |||
| 98 | if (pdev->resource[1].flags != IORESOURCE_IRQ) { | 108 | if (pdev->resource[1].flags != IORESOURCE_IRQ) { |
| 99 | pr_debug("resource[1] is not IORESOURCE_IRQ"); | 109 | pr_debug("resource[1] is not IORESOURCE_IRQ"); |
| 100 | return -ENOMEM; | 110 | return -ENOMEM; |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 966d1484ee79..39f9e4a9a2d3 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
| @@ -545,7 +545,14 @@ static const struct dmi_system_id __devinitconst ehci_dmi_nohandoff_table[] = { | |||
| 545 | /* Pegatron Lucid (Ordissimo AIRIS) */ | 545 | /* Pegatron Lucid (Ordissimo AIRIS) */ |
| 546 | .matches = { | 546 | .matches = { |
| 547 | DMI_MATCH(DMI_BOARD_NAME, "M11JB"), | 547 | DMI_MATCH(DMI_BOARD_NAME, "M11JB"), |
| 548 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-GE-133"), | 548 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), |
| 549 | }, | ||
| 550 | }, | ||
| 551 | { | ||
| 552 | /* Pegatron Lucid (Ordissimo) */ | ||
| 553 | .matches = { | ||
| 554 | DMI_MATCH(DMI_BOARD_NAME, "Ordissimo"), | ||
| 555 | DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"), | ||
| 549 | }, | 556 | }, |
| 550 | }, | 557 | }, |
| 551 | { } | 558 | { } |
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index e4780491df4a..68ebf20e1519 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c | |||
| @@ -60,6 +60,7 @@ static const struct hc_driver uhci_platform_hc_driver = { | |||
| 60 | .hub_control = uhci_hub_control, | 60 | .hub_control = uhci_hub_control, |
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | static u64 platform_uhci_dma_mask = DMA_BIT_MASK(32); | ||
| 63 | 64 | ||
| 64 | static int __devinit uhci_hcd_platform_probe(struct platform_device *pdev) | 65 | static int __devinit uhci_hcd_platform_probe(struct platform_device *pdev) |
| 65 | { | 66 | { |
| @@ -71,6 +72,14 @@ static int __devinit uhci_hcd_platform_probe(struct platform_device *pdev) | |||
| 71 | if (usb_disabled()) | 72 | if (usb_disabled()) |
| 72 | return -ENODEV; | 73 | return -ENODEV; |
| 73 | 74 | ||
| 75 | /* | ||
| 76 | * Right now device-tree probed devices don't get dma_mask set. | ||
| 77 | * Since shared usb code relies on it, set it here for now. | ||
| 78 | * Once we have dma capability bindings this can go away. | ||
| 79 | */ | ||
| 80 | if (!pdev->dev.dma_mask) | ||
| 81 | pdev->dev.dma_mask = &platform_uhci_dma_mask; | ||
| 82 | |||
| 74 | hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev, | 83 | hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev, |
| 75 | pdev->name); | 84 | pdev->name); |
| 76 | if (!hcd) | 85 | if (!hcd) |
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index 4b436f5a4171..5f3a7c74aa8d 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
| @@ -544,7 +544,6 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, | |||
| 544 | int i; | 544 | int i; |
| 545 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | 545 | /* Fields are 32 bits wide, DMA addresses are in bytes */ |
| 546 | int field_size = 32 / 8; | 546 | int field_size = 32 / 8; |
| 547 | struct xhci_slot_ctx *slot_ctx; | ||
| 548 | dma_addr_t dma = ctx->dma; | 547 | dma_addr_t dma = ctx->dma; |
| 549 | int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params); | 548 | int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params); |
| 550 | 549 | ||
| @@ -570,7 +569,6 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci, | |||
| 570 | dbg_rsvd64(xhci, (u64 *)ctrl_ctx, dma); | 569 | dbg_rsvd64(xhci, (u64 *)ctrl_ctx, dma); |
| 571 | } | 570 | } |
| 572 | 571 | ||
| 573 | slot_ctx = xhci_get_slot_ctx(xhci, ctx); | ||
| 574 | xhci_dbg_slot_ctx(xhci, ctx); | 572 | xhci_dbg_slot_ctx(xhci, ctx); |
| 575 | xhci_dbg_ep_ctx(xhci, ctx, last_ep); | 573 | xhci_dbg_ep_ctx(xhci, ctx, last_ep); |
| 576 | } | 574 | } |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index aa90ad4d4fd5..a686cf4905bb 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
| @@ -151,9 +151,8 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | |||
| 151 | if (portsc & PORT_DEV_REMOVE) | 151 | if (portsc & PORT_DEV_REMOVE) |
| 152 | port_removable |= 1 << (i + 1); | 152 | port_removable |= 1 << (i + 1); |
| 153 | } | 153 | } |
| 154 | memset(&desc->u.ss.DeviceRemovable, | 154 | |
| 155 | (__force __u16) cpu_to_le16(port_removable), | 155 | desc->u.ss.DeviceRemovable = cpu_to_le16(port_removable); |
| 156 | sizeof(__u16)); | ||
| 157 | } | 156 | } |
| 158 | 157 | ||
| 159 | static void xhci_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, | 158 | static void xhci_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, |
| @@ -809,11 +808,13 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 809 | temp = xhci_readl(xhci, port_array[wIndex]); | 808 | temp = xhci_readl(xhci, port_array[wIndex]); |
| 810 | xhci_dbg(xhci, "set port power, actual port %d status = 0x%x\n", wIndex, temp); | 809 | xhci_dbg(xhci, "set port power, actual port %d status = 0x%x\n", wIndex, temp); |
| 811 | 810 | ||
| 811 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
| 812 | temp = usb_acpi_power_manageable(hcd->self.root_hub, | 812 | temp = usb_acpi_power_manageable(hcd->self.root_hub, |
| 813 | wIndex); | 813 | wIndex); |
| 814 | if (temp) | 814 | if (temp) |
| 815 | usb_acpi_set_power_state(hcd->self.root_hub, | 815 | usb_acpi_set_power_state(hcd->self.root_hub, |
| 816 | wIndex, true); | 816 | wIndex, true); |
| 817 | spin_lock_irqsave(&xhci->lock, flags); | ||
| 817 | break; | 818 | break; |
| 818 | case USB_PORT_FEAT_RESET: | 819 | case USB_PORT_FEAT_RESET: |
| 819 | temp = (temp | PORT_RESET); | 820 | temp = (temp | PORT_RESET); |
| @@ -917,11 +918,13 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 917 | xhci_writel(xhci, temp & ~PORT_POWER, | 918 | xhci_writel(xhci, temp & ~PORT_POWER, |
| 918 | port_array[wIndex]); | 919 | port_array[wIndex]); |
| 919 | 920 | ||
| 921 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
| 920 | temp = usb_acpi_power_manageable(hcd->self.root_hub, | 922 | temp = usb_acpi_power_manageable(hcd->self.root_hub, |
| 921 | wIndex); | 923 | wIndex); |
| 922 | if (temp) | 924 | if (temp) |
| 923 | usb_acpi_set_power_state(hcd->self.root_hub, | 925 | usb_acpi_set_power_state(hcd->self.root_hub, |
| 924 | wIndex, false); | 926 | wIndex, false); |
| 927 | spin_lock_irqsave(&xhci->lock, flags); | ||
| 925 | break; | 928 | break; |
| 926 | default: | 929 | default: |
| 927 | goto error; | 930 | goto error; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index c6ebb176dc4f..4e1a8946b8d1 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -1228,6 +1228,17 @@ static void xhci_cmd_to_noop(struct xhci_hcd *xhci, struct xhci_cd *cur_cd) | |||
| 1228 | cur_seg = find_trb_seg(xhci->cmd_ring->first_seg, | 1228 | cur_seg = find_trb_seg(xhci->cmd_ring->first_seg, |
| 1229 | xhci->cmd_ring->dequeue, &cycle_state); | 1229 | xhci->cmd_ring->dequeue, &cycle_state); |
| 1230 | 1230 | ||
| 1231 | if (!cur_seg) { | ||
| 1232 | xhci_warn(xhci, "Command ring mismatch, dequeue = %p %llx (dma)\n", | ||
| 1233 | xhci->cmd_ring->dequeue, | ||
| 1234 | (unsigned long long) | ||
| 1235 | xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, | ||
| 1236 | xhci->cmd_ring->dequeue)); | ||
| 1237 | xhci_debug_ring(xhci, xhci->cmd_ring); | ||
| 1238 | xhci_dbg_ring_ptrs(xhci, xhci->cmd_ring); | ||
| 1239 | return; | ||
| 1240 | } | ||
| 1241 | |||
| 1231 | /* find the command trb matched by cd from command ring */ | 1242 | /* find the command trb matched by cd from command ring */ |
| 1232 | for (cmd_trb = xhci->cmd_ring->dequeue; | 1243 | for (cmd_trb = xhci->cmd_ring->dequeue; |
| 1233 | cmd_trb != xhci->cmd_ring->enqueue; | 1244 | cmd_trb != xhci->cmd_ring->enqueue; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 8d7fcbbe6ade..c9e419f29b74 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -479,7 +479,8 @@ static bool compliance_mode_recovery_timer_quirk_check(void) | |||
| 479 | 479 | ||
| 480 | if (strstr(dmi_product_name, "Z420") || | 480 | if (strstr(dmi_product_name, "Z420") || |
| 481 | strstr(dmi_product_name, "Z620") || | 481 | strstr(dmi_product_name, "Z620") || |
| 482 | strstr(dmi_product_name, "Z820")) | 482 | strstr(dmi_product_name, "Z820") || |
| 483 | strstr(dmi_product_name, "Z1")) | ||
| 483 | return true; | 484 | return true; |
| 484 | 485 | ||
| 485 | return false; | 486 | return false; |
| @@ -1626,7 +1627,6 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
| 1626 | struct xhci_hcd *xhci; | 1627 | struct xhci_hcd *xhci; |
| 1627 | struct xhci_container_ctx *in_ctx, *out_ctx; | 1628 | struct xhci_container_ctx *in_ctx, *out_ctx; |
| 1628 | unsigned int ep_index; | 1629 | unsigned int ep_index; |
| 1629 | struct xhci_ep_ctx *ep_ctx; | ||
| 1630 | struct xhci_slot_ctx *slot_ctx; | 1630 | struct xhci_slot_ctx *slot_ctx; |
| 1631 | struct xhci_input_control_ctx *ctrl_ctx; | 1631 | struct xhci_input_control_ctx *ctrl_ctx; |
| 1632 | u32 added_ctxs; | 1632 | u32 added_ctxs; |
| @@ -1662,7 +1662,6 @@ int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, | |||
| 1662 | out_ctx = virt_dev->out_ctx; | 1662 | out_ctx = virt_dev->out_ctx; |
| 1663 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); | 1663 | ctrl_ctx = xhci_get_input_control_ctx(xhci, in_ctx); |
| 1664 | ep_index = xhci_get_endpoint_index(&ep->desc); | 1664 | ep_index = xhci_get_endpoint_index(&ep->desc); |
| 1665 | ep_ctx = xhci_get_ep_ctx(xhci, out_ctx, ep_index); | ||
| 1666 | 1665 | ||
| 1667 | /* If this endpoint is already in use, and the upper layers are trying | 1666 | /* If this endpoint is already in use, and the upper layers are trying |
| 1668 | * to add it again without dropping it, reject the addition. | 1667 | * to add it again without dropping it, reject the addition. |
| @@ -1816,6 +1815,8 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci, | |||
| 1816 | case COMP_EBADSLT: | 1815 | case COMP_EBADSLT: |
| 1817 | dev_warn(&udev->dev, "WARN: slot not enabled for" | 1816 | dev_warn(&udev->dev, "WARN: slot not enabled for" |
| 1818 | "evaluate context command.\n"); | 1817 | "evaluate context command.\n"); |
| 1818 | ret = -EINVAL; | ||
| 1819 | break; | ||
| 1819 | case COMP_CTX_STATE: | 1820 | case COMP_CTX_STATE: |
| 1820 | dev_warn(&udev->dev, "WARN: invalid context state for " | 1821 | dev_warn(&udev->dev, "WARN: invalid context state for " |
| 1821 | "evaluate context command.\n"); | 1822 | "evaluate context command.\n"); |
| @@ -4020,7 +4021,7 @@ int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
| 4020 | static unsigned long long xhci_service_interval_to_ns( | 4021 | static unsigned long long xhci_service_interval_to_ns( |
| 4021 | struct usb_endpoint_descriptor *desc) | 4022 | struct usb_endpoint_descriptor *desc) |
| 4022 | { | 4023 | { |
| 4023 | return (1 << (desc->bInterval - 1)) * 125 * 1000; | 4024 | return (1ULL << (desc->bInterval - 1)) * 125 * 1000; |
| 4024 | } | 4025 | } |
| 4025 | 4026 | ||
| 4026 | static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev, | 4027 | static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev, |
| @@ -4141,7 +4142,7 @@ static u16 xhci_calculate_intel_u2_timeout(struct usb_device *udev, | |||
| 4141 | (xhci_service_interval_to_ns(desc) > timeout_ns)) | 4142 | (xhci_service_interval_to_ns(desc) > timeout_ns)) |
| 4142 | timeout_ns = xhci_service_interval_to_ns(desc); | 4143 | timeout_ns = xhci_service_interval_to_ns(desc); |
| 4143 | 4144 | ||
| 4144 | u2_del_ns = udev->bos->ss_cap->bU2DevExitLat * 1000; | 4145 | u2_del_ns = le16_to_cpu(udev->bos->ss_cap->bU2DevExitLat) * 1000ULL; |
| 4145 | if (u2_del_ns > timeout_ns) | 4146 | if (u2_del_ns > timeout_ns) |
| 4146 | timeout_ns = u2_del_ns; | 4147 | timeout_ns = u2_del_ns; |
| 4147 | 4148 | ||
diff --git a/drivers/usb/misc/ezusb.c b/drivers/usb/misc/ezusb.c index 4223d761223d..6589268a6515 100644 --- a/drivers/usb/misc/ezusb.c +++ b/drivers/usb/misc/ezusb.c | |||
| @@ -158,3 +158,4 @@ int ezusb_fx2_ihex_firmware_download(struct usb_device *dev, | |||
| 158 | } | 158 | } |
| 159 | EXPORT_SYMBOL_GPL(ezusb_fx2_ihex_firmware_download); | 159 | EXPORT_SYMBOL_GPL(ezusb_fx2_ihex_firmware_download); |
| 160 | 160 | ||
| 161 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 457f25e62c51..c964d6af178b 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c | |||
| @@ -305,6 +305,12 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci) | |||
| 305 | ret = IRQ_HANDLED; | 305 | ret = IRQ_HANDLED; |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | /* Drop spurious RX and TX if device is disconnected */ | ||
| 309 | if (musb->int_usb & MUSB_INTR_DISCONNECT) { | ||
| 310 | musb->int_tx = 0; | ||
| 311 | musb->int_rx = 0; | ||
| 312 | } | ||
| 313 | |||
| 308 | if (musb->int_tx || musb->int_rx || musb->int_usb) | 314 | if (musb->int_tx || musb->int_rx || musb->int_usb) |
| 309 | ret |= musb_interrupt(musb); | 315 | ret |= musb_interrupt(musb); |
| 310 | 316 | ||
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 444346e1e10d..ff5f112053d2 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
| @@ -458,11 +458,11 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) | |||
| 458 | struct platform_device *musb; | 458 | struct platform_device *musb; |
| 459 | struct resource *res; | 459 | struct resource *res; |
| 460 | struct resource resources[2]; | 460 | struct resource resources[2]; |
| 461 | char res_name[10]; | 461 | char res_name[11]; |
| 462 | int ret, musbid; | 462 | int ret, musbid; |
| 463 | 463 | ||
| 464 | /* get memory resource */ | 464 | /* get memory resource */ |
| 465 | sprintf(res_name, "musb%d", id); | 465 | snprintf(res_name, sizeof(res_name), "musb%d", id); |
| 466 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name); | 466 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res_name); |
| 467 | if (!res) { | 467 | if (!res) { |
| 468 | dev_err(dev, "%s get mem resource failed\n", res_name); | 468 | dev_err(dev, "%s get mem resource failed\n", res_name); |
| @@ -473,7 +473,7 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) | |||
| 473 | resources[0] = *res; | 473 | resources[0] = *res; |
| 474 | 474 | ||
| 475 | /* get irq resource */ | 475 | /* get irq resource */ |
| 476 | sprintf(res_name, "musb%d-irq", id); | 476 | snprintf(res_name, sizeof(res_name), "musb%d-irq", id); |
| 477 | res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name); | 477 | res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, res_name); |
| 478 | if (!res) { | 478 | if (!res) { |
| 479 | dev_err(dev, "%s get irq resource failed\n", res_name); | 479 | dev_err(dev, "%s get irq resource failed\n", res_name); |
| @@ -530,7 +530,7 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id) | |||
| 530 | 530 | ||
| 531 | of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps); | 531 | of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps); |
| 532 | of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits); | 532 | of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits); |
| 533 | sprintf(res_name, "port%d-mode", id); | 533 | snprintf(res_name, sizeof(res_name), "port%d-mode", id); |
| 534 | of_property_read_u32(np, res_name, (u32 *)&pdata->mode); | 534 | of_property_read_u32(np, res_name, (u32 *)&pdata->mode); |
| 535 | of_property_read_u32(np, "power", (u32 *)&pdata->power); | 535 | of_property_read_u32(np, "power", (u32 *)&pdata->power); |
| 536 | config->multipoint = of_property_read_bool(np, "multipoint"); | 536 | config->multipoint = of_property_read_bool(np, "multipoint"); |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 143c4e9e1be4..c021b202c0f3 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
| @@ -795,6 +795,7 @@ static void xfer_work(struct work_struct *work) | |||
| 795 | dev_dbg(dev, " %s %d (%d/ %d)\n", | 795 | dev_dbg(dev, " %s %d (%d/ %d)\n", |
| 796 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); | 796 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); |
| 797 | 797 | ||
| 798 | usbhs_pipe_enable(pipe); | ||
| 798 | usbhsf_dma_start(pipe, fifo); | 799 | usbhsf_dma_start(pipe, fifo); |
| 799 | dma_async_issue_pending(chan); | 800 | dma_async_issue_pending(chan); |
| 800 | } | 801 | } |
diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c index 35c5208f3249..61933a90e5bf 100644 --- a/drivers/usb/renesas_usbhs/mod.c +++ b/drivers/usb/renesas_usbhs/mod.c | |||
| @@ -273,9 +273,9 @@ static irqreturn_t usbhs_interrupt(int irq, void *data) | |||
| 273 | usbhs_write(priv, INTSTS0, ~irq_state.intsts0 & INTSTS0_MAGIC); | 273 | usbhs_write(priv, INTSTS0, ~irq_state.intsts0 & INTSTS0_MAGIC); |
| 274 | usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC); | 274 | usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC); |
| 275 | 275 | ||
| 276 | usbhs_write(priv, BRDYSTS, 0); | 276 | usbhs_write(priv, BRDYSTS, ~irq_state.brdysts); |
| 277 | usbhs_write(priv, NRDYSTS, 0); | 277 | usbhs_write(priv, NRDYSTS, ~irq_state.nrdysts); |
| 278 | usbhs_write(priv, BEMPSTS, 0); | 278 | usbhs_write(priv, BEMPSTS, ~irq_state.bempsts); |
| 279 | 279 | ||
| 280 | /* | 280 | /* |
| 281 | * call irq callback functions | 281 | * call irq callback functions |
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index 9b69a1323294..069cd765400c 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c | |||
| @@ -334,6 +334,11 @@ static void usbhsh_pipe_detach(struct usbhsh_hpriv *hpriv, | |||
| 334 | struct device *dev = usbhs_priv_to_dev(priv); | 334 | struct device *dev = usbhs_priv_to_dev(priv); |
| 335 | unsigned long flags; | 335 | unsigned long flags; |
| 336 | 336 | ||
| 337 | if (unlikely(!uep)) { | ||
| 338 | dev_err(dev, "no uep\n"); | ||
| 339 | return; | ||
| 340 | } | ||
| 341 | |||
| 337 | /******************** spin lock ********************/ | 342 | /******************** spin lock ********************/ |
| 338 | usbhs_lock(priv, flags); | 343 | usbhs_lock(priv, flags); |
| 339 | 344 | ||
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h index 08786c06dcf1..3d80c7b1fd1b 100644 --- a/drivers/usb/renesas_usbhs/pipe.h +++ b/drivers/usb/renesas_usbhs/pipe.h | |||
| @@ -54,7 +54,7 @@ struct usbhs_pipe_info { | |||
| 54 | * pipe list | 54 | * pipe list |
| 55 | */ | 55 | */ |
| 56 | #define __usbhs_for_each_pipe(start, pos, info, i) \ | 56 | #define __usbhs_for_each_pipe(start, pos, info, i) \ |
| 57 | for (i = start, pos = (info)->pipe; \ | 57 | for (i = start, pos = (info)->pipe + i; \ |
| 58 | i < (info)->size; \ | 58 | i < (info)->size; \ |
| 59 | i++, pos = (info)->pipe + i) | 59 | i++, pos = (info)->pipe + i) |
| 60 | 60 | ||
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index cf2522c397d3..bd50a8a41a0f 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
| @@ -125,9 +125,6 @@ static inline int calc_divisor(int bps) | |||
| 125 | 125 | ||
| 126 | static int ark3116_attach(struct usb_serial *serial) | 126 | static int ark3116_attach(struct usb_serial *serial) |
| 127 | { | 127 | { |
| 128 | struct usb_serial_port *port = serial->port[0]; | ||
| 129 | struct ark3116_private *priv; | ||
| 130 | |||
| 131 | /* make sure we have our end-points */ | 128 | /* make sure we have our end-points */ |
| 132 | if ((serial->num_bulk_in == 0) || | 129 | if ((serial->num_bulk_in == 0) || |
| 133 | (serial->num_bulk_out == 0) || | 130 | (serial->num_bulk_out == 0) || |
| @@ -142,8 +139,15 @@ static int ark3116_attach(struct usb_serial *serial) | |||
| 142 | return -EINVAL; | 139 | return -EINVAL; |
| 143 | } | 140 | } |
| 144 | 141 | ||
| 145 | priv = kzalloc(sizeof(struct ark3116_private), | 142 | return 0; |
| 146 | GFP_KERNEL); | 143 | } |
| 144 | |||
| 145 | static int ark3116_port_probe(struct usb_serial_port *port) | ||
| 146 | { | ||
| 147 | struct usb_serial *serial = port->serial; | ||
| 148 | struct ark3116_private *priv; | ||
| 149 | |||
| 150 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
| 147 | if (!priv) | 151 | if (!priv) |
| 148 | return -ENOMEM; | 152 | return -ENOMEM; |
| 149 | 153 | ||
| @@ -198,18 +202,15 @@ static int ark3116_attach(struct usb_serial *serial) | |||
| 198 | return 0; | 202 | return 0; |
| 199 | } | 203 | } |
| 200 | 204 | ||
| 201 | static void ark3116_release(struct usb_serial *serial) | 205 | static int ark3116_port_remove(struct usb_serial_port *port) |
| 202 | { | 206 | { |
| 203 | struct usb_serial_port *port = serial->port[0]; | ||
| 204 | struct ark3116_private *priv = usb_get_serial_port_data(port); | 207 | struct ark3116_private *priv = usb_get_serial_port_data(port); |
| 205 | 208 | ||
| 206 | /* device is closed, so URBs and DMA should be down */ | 209 | /* device is closed, so URBs and DMA should be down */ |
| 207 | |||
| 208 | usb_set_serial_port_data(port, NULL); | ||
| 209 | |||
| 210 | mutex_destroy(&priv->hw_lock); | 210 | mutex_destroy(&priv->hw_lock); |
| 211 | |||
| 212 | kfree(priv); | 211 | kfree(priv); |
| 212 | |||
| 213 | return 0; | ||
| 213 | } | 214 | } |
| 214 | 215 | ||
| 215 | static void ark3116_init_termios(struct tty_struct *tty) | 216 | static void ark3116_init_termios(struct tty_struct *tty) |
| @@ -723,7 +724,8 @@ static struct usb_serial_driver ark3116_device = { | |||
| 723 | .id_table = id_table, | 724 | .id_table = id_table, |
| 724 | .num_ports = 1, | 725 | .num_ports = 1, |
| 725 | .attach = ark3116_attach, | 726 | .attach = ark3116_attach, |
| 726 | .release = ark3116_release, | 727 | .port_probe = ark3116_port_probe, |
| 728 | .port_remove = ark3116_port_remove, | ||
| 727 | .set_termios = ark3116_set_termios, | 729 | .set_termios = ark3116_set_termios, |
| 728 | .init_termios = ark3116_init_termios, | 730 | .init_termios = ark3116_init_termios, |
| 729 | .ioctl = ark3116_ioctl, | 731 | .ioctl = ark3116_ioctl, |
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 99449424193f..ea29556f0d72 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c | |||
| @@ -45,8 +45,8 @@ | |||
| 45 | #define DRIVER_DESC "USB Belkin Serial converter driver" | 45 | #define DRIVER_DESC "USB Belkin Serial converter driver" |
| 46 | 46 | ||
| 47 | /* function prototypes for a Belkin USB Serial Adapter F5U103 */ | 47 | /* function prototypes for a Belkin USB Serial Adapter F5U103 */ |
| 48 | static int belkin_sa_startup(struct usb_serial *serial); | 48 | static int belkin_sa_port_probe(struct usb_serial_port *port); |
| 49 | static void belkin_sa_release(struct usb_serial *serial); | 49 | static int belkin_sa_port_remove(struct usb_serial_port *port); |
| 50 | static int belkin_sa_open(struct tty_struct *tty, | 50 | static int belkin_sa_open(struct tty_struct *tty, |
| 51 | struct usb_serial_port *port); | 51 | struct usb_serial_port *port); |
| 52 | static void belkin_sa_close(struct usb_serial_port *port); | 52 | static void belkin_sa_close(struct usb_serial_port *port); |
| @@ -88,8 +88,8 @@ static struct usb_serial_driver belkin_device = { | |||
| 88 | .break_ctl = belkin_sa_break_ctl, | 88 | .break_ctl = belkin_sa_break_ctl, |
| 89 | .tiocmget = belkin_sa_tiocmget, | 89 | .tiocmget = belkin_sa_tiocmget, |
| 90 | .tiocmset = belkin_sa_tiocmset, | 90 | .tiocmset = belkin_sa_tiocmset, |
| 91 | .attach = belkin_sa_startup, | 91 | .port_probe = belkin_sa_port_probe, |
| 92 | .release = belkin_sa_release, | 92 | .port_remove = belkin_sa_port_remove, |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | static struct usb_serial_driver * const serial_drivers[] = { | 95 | static struct usb_serial_driver * const serial_drivers[] = { |
| @@ -118,17 +118,15 @@ struct belkin_sa_private { | |||
| 118 | (c), BELKIN_SA_SET_REQUEST_TYPE, \ | 118 | (c), BELKIN_SA_SET_REQUEST_TYPE, \ |
| 119 | (v), 0, NULL, 0, WDR_TIMEOUT) | 119 | (v), 0, NULL, 0, WDR_TIMEOUT) |
| 120 | 120 | ||
| 121 | /* do some startup allocations not currently performed by usb_serial_probe() */ | 121 | static int belkin_sa_port_probe(struct usb_serial_port *port) |
| 122 | static int belkin_sa_startup(struct usb_serial *serial) | ||
| 123 | { | 122 | { |
| 124 | struct usb_device *dev = serial->dev; | 123 | struct usb_device *dev = port->serial->dev; |
| 125 | struct belkin_sa_private *priv; | 124 | struct belkin_sa_private *priv; |
| 126 | 125 | ||
| 127 | /* allocate the private data structure */ | ||
| 128 | priv = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL); | 126 | priv = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL); |
| 129 | if (!priv) | 127 | if (!priv) |
| 130 | return -1; /* error */ | 128 | return -ENOMEM; |
| 131 | /* set initial values for control structures */ | 129 | |
| 132 | spin_lock_init(&priv->lock); | 130 | spin_lock_init(&priv->lock); |
| 133 | priv->control_state = 0; | 131 | priv->control_state = 0; |
| 134 | priv->last_lsr = 0; | 132 | priv->last_lsr = 0; |
| @@ -140,18 +138,19 @@ static int belkin_sa_startup(struct usb_serial *serial) | |||
| 140 | le16_to_cpu(dev->descriptor.bcdDevice), | 138 | le16_to_cpu(dev->descriptor.bcdDevice), |
| 141 | priv->bad_flow_control); | 139 | priv->bad_flow_control); |
| 142 | 140 | ||
| 143 | init_waitqueue_head(&serial->port[0]->write_wait); | 141 | usb_set_serial_port_data(port, priv); |
| 144 | usb_set_serial_port_data(serial->port[0], priv); | ||
| 145 | 142 | ||
| 146 | return 0; | 143 | return 0; |
| 147 | } | 144 | } |
| 148 | 145 | ||
| 149 | static void belkin_sa_release(struct usb_serial *serial) | 146 | static int belkin_sa_port_remove(struct usb_serial_port *port) |
| 150 | { | 147 | { |
| 151 | int i; | 148 | struct belkin_sa_private *priv; |
| 152 | 149 | ||
| 153 | for (i = 0; i < serial->num_ports; ++i) | 150 | priv = usb_get_serial_port_data(port); |
| 154 | kfree(usb_get_serial_port_data(serial->port[i])); | 151 | kfree(priv); |
| 152 | |||
| 153 | return 0; | ||
| 155 | } | 154 | } |
| 156 | 155 | ||
| 157 | static int belkin_sa_open(struct tty_struct *tty, | 156 | static int belkin_sa_open(struct tty_struct *tty, |
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index e9c7046ae355..d255f66e708e 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
| @@ -242,13 +242,11 @@ out: kfree(buffer); | |||
| 242 | return r; | 242 | return r; |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | /* allocate private data */ | 245 | static int ch341_port_probe(struct usb_serial_port *port) |
| 246 | static int ch341_attach(struct usb_serial *serial) | ||
| 247 | { | 246 | { |
| 248 | struct ch341_private *priv; | 247 | struct ch341_private *priv; |
| 249 | int r; | 248 | int r; |
| 250 | 249 | ||
| 251 | /* private data */ | ||
| 252 | priv = kzalloc(sizeof(struct ch341_private), GFP_KERNEL); | 250 | priv = kzalloc(sizeof(struct ch341_private), GFP_KERNEL); |
| 253 | if (!priv) | 251 | if (!priv) |
| 254 | return -ENOMEM; | 252 | return -ENOMEM; |
| @@ -258,17 +256,27 @@ static int ch341_attach(struct usb_serial *serial) | |||
| 258 | priv->baud_rate = DEFAULT_BAUD_RATE; | 256 | priv->baud_rate = DEFAULT_BAUD_RATE; |
| 259 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; | 257 | priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR; |
| 260 | 258 | ||
| 261 | r = ch341_configure(serial->dev, priv); | 259 | r = ch341_configure(port->serial->dev, priv); |
| 262 | if (r < 0) | 260 | if (r < 0) |
| 263 | goto error; | 261 | goto error; |
| 264 | 262 | ||
| 265 | usb_set_serial_port_data(serial->port[0], priv); | 263 | usb_set_serial_port_data(port, priv); |
| 266 | return 0; | 264 | return 0; |
| 267 | 265 | ||
| 268 | error: kfree(priv); | 266 | error: kfree(priv); |
| 269 | return r; | 267 | return r; |
| 270 | } | 268 | } |
| 271 | 269 | ||
| 270 | static int ch341_port_remove(struct usb_serial_port *port) | ||
| 271 | { | ||
| 272 | struct ch341_private *priv; | ||
| 273 | |||
| 274 | priv = usb_get_serial_port_data(port); | ||
| 275 | kfree(priv); | ||
| 276 | |||
| 277 | return 0; | ||
| 278 | } | ||
| 279 | |||
| 272 | static int ch341_carrier_raised(struct usb_serial_port *port) | 280 | static int ch341_carrier_raised(struct usb_serial_port *port) |
| 273 | { | 281 | { |
| 274 | struct ch341_private *priv = usb_get_serial_port_data(port); | 282 | struct ch341_private *priv = usb_get_serial_port_data(port); |
| @@ -304,7 +312,7 @@ static void ch341_close(struct usb_serial_port *port) | |||
| 304 | static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) | 312 | static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) |
| 305 | { | 313 | { |
| 306 | struct usb_serial *serial = port->serial; | 314 | struct usb_serial *serial = port->serial; |
| 307 | struct ch341_private *priv = usb_get_serial_port_data(serial->port[0]); | 315 | struct ch341_private *priv = usb_get_serial_port_data(port); |
| 308 | int r; | 316 | int r; |
| 309 | 317 | ||
| 310 | priv->baud_rate = DEFAULT_BAUD_RATE; | 318 | priv->baud_rate = DEFAULT_BAUD_RATE; |
| @@ -608,7 +616,8 @@ static struct usb_serial_driver ch341_device = { | |||
| 608 | .tiocmget = ch341_tiocmget, | 616 | .tiocmget = ch341_tiocmget, |
| 609 | .tiocmset = ch341_tiocmset, | 617 | .tiocmset = ch341_tiocmset, |
| 610 | .read_int_callback = ch341_read_int_callback, | 618 | .read_int_callback = ch341_read_int_callback, |
| 611 | .attach = ch341_attach, | 619 | .port_probe = ch341_port_probe, |
| 620 | .port_remove = ch341_port_remove, | ||
| 612 | .reset_resume = ch341_reset_resume, | 621 | .reset_resume = ch341_reset_resume, |
| 613 | }; | 622 | }; |
| 614 | 623 | ||
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 28af5acc3360..eb033fc92a15 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
| @@ -162,7 +162,7 @@ static const struct usb_device_id id_table[] = { | |||
| 162 | 162 | ||
| 163 | MODULE_DEVICE_TABLE(usb, id_table); | 163 | MODULE_DEVICE_TABLE(usb, id_table); |
| 164 | 164 | ||
| 165 | struct cp210x_port_private { | 165 | struct cp210x_serial_private { |
| 166 | __u8 bInterfaceNumber; | 166 | __u8 bInterfaceNumber; |
| 167 | }; | 167 | }; |
| 168 | 168 | ||
| @@ -276,7 +276,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, | |||
| 276 | unsigned int *data, int size) | 276 | unsigned int *data, int size) |
| 277 | { | 277 | { |
| 278 | struct usb_serial *serial = port->serial; | 278 | struct usb_serial *serial = port->serial; |
| 279 | struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); | 279 | struct cp210x_serial_private *spriv = usb_get_serial_data(serial); |
| 280 | __le32 *buf; | 280 | __le32 *buf; |
| 281 | int result, i, length; | 281 | int result, i, length; |
| 282 | 282 | ||
| @@ -292,7 +292,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, | |||
| 292 | /* Issue the request, attempting to read 'size' bytes */ | 292 | /* Issue the request, attempting to read 'size' bytes */ |
| 293 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 293 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
| 294 | request, REQTYPE_INTERFACE_TO_HOST, 0x0000, | 294 | request, REQTYPE_INTERFACE_TO_HOST, 0x0000, |
| 295 | port_priv->bInterfaceNumber, buf, size, | 295 | spriv->bInterfaceNumber, buf, size, |
| 296 | USB_CTRL_GET_TIMEOUT); | 296 | USB_CTRL_GET_TIMEOUT); |
| 297 | 297 | ||
| 298 | /* Convert data into an array of integers */ | 298 | /* Convert data into an array of integers */ |
| @@ -323,7 +323,7 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, | |||
| 323 | unsigned int *data, int size) | 323 | unsigned int *data, int size) |
| 324 | { | 324 | { |
| 325 | struct usb_serial *serial = port->serial; | 325 | struct usb_serial *serial = port->serial; |
| 326 | struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); | 326 | struct cp210x_serial_private *spriv = usb_get_serial_data(serial); |
| 327 | __le32 *buf; | 327 | __le32 *buf; |
| 328 | int result, i, length; | 328 | int result, i, length; |
| 329 | 329 | ||
| @@ -345,13 +345,13 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, | |||
| 345 | result = usb_control_msg(serial->dev, | 345 | result = usb_control_msg(serial->dev, |
| 346 | usb_sndctrlpipe(serial->dev, 0), | 346 | usb_sndctrlpipe(serial->dev, 0), |
| 347 | request, REQTYPE_HOST_TO_INTERFACE, 0x0000, | 347 | request, REQTYPE_HOST_TO_INTERFACE, 0x0000, |
| 348 | port_priv->bInterfaceNumber, buf, size, | 348 | spriv->bInterfaceNumber, buf, size, |
| 349 | USB_CTRL_SET_TIMEOUT); | 349 | USB_CTRL_SET_TIMEOUT); |
| 350 | } else { | 350 | } else { |
| 351 | result = usb_control_msg(serial->dev, | 351 | result = usb_control_msg(serial->dev, |
| 352 | usb_sndctrlpipe(serial->dev, 0), | 352 | usb_sndctrlpipe(serial->dev, 0), |
| 353 | request, REQTYPE_HOST_TO_INTERFACE, data[0], | 353 | request, REQTYPE_HOST_TO_INTERFACE, data[0], |
| 354 | port_priv->bInterfaceNumber, NULL, 0, | 354 | spriv->bInterfaceNumber, NULL, 0, |
| 355 | USB_CTRL_SET_TIMEOUT); | 355 | USB_CTRL_SET_TIMEOUT); |
| 356 | } | 356 | } |
| 357 | 357 | ||
| @@ -845,36 +845,30 @@ static void cp210x_break_ctl (struct tty_struct *tty, int break_state) | |||
| 845 | 845 | ||
| 846 | static int cp210x_startup(struct usb_serial *serial) | 846 | static int cp210x_startup(struct usb_serial *serial) |
| 847 | { | 847 | { |
| 848 | struct cp210x_port_private *port_priv; | 848 | struct usb_host_interface *cur_altsetting; |
| 849 | int i; | 849 | struct cp210x_serial_private *spriv; |
| 850 | 850 | ||
| 851 | /* cp210x buffers behave strangely unless device is reset */ | 851 | /* cp210x buffers behave strangely unless device is reset */ |
| 852 | usb_reset_device(serial->dev); | 852 | usb_reset_device(serial->dev); |
| 853 | 853 | ||
| 854 | for (i = 0; i < serial->num_ports; i++) { | 854 | spriv = kzalloc(sizeof(*spriv), GFP_KERNEL); |
| 855 | port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL); | 855 | if (!spriv) |
| 856 | if (!port_priv) | 856 | return -ENOMEM; |
| 857 | return -ENOMEM; | ||
| 858 | 857 | ||
| 859 | port_priv->bInterfaceNumber = | 858 | cur_altsetting = serial->interface->cur_altsetting; |
| 860 | serial->interface->cur_altsetting->desc.bInterfaceNumber; | 859 | spriv->bInterfaceNumber = cur_altsetting->desc.bInterfaceNumber; |
| 861 | 860 | ||
| 862 | usb_set_serial_port_data(serial->port[i], port_priv); | 861 | usb_set_serial_data(serial, spriv); |
| 863 | } | ||
| 864 | 862 | ||
| 865 | return 0; | 863 | return 0; |
| 866 | } | 864 | } |
| 867 | 865 | ||
| 868 | static void cp210x_release(struct usb_serial *serial) | 866 | static void cp210x_release(struct usb_serial *serial) |
| 869 | { | 867 | { |
| 870 | struct cp210x_port_private *port_priv; | 868 | struct cp210x_serial_private *spriv; |
| 871 | int i; | ||
| 872 | 869 | ||
| 873 | for (i = 0; i < serial->num_ports; i++) { | 870 | spriv = usb_get_serial_data(serial); |
| 874 | port_priv = usb_get_serial_port_data(serial->port[i]); | 871 | kfree(spriv); |
| 875 | kfree(port_priv); | ||
| 876 | usb_set_serial_port_data(serial->port[i], NULL); | ||
| 877 | } | ||
| 878 | } | 872 | } |
| 879 | 873 | ||
| 880 | module_usb_serial_driver(serial_drivers, id_table); | 874 | module_usb_serial_driver(serial_drivers, id_table); |
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 2a7aecc72237..4ee77dcbe690 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c | |||
| @@ -55,9 +55,9 @@ | |||
| 55 | #define CYBERJACK_PRODUCT_ID 0x0100 | 55 | #define CYBERJACK_PRODUCT_ID 0x0100 |
| 56 | 56 | ||
| 57 | /* Function prototypes */ | 57 | /* Function prototypes */ |
| 58 | static int cyberjack_startup(struct usb_serial *serial); | ||
| 59 | static void cyberjack_disconnect(struct usb_serial *serial); | 58 | static void cyberjack_disconnect(struct usb_serial *serial); |
| 60 | static void cyberjack_release(struct usb_serial *serial); | 59 | static int cyberjack_port_probe(struct usb_serial_port *port); |
| 60 | static int cyberjack_port_remove(struct usb_serial_port *port); | ||
| 61 | static int cyberjack_open(struct tty_struct *tty, | 61 | static int cyberjack_open(struct tty_struct *tty, |
| 62 | struct usb_serial_port *port); | 62 | struct usb_serial_port *port); |
| 63 | static void cyberjack_close(struct usb_serial_port *port); | 63 | static void cyberjack_close(struct usb_serial_port *port); |
| @@ -83,9 +83,9 @@ static struct usb_serial_driver cyberjack_device = { | |||
| 83 | .description = "Reiner SCT Cyberjack USB card reader", | 83 | .description = "Reiner SCT Cyberjack USB card reader", |
| 84 | .id_table = id_table, | 84 | .id_table = id_table, |
| 85 | .num_ports = 1, | 85 | .num_ports = 1, |
| 86 | .attach = cyberjack_startup, | ||
| 87 | .disconnect = cyberjack_disconnect, | 86 | .disconnect = cyberjack_disconnect, |
| 88 | .release = cyberjack_release, | 87 | .port_probe = cyberjack_port_probe, |
| 88 | .port_remove = cyberjack_port_remove, | ||
| 89 | .open = cyberjack_open, | 89 | .open = cyberjack_open, |
| 90 | .close = cyberjack_close, | 90 | .close = cyberjack_close, |
| 91 | .write = cyberjack_write, | 91 | .write = cyberjack_write, |
| @@ -107,56 +107,45 @@ struct cyberjack_private { | |||
| 107 | short wrsent; /* Data already sent */ | 107 | short wrsent; /* Data already sent */ |
| 108 | }; | 108 | }; |
| 109 | 109 | ||
| 110 | /* do some startup allocations not currently performed by usb_serial_probe() */ | 110 | static int cyberjack_port_probe(struct usb_serial_port *port) |
| 111 | static int cyberjack_startup(struct usb_serial *serial) | ||
| 112 | { | 111 | { |
| 113 | struct cyberjack_private *priv; | 112 | struct cyberjack_private *priv; |
| 114 | int i; | 113 | int result; |
| 115 | 114 | ||
| 116 | /* allocate the private data structure */ | ||
| 117 | priv = kmalloc(sizeof(struct cyberjack_private), GFP_KERNEL); | 115 | priv = kmalloc(sizeof(struct cyberjack_private), GFP_KERNEL); |
| 118 | if (!priv) | 116 | if (!priv) |
| 119 | return -ENOMEM; | 117 | return -ENOMEM; |
| 120 | 118 | ||
| 121 | /* set initial values */ | ||
| 122 | spin_lock_init(&priv->lock); | 119 | spin_lock_init(&priv->lock); |
| 123 | priv->rdtodo = 0; | 120 | priv->rdtodo = 0; |
| 124 | priv->wrfilled = 0; | 121 | priv->wrfilled = 0; |
| 125 | priv->wrsent = 0; | 122 | priv->wrsent = 0; |
| 126 | usb_set_serial_port_data(serial->port[0], priv); | ||
| 127 | 123 | ||
| 128 | init_waitqueue_head(&serial->port[0]->write_wait); | 124 | usb_set_serial_port_data(port, priv); |
| 129 | 125 | ||
| 130 | for (i = 0; i < serial->num_ports; ++i) { | 126 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
| 131 | int result; | 127 | if (result) |
| 132 | result = usb_submit_urb(serial->port[i]->interrupt_in_urb, | 128 | dev_err(&port->dev, "usb_submit_urb(read int) failed\n"); |
| 133 | GFP_KERNEL); | ||
| 134 | if (result) | ||
| 135 | dev_err(&serial->dev->dev, | ||
| 136 | "usb_submit_urb(read int) failed\n"); | ||
| 137 | dev_dbg(&serial->dev->dev, "%s - usb_submit_urb(int urb)\n", | ||
| 138 | __func__); | ||
| 139 | } | ||
| 140 | 129 | ||
| 141 | return 0; | 130 | return 0; |
| 142 | } | 131 | } |
| 143 | 132 | ||
| 144 | static void cyberjack_disconnect(struct usb_serial *serial) | 133 | static int cyberjack_port_remove(struct usb_serial_port *port) |
| 145 | { | 134 | { |
| 146 | int i; | 135 | struct cyberjack_private *priv; |
| 147 | 136 | ||
| 148 | for (i = 0; i < serial->num_ports; ++i) | 137 | priv = usb_get_serial_port_data(port); |
| 149 | usb_kill_urb(serial->port[i]->interrupt_in_urb); | 138 | kfree(priv); |
| 139 | |||
| 140 | return 0; | ||
| 150 | } | 141 | } |
| 151 | 142 | ||
| 152 | static void cyberjack_release(struct usb_serial *serial) | 143 | static void cyberjack_disconnect(struct usb_serial *serial) |
| 153 | { | 144 | { |
| 154 | int i; | 145 | int i; |
| 155 | 146 | ||
| 156 | for (i = 0; i < serial->num_ports; ++i) { | 147 | for (i = 0; i < serial->num_ports; ++i) |
| 157 | /* My special items, the standard routines free my urbs */ | 148 | usb_kill_urb(serial->port[i]->interrupt_in_urb); |
| 158 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
| 159 | } | ||
| 160 | } | 149 | } |
| 161 | 150 | ||
| 162 | static int cyberjack_open(struct tty_struct *tty, | 151 | static int cyberjack_open(struct tty_struct *tty, |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 1befce21e173..f0da1279c114 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
| @@ -123,10 +123,10 @@ struct cypress_private { | |||
| 123 | }; | 123 | }; |
| 124 | 124 | ||
| 125 | /* function prototypes for the Cypress USB to serial device */ | 125 | /* function prototypes for the Cypress USB to serial device */ |
| 126 | static int cypress_earthmate_startup(struct usb_serial *serial); | 126 | static int cypress_earthmate_port_probe(struct usb_serial_port *port); |
| 127 | static int cypress_hidcom_startup(struct usb_serial *serial); | 127 | static int cypress_hidcom_port_probe(struct usb_serial_port *port); |
| 128 | static int cypress_ca42v2_startup(struct usb_serial *serial); | 128 | static int cypress_ca42v2_port_probe(struct usb_serial_port *port); |
| 129 | static void cypress_release(struct usb_serial *serial); | 129 | static int cypress_port_remove(struct usb_serial_port *port); |
| 130 | static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port); | 130 | static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port); |
| 131 | static void cypress_close(struct usb_serial_port *port); | 131 | static void cypress_close(struct usb_serial_port *port); |
| 132 | static void cypress_dtr_rts(struct usb_serial_port *port, int on); | 132 | static void cypress_dtr_rts(struct usb_serial_port *port, int on); |
| @@ -156,8 +156,8 @@ static struct usb_serial_driver cypress_earthmate_device = { | |||
| 156 | .description = "DeLorme Earthmate USB", | 156 | .description = "DeLorme Earthmate USB", |
| 157 | .id_table = id_table_earthmate, | 157 | .id_table = id_table_earthmate, |
| 158 | .num_ports = 1, | 158 | .num_ports = 1, |
| 159 | .attach = cypress_earthmate_startup, | 159 | .port_probe = cypress_earthmate_port_probe, |
| 160 | .release = cypress_release, | 160 | .port_remove = cypress_port_remove, |
| 161 | .open = cypress_open, | 161 | .open = cypress_open, |
| 162 | .close = cypress_close, | 162 | .close = cypress_close, |
| 163 | .dtr_rts = cypress_dtr_rts, | 163 | .dtr_rts = cypress_dtr_rts, |
| @@ -182,8 +182,8 @@ static struct usb_serial_driver cypress_hidcom_device = { | |||
| 182 | .description = "HID->COM RS232 Adapter", | 182 | .description = "HID->COM RS232 Adapter", |
| 183 | .id_table = id_table_cyphidcomrs232, | 183 | .id_table = id_table_cyphidcomrs232, |
| 184 | .num_ports = 1, | 184 | .num_ports = 1, |
| 185 | .attach = cypress_hidcom_startup, | 185 | .port_probe = cypress_hidcom_port_probe, |
| 186 | .release = cypress_release, | 186 | .port_remove = cypress_port_remove, |
| 187 | .open = cypress_open, | 187 | .open = cypress_open, |
| 188 | .close = cypress_close, | 188 | .close = cypress_close, |
| 189 | .dtr_rts = cypress_dtr_rts, | 189 | .dtr_rts = cypress_dtr_rts, |
| @@ -208,8 +208,8 @@ static struct usb_serial_driver cypress_ca42v2_device = { | |||
| 208 | .description = "Nokia CA-42 V2 Adapter", | 208 | .description = "Nokia CA-42 V2 Adapter", |
| 209 | .id_table = id_table_nokiaca42v2, | 209 | .id_table = id_table_nokiaca42v2, |
| 210 | .num_ports = 1, | 210 | .num_ports = 1, |
| 211 | .attach = cypress_ca42v2_startup, | 211 | .port_probe = cypress_ca42v2_port_probe, |
| 212 | .release = cypress_release, | 212 | .port_remove = cypress_port_remove, |
| 213 | .open = cypress_open, | 213 | .open = cypress_open, |
| 214 | .close = cypress_close, | 214 | .close = cypress_close, |
| 215 | .dtr_rts = cypress_dtr_rts, | 215 | .dtr_rts = cypress_dtr_rts, |
| @@ -438,10 +438,10 @@ static void cypress_set_dead(struct usb_serial_port *port) | |||
| 438 | *****************************************************************************/ | 438 | *****************************************************************************/ |
| 439 | 439 | ||
| 440 | 440 | ||
| 441 | static int generic_startup(struct usb_serial *serial) | 441 | static int cypress_generic_port_probe(struct usb_serial_port *port) |
| 442 | { | 442 | { |
| 443 | struct usb_serial *serial = port->serial; | ||
| 443 | struct cypress_private *priv; | 444 | struct cypress_private *priv; |
| 444 | struct usb_serial_port *port = serial->port[0]; | ||
| 445 | 445 | ||
| 446 | priv = kzalloc(sizeof(struct cypress_private), GFP_KERNEL); | 446 | priv = kzalloc(sizeof(struct cypress_private), GFP_KERNEL); |
| 447 | if (!priv) | 447 | if (!priv) |
| @@ -490,14 +490,16 @@ static int generic_startup(struct usb_serial *serial) | |||
| 490 | } | 490 | } |
| 491 | 491 | ||
| 492 | 492 | ||
| 493 | static int cypress_earthmate_startup(struct usb_serial *serial) | 493 | static int cypress_earthmate_port_probe(struct usb_serial_port *port) |
| 494 | { | 494 | { |
| 495 | struct usb_serial *serial = port->serial; | ||
| 495 | struct cypress_private *priv; | 496 | struct cypress_private *priv; |
| 496 | struct usb_serial_port *port = serial->port[0]; | 497 | int ret; |
| 497 | 498 | ||
| 498 | if (generic_startup(serial)) { | 499 | ret = cypress_generic_port_probe(port); |
| 500 | if (ret) { | ||
| 499 | dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__); | 501 | dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__); |
| 500 | return 1; | 502 | return ret; |
| 501 | } | 503 | } |
| 502 | 504 | ||
| 503 | priv = usb_get_serial_port_data(port); | 505 | priv = usb_get_serial_port_data(port); |
| @@ -518,56 +520,53 @@ static int cypress_earthmate_startup(struct usb_serial *serial) | |||
| 518 | } | 520 | } |
| 519 | 521 | ||
| 520 | return 0; | 522 | return 0; |
| 521 | } /* cypress_earthmate_startup */ | 523 | } |
| 522 | |||
| 523 | 524 | ||
| 524 | static int cypress_hidcom_startup(struct usb_serial *serial) | 525 | static int cypress_hidcom_port_probe(struct usb_serial_port *port) |
| 525 | { | 526 | { |
| 526 | struct cypress_private *priv; | 527 | struct cypress_private *priv; |
| 527 | struct usb_serial_port *port = serial->port[0]; | 528 | int ret; |
| 528 | 529 | ||
| 529 | if (generic_startup(serial)) { | 530 | ret = cypress_generic_port_probe(port); |
| 531 | if (ret) { | ||
| 530 | dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__); | 532 | dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__); |
| 531 | return 1; | 533 | return ret; |
| 532 | } | 534 | } |
| 533 | 535 | ||
| 534 | priv = usb_get_serial_port_data(port); | 536 | priv = usb_get_serial_port_data(port); |
| 535 | priv->chiptype = CT_CYPHIDCOM; | 537 | priv->chiptype = CT_CYPHIDCOM; |
| 536 | 538 | ||
| 537 | return 0; | 539 | return 0; |
| 538 | } /* cypress_hidcom_startup */ | 540 | } |
| 539 | |||
| 540 | 541 | ||
| 541 | static int cypress_ca42v2_startup(struct usb_serial *serial) | 542 | static int cypress_ca42v2_port_probe(struct usb_serial_port *port) |
| 542 | { | 543 | { |
| 543 | struct cypress_private *priv; | 544 | struct cypress_private *priv; |
| 544 | struct usb_serial_port *port = serial->port[0]; | 545 | int ret; |
| 545 | 546 | ||
| 546 | if (generic_startup(serial)) { | 547 | ret = cypress_generic_port_probe(port); |
| 548 | if (ret) { | ||
| 547 | dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__); | 549 | dev_dbg(&port->dev, "%s - Failed setting up port\n", __func__); |
| 548 | return 1; | 550 | return ret; |
| 549 | } | 551 | } |
| 550 | 552 | ||
| 551 | priv = usb_get_serial_port_data(port); | 553 | priv = usb_get_serial_port_data(port); |
| 552 | priv->chiptype = CT_CA42V2; | 554 | priv->chiptype = CT_CA42V2; |
| 553 | 555 | ||
| 554 | return 0; | 556 | return 0; |
| 555 | } /* cypress_ca42v2_startup */ | 557 | } |
| 556 | |||
| 557 | 558 | ||
| 558 | static void cypress_release(struct usb_serial *serial) | 559 | static int cypress_port_remove(struct usb_serial_port *port) |
| 559 | { | 560 | { |
| 560 | struct cypress_private *priv; | 561 | struct cypress_private *priv; |
| 561 | 562 | ||
| 562 | /* all open ports are closed at this point */ | 563 | priv = usb_get_serial_port_data(port); |
| 563 | priv = usb_get_serial_port_data(serial->port[0]); | ||
| 564 | 564 | ||
| 565 | if (priv) { | 565 | kfifo_free(&priv->write_fifo); |
| 566 | kfifo_free(&priv->write_fifo); | 566 | kfree(priv); |
| 567 | kfree(priv); | ||
| 568 | } | ||
| 569 | } | ||
| 570 | 567 | ||
| 568 | return 0; | ||
| 569 | } | ||
| 571 | 570 | ||
| 572 | static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port) | 571 | static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port) |
| 573 | { | 572 | { |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index c86f68c6b078..b50fa1c6d885 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
| @@ -244,6 +244,8 @@ static int digi_startup_device(struct usb_serial *serial); | |||
| 244 | static int digi_startup(struct usb_serial *serial); | 244 | static int digi_startup(struct usb_serial *serial); |
| 245 | static void digi_disconnect(struct usb_serial *serial); | 245 | static void digi_disconnect(struct usb_serial *serial); |
| 246 | static void digi_release(struct usb_serial *serial); | 246 | static void digi_release(struct usb_serial *serial); |
| 247 | static int digi_port_probe(struct usb_serial_port *port); | ||
| 248 | static int digi_port_remove(struct usb_serial_port *port); | ||
| 247 | static void digi_read_bulk_callback(struct urb *urb); | 249 | static void digi_read_bulk_callback(struct urb *urb); |
| 248 | static int digi_read_inb_callback(struct urb *urb); | 250 | static int digi_read_inb_callback(struct urb *urb); |
| 249 | static int digi_read_oob_callback(struct urb *urb); | 251 | static int digi_read_oob_callback(struct urb *urb); |
| @@ -294,6 +296,8 @@ static struct usb_serial_driver digi_acceleport_2_device = { | |||
| 294 | .attach = digi_startup, | 296 | .attach = digi_startup, |
| 295 | .disconnect = digi_disconnect, | 297 | .disconnect = digi_disconnect, |
| 296 | .release = digi_release, | 298 | .release = digi_release, |
| 299 | .port_probe = digi_port_probe, | ||
| 300 | .port_remove = digi_port_remove, | ||
| 297 | }; | 301 | }; |
| 298 | 302 | ||
| 299 | static struct usb_serial_driver digi_acceleport_4_device = { | 303 | static struct usb_serial_driver digi_acceleport_4_device = { |
| @@ -320,6 +324,8 @@ static struct usb_serial_driver digi_acceleport_4_device = { | |||
| 320 | .attach = digi_startup, | 324 | .attach = digi_startup, |
| 321 | .disconnect = digi_disconnect, | 325 | .disconnect = digi_disconnect, |
| 322 | .release = digi_release, | 326 | .release = digi_release, |
| 327 | .port_probe = digi_port_probe, | ||
| 328 | .port_remove = digi_port_remove, | ||
| 323 | }; | 329 | }; |
| 324 | 330 | ||
| 325 | static struct usb_serial_driver * const serial_drivers[] = { | 331 | static struct usb_serial_driver * const serial_drivers[] = { |
| @@ -1240,59 +1246,50 @@ static int digi_startup_device(struct usb_serial *serial) | |||
| 1240 | return ret; | 1246 | return ret; |
| 1241 | } | 1247 | } |
| 1242 | 1248 | ||
| 1243 | 1249 | static int digi_port_init(struct usb_serial_port *port, unsigned port_num) | |
| 1244 | static int digi_startup(struct usb_serial *serial) | ||
| 1245 | { | 1250 | { |
| 1246 | |||
| 1247 | int i; | ||
| 1248 | struct digi_port *priv; | 1251 | struct digi_port *priv; |
| 1249 | struct digi_serial *serial_priv; | ||
| 1250 | 1252 | ||
| 1251 | /* allocate the private data structures for all ports */ | 1253 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 1252 | /* number of regular ports + 1 for the out-of-band port */ | 1254 | if (!priv) |
| 1253 | for (i = 0; i < serial->type->num_ports + 1; i++) { | 1255 | return -ENOMEM; |
| 1254 | /* allocate port private structure */ | ||
| 1255 | priv = kmalloc(sizeof(struct digi_port), GFP_KERNEL); | ||
| 1256 | if (priv == NULL) { | ||
| 1257 | while (--i >= 0) | ||
| 1258 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
| 1259 | return 1; /* error */ | ||
| 1260 | } | ||
| 1261 | 1256 | ||
| 1262 | /* initialize port private structure */ | 1257 | spin_lock_init(&priv->dp_port_lock); |
| 1263 | spin_lock_init(&priv->dp_port_lock); | 1258 | priv->dp_port_num = port_num; |
| 1264 | priv->dp_port_num = i; | 1259 | init_waitqueue_head(&priv->dp_modem_change_wait); |
| 1265 | priv->dp_out_buf_len = 0; | 1260 | init_waitqueue_head(&priv->dp_transmit_idle_wait); |
| 1266 | priv->dp_write_urb_in_use = 0; | 1261 | init_waitqueue_head(&priv->dp_flush_wait); |
| 1267 | priv->dp_modem_signals = 0; | 1262 | init_waitqueue_head(&priv->dp_close_wait); |
| 1268 | init_waitqueue_head(&priv->dp_modem_change_wait); | 1263 | INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); |
| 1269 | priv->dp_transmit_idle = 0; | 1264 | priv->dp_port = port; |
| 1270 | init_waitqueue_head(&priv->dp_transmit_idle_wait); | ||
| 1271 | priv->dp_throttled = 0; | ||
| 1272 | priv->dp_throttle_restart = 0; | ||
| 1273 | init_waitqueue_head(&priv->dp_flush_wait); | ||
| 1274 | init_waitqueue_head(&priv->dp_close_wait); | ||
| 1275 | INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock); | ||
| 1276 | priv->dp_port = serial->port[i]; | ||
| 1277 | /* initialize write wait queue for this port */ | ||
| 1278 | init_waitqueue_head(&serial->port[i]->write_wait); | ||
| 1279 | |||
| 1280 | usb_set_serial_port_data(serial->port[i], priv); | ||
| 1281 | } | ||
| 1282 | 1265 | ||
| 1283 | /* allocate serial private structure */ | 1266 | init_waitqueue_head(&port->write_wait); |
| 1284 | serial_priv = kmalloc(sizeof(struct digi_serial), GFP_KERNEL); | 1267 | |
| 1285 | if (serial_priv == NULL) { | 1268 | usb_set_serial_port_data(port, priv); |
| 1286 | for (i = 0; i < serial->type->num_ports + 1; i++) | 1269 | |
| 1287 | kfree(usb_get_serial_port_data(serial->port[i])); | 1270 | return 0; |
| 1288 | return 1; /* error */ | 1271 | } |
| 1289 | } | 1272 | |
| 1273 | static int digi_startup(struct usb_serial *serial) | ||
| 1274 | { | ||
| 1275 | struct digi_serial *serial_priv; | ||
| 1276 | int ret; | ||
| 1277 | |||
| 1278 | serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL); | ||
| 1279 | if (!serial_priv) | ||
| 1280 | return -ENOMEM; | ||
| 1290 | 1281 | ||
| 1291 | /* initialize serial private structure */ | ||
| 1292 | spin_lock_init(&serial_priv->ds_serial_lock); | 1282 | spin_lock_init(&serial_priv->ds_serial_lock); |
| 1293 | serial_priv->ds_oob_port_num = serial->type->num_ports; | 1283 | serial_priv->ds_oob_port_num = serial->type->num_ports; |
| 1294 | serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; | 1284 | serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num]; |
| 1295 | serial_priv->ds_device_started = 0; | 1285 | |
| 1286 | ret = digi_port_init(serial_priv->ds_oob_port, | ||
| 1287 | serial_priv->ds_oob_port_num); | ||
| 1288 | if (ret) { | ||
| 1289 | kfree(serial_priv); | ||
| 1290 | return ret; | ||
| 1291 | } | ||
| 1292 | |||
| 1296 | usb_set_serial_data(serial, serial_priv); | 1293 | usb_set_serial_data(serial, serial_priv); |
| 1297 | 1294 | ||
| 1298 | return 0; | 1295 | return 0; |
| @@ -1313,15 +1310,35 @@ static void digi_disconnect(struct usb_serial *serial) | |||
| 1313 | 1310 | ||
| 1314 | static void digi_release(struct usb_serial *serial) | 1311 | static void digi_release(struct usb_serial *serial) |
| 1315 | { | 1312 | { |
| 1316 | int i; | 1313 | struct digi_serial *serial_priv; |
| 1314 | struct digi_port *priv; | ||
| 1315 | |||
| 1316 | serial_priv = usb_get_serial_data(serial); | ||
| 1317 | |||
| 1318 | priv = usb_get_serial_port_data(serial_priv->ds_oob_port); | ||
| 1319 | kfree(priv); | ||
| 1317 | 1320 | ||
| 1318 | /* free the private data structures for all ports */ | 1321 | kfree(serial_priv); |
| 1319 | /* number of regular ports + 1 for the out-of-band port */ | ||
| 1320 | for (i = 0; i < serial->type->num_ports + 1; i++) | ||
| 1321 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
| 1322 | kfree(usb_get_serial_data(serial)); | ||
| 1323 | } | 1322 | } |
| 1324 | 1323 | ||
| 1324 | static int digi_port_probe(struct usb_serial_port *port) | ||
| 1325 | { | ||
| 1326 | unsigned port_num; | ||
| 1327 | |||
| 1328 | port_num = port->number - port->serial->minor; | ||
| 1329 | |||
| 1330 | return digi_port_init(port, port_num); | ||
| 1331 | } | ||
| 1332 | |||
| 1333 | static int digi_port_remove(struct usb_serial_port *port) | ||
| 1334 | { | ||
| 1335 | struct digi_port *priv; | ||
| 1336 | |||
| 1337 | priv = usb_get_serial_port_data(port); | ||
| 1338 | kfree(priv); | ||
| 1339 | |||
| 1340 | return 0; | ||
| 1341 | } | ||
| 1325 | 1342 | ||
| 1326 | static void digi_read_bulk_callback(struct urb *urb) | 1343 | static void digi_read_bulk_callback(struct urb *urb) |
| 1327 | { | 1344 | { |
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c index 244477107e2f..6e4eb57d0177 100644 --- a/drivers/usb/serial/f81232.c +++ b/drivers/usb/serial/f81232.c | |||
| @@ -318,39 +318,30 @@ static int f81232_ioctl(struct tty_struct *tty, | |||
| 318 | return -ENOIOCTLCMD; | 318 | return -ENOIOCTLCMD; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | static int f81232_startup(struct usb_serial *serial) | 321 | static int f81232_port_probe(struct usb_serial_port *port) |
| 322 | { | 322 | { |
| 323 | struct f81232_private *priv; | 323 | struct f81232_private *priv; |
| 324 | int i; | ||
| 325 | 324 | ||
| 326 | for (i = 0; i < serial->num_ports; ++i) { | 325 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 327 | priv = kzalloc(sizeof(struct f81232_private), GFP_KERNEL); | 326 | if (!priv) |
| 328 | if (!priv) | 327 | return -ENOMEM; |
| 329 | goto cleanup; | ||
| 330 | spin_lock_init(&priv->lock); | ||
| 331 | init_waitqueue_head(&priv->delta_msr_wait); | ||
| 332 | usb_set_serial_port_data(serial->port[i], priv); | ||
| 333 | } | ||
| 334 | return 0; | ||
| 335 | 328 | ||
| 336 | cleanup: | 329 | spin_lock_init(&priv->lock); |
| 337 | for (--i; i >= 0; --i) { | 330 | init_waitqueue_head(&priv->delta_msr_wait); |
| 338 | priv = usb_get_serial_port_data(serial->port[i]); | 331 | |
| 339 | kfree(priv); | 332 | usb_set_serial_port_data(port, priv); |
| 340 | usb_set_serial_port_data(serial->port[i], NULL); | 333 | |
| 341 | } | 334 | return 0; |
| 342 | return -ENOMEM; | ||
| 343 | } | 335 | } |
| 344 | 336 | ||
| 345 | static void f81232_release(struct usb_serial *serial) | 337 | static int f81232_port_remove(struct usb_serial_port *port) |
| 346 | { | 338 | { |
| 347 | int i; | ||
| 348 | struct f81232_private *priv; | 339 | struct f81232_private *priv; |
| 349 | 340 | ||
| 350 | for (i = 0; i < serial->num_ports; ++i) { | 341 | priv = usb_get_serial_port_data(port); |
| 351 | priv = usb_get_serial_port_data(serial->port[i]); | 342 | kfree(priv); |
| 352 | kfree(priv); | 343 | |
| 353 | } | 344 | return 0; |
| 354 | } | 345 | } |
| 355 | 346 | ||
| 356 | static struct usb_serial_driver f81232_device = { | 347 | static struct usb_serial_driver f81232_device = { |
| @@ -373,8 +364,8 @@ static struct usb_serial_driver f81232_device = { | |||
| 373 | .tiocmset = f81232_tiocmset, | 364 | .tiocmset = f81232_tiocmset, |
| 374 | .process_read_urb = f81232_process_read_urb, | 365 | .process_read_urb = f81232_process_read_urb, |
| 375 | .read_int_callback = f81232_read_int_callback, | 366 | .read_int_callback = f81232_read_int_callback, |
| 376 | .attach = f81232_startup, | 367 | .port_probe = f81232_port_probe, |
| 377 | .release = f81232_release, | 368 | .port_remove = f81232_port_remove, |
| 378 | }; | 369 | }; |
| 379 | 370 | ||
| 380 | static struct usb_serial_driver * const serial_drivers[] = { | 371 | static struct usb_serial_driver * const serial_drivers[] = { |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 3ee92648c02d..203358d7e7bc 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
| @@ -1405,11 +1405,10 @@ static void timeout_handler(unsigned long data) | |||
| 1405 | 1405 | ||
| 1406 | 1406 | ||
| 1407 | 1407 | ||
| 1408 | static int garmin_attach(struct usb_serial *serial) | 1408 | static int garmin_port_probe(struct usb_serial_port *port) |
| 1409 | { | 1409 | { |
| 1410 | int status = 0; | 1410 | int status; |
| 1411 | struct usb_serial_port *port = serial->port[0]; | 1411 | struct garmin_data *garmin_data_p; |
| 1412 | struct garmin_data *garmin_data_p = NULL; | ||
| 1413 | 1412 | ||
| 1414 | garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL); | 1413 | garmin_data_p = kzalloc(sizeof(struct garmin_data), GFP_KERNEL); |
| 1415 | if (garmin_data_p == NULL) { | 1414 | if (garmin_data_p == NULL) { |
| @@ -1434,22 +1433,14 @@ static int garmin_attach(struct usb_serial *serial) | |||
| 1434 | } | 1433 | } |
| 1435 | 1434 | ||
| 1436 | 1435 | ||
| 1437 | static void garmin_disconnect(struct usb_serial *serial) | 1436 | static int garmin_port_remove(struct usb_serial_port *port) |
| 1438 | { | 1437 | { |
| 1439 | struct usb_serial_port *port = serial->port[0]; | ||
| 1440 | struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); | 1438 | struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); |
| 1441 | 1439 | ||
| 1442 | usb_kill_urb(port->interrupt_in_urb); | 1440 | usb_kill_urb(port->interrupt_in_urb); |
| 1443 | del_timer_sync(&garmin_data_p->timer); | 1441 | del_timer_sync(&garmin_data_p->timer); |
| 1444 | } | ||
| 1445 | |||
| 1446 | |||
| 1447 | static void garmin_release(struct usb_serial *serial) | ||
| 1448 | { | ||
| 1449 | struct usb_serial_port *port = serial->port[0]; | ||
| 1450 | struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); | ||
| 1451 | |||
| 1452 | kfree(garmin_data_p); | 1442 | kfree(garmin_data_p); |
| 1443 | return 0; | ||
| 1453 | } | 1444 | } |
| 1454 | 1445 | ||
| 1455 | 1446 | ||
| @@ -1466,9 +1457,8 @@ static struct usb_serial_driver garmin_device = { | |||
| 1466 | .close = garmin_close, | 1457 | .close = garmin_close, |
| 1467 | .throttle = garmin_throttle, | 1458 | .throttle = garmin_throttle, |
| 1468 | .unthrottle = garmin_unthrottle, | 1459 | .unthrottle = garmin_unthrottle, |
| 1469 | .attach = garmin_attach, | 1460 | .port_probe = garmin_port_probe, |
| 1470 | .disconnect = garmin_disconnect, | 1461 | .port_remove = garmin_port_remove, |
| 1471 | .release = garmin_release, | ||
| 1472 | .write = garmin_write, | 1462 | .write = garmin_write, |
| 1473 | .write_room = garmin_write_room, | 1463 | .write_room = garmin_write_room, |
| 1474 | .write_bulk_callback = garmin_write_bulk_callback, | 1464 | .write_bulk_callback = garmin_write_bulk_callback, |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 8e6faaf3580c..5acc0d13864a 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
| @@ -225,6 +225,8 @@ static int edge_get_icount(struct tty_struct *tty, | |||
| 225 | static int edge_startup(struct usb_serial *serial); | 225 | static int edge_startup(struct usb_serial *serial); |
| 226 | static void edge_disconnect(struct usb_serial *serial); | 226 | static void edge_disconnect(struct usb_serial *serial); |
| 227 | static void edge_release(struct usb_serial *serial); | 227 | static void edge_release(struct usb_serial *serial); |
| 228 | static int edge_port_probe(struct usb_serial_port *port); | ||
| 229 | static int edge_port_remove(struct usb_serial_port *port); | ||
| 228 | 230 | ||
| 229 | #include "io_tables.h" /* all of the devices that this driver supports */ | 231 | #include "io_tables.h" /* all of the devices that this driver supports */ |
| 230 | 232 | ||
| @@ -2875,10 +2877,9 @@ static void load_application_firmware(struct edgeport_serial *edge_serial) | |||
| 2875 | static int edge_startup(struct usb_serial *serial) | 2877 | static int edge_startup(struct usb_serial *serial) |
| 2876 | { | 2878 | { |
| 2877 | struct edgeport_serial *edge_serial; | 2879 | struct edgeport_serial *edge_serial; |
| 2878 | struct edgeport_port *edge_port; | ||
| 2879 | struct usb_device *dev; | 2880 | struct usb_device *dev; |
| 2880 | struct device *ddev = &serial->dev->dev; | 2881 | struct device *ddev = &serial->dev->dev; |
| 2881 | int i, j; | 2882 | int i; |
| 2882 | int response; | 2883 | int response; |
| 2883 | bool interrupt_in_found; | 2884 | bool interrupt_in_found; |
| 2884 | bool bulk_in_found; | 2885 | bool bulk_in_found; |
| @@ -2961,25 +2962,6 @@ static int edge_startup(struct usb_serial *serial) | |||
| 2961 | /* we set up the pointers to the endpoints in the edge_open function, | 2962 | /* we set up the pointers to the endpoints in the edge_open function, |
| 2962 | * as the structures aren't created yet. */ | 2963 | * as the structures aren't created yet. */ |
| 2963 | 2964 | ||
| 2964 | /* set up our port private structures */ | ||
| 2965 | for (i = 0; i < serial->num_ports; ++i) { | ||
| 2966 | edge_port = kzalloc(sizeof(struct edgeport_port), GFP_KERNEL); | ||
| 2967 | if (edge_port == NULL) { | ||
| 2968 | dev_err(ddev, "%s - Out of memory\n", __func__); | ||
| 2969 | for (j = 0; j < i; ++j) { | ||
| 2970 | kfree(usb_get_serial_port_data(serial->port[j])); | ||
| 2971 | usb_set_serial_port_data(serial->port[j], | ||
| 2972 | NULL); | ||
| 2973 | } | ||
| 2974 | usb_set_serial_data(serial, NULL); | ||
| 2975 | kfree(edge_serial); | ||
| 2976 | return -ENOMEM; | ||
| 2977 | } | ||
| 2978 | spin_lock_init(&edge_port->ep_lock); | ||
| 2979 | edge_port->port = serial->port[i]; | ||
| 2980 | usb_set_serial_port_data(serial->port[i], edge_port); | ||
| 2981 | } | ||
| 2982 | |||
| 2983 | response = 0; | 2965 | response = 0; |
| 2984 | 2966 | ||
| 2985 | if (edge_serial->is_epic) { | 2967 | if (edge_serial->is_epic) { |
| @@ -3120,14 +3102,36 @@ static void edge_disconnect(struct usb_serial *serial) | |||
| 3120 | static void edge_release(struct usb_serial *serial) | 3102 | static void edge_release(struct usb_serial *serial) |
| 3121 | { | 3103 | { |
| 3122 | struct edgeport_serial *edge_serial = usb_get_serial_data(serial); | 3104 | struct edgeport_serial *edge_serial = usb_get_serial_data(serial); |
| 3123 | int i; | ||
| 3124 | |||
| 3125 | for (i = 0; i < serial->num_ports; ++i) | ||
| 3126 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
| 3127 | 3105 | ||
| 3128 | kfree(edge_serial); | 3106 | kfree(edge_serial); |
| 3129 | } | 3107 | } |
| 3130 | 3108 | ||
| 3109 | static int edge_port_probe(struct usb_serial_port *port) | ||
| 3110 | { | ||
| 3111 | struct edgeport_port *edge_port; | ||
| 3112 | |||
| 3113 | edge_port = kzalloc(sizeof(*edge_port), GFP_KERNEL); | ||
| 3114 | if (!edge_port) | ||
| 3115 | return -ENOMEM; | ||
| 3116 | |||
| 3117 | spin_lock_init(&edge_port->ep_lock); | ||
| 3118 | edge_port->port = port; | ||
| 3119 | |||
| 3120 | usb_set_serial_port_data(port, edge_port); | ||
| 3121 | |||
| 3122 | return 0; | ||
| 3123 | } | ||
| 3124 | |||
| 3125 | static int edge_port_remove(struct usb_serial_port *port) | ||
| 3126 | { | ||
| 3127 | struct edgeport_port *edge_port; | ||
| 3128 | |||
| 3129 | edge_port = usb_get_serial_port_data(port); | ||
| 3130 | kfree(edge_port); | ||
| 3131 | |||
| 3132 | return 0; | ||
| 3133 | } | ||
| 3134 | |||
| 3131 | module_usb_serial_driver(serial_drivers, id_table_combined); | 3135 | module_usb_serial_driver(serial_drivers, id_table_combined); |
| 3132 | 3136 | ||
| 3133 | MODULE_AUTHOR(DRIVER_AUTHOR); | 3137 | MODULE_AUTHOR(DRIVER_AUTHOR); |
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h index 350afddb55ba..1511dd0ad324 100644 --- a/drivers/usb/serial/io_tables.h +++ b/drivers/usb/serial/io_tables.h | |||
| @@ -110,6 +110,8 @@ static struct usb_serial_driver edgeport_2port_device = { | |||
| 110 | .attach = edge_startup, | 110 | .attach = edge_startup, |
| 111 | .disconnect = edge_disconnect, | 111 | .disconnect = edge_disconnect, |
| 112 | .release = edge_release, | 112 | .release = edge_release, |
| 113 | .port_probe = edge_port_probe, | ||
| 114 | .port_remove = edge_port_remove, | ||
| 113 | .ioctl = edge_ioctl, | 115 | .ioctl = edge_ioctl, |
| 114 | .set_termios = edge_set_termios, | 116 | .set_termios = edge_set_termios, |
| 115 | .tiocmget = edge_tiocmget, | 117 | .tiocmget = edge_tiocmget, |
| @@ -139,6 +141,8 @@ static struct usb_serial_driver edgeport_4port_device = { | |||
| 139 | .attach = edge_startup, | 141 | .attach = edge_startup, |
| 140 | .disconnect = edge_disconnect, | 142 | .disconnect = edge_disconnect, |
| 141 | .release = edge_release, | 143 | .release = edge_release, |
| 144 | .port_probe = edge_port_probe, | ||
| 145 | .port_remove = edge_port_remove, | ||
| 142 | .ioctl = edge_ioctl, | 146 | .ioctl = edge_ioctl, |
| 143 | .set_termios = edge_set_termios, | 147 | .set_termios = edge_set_termios, |
| 144 | .tiocmget = edge_tiocmget, | 148 | .tiocmget = edge_tiocmget, |
| @@ -168,6 +172,8 @@ static struct usb_serial_driver edgeport_8port_device = { | |||
| 168 | .attach = edge_startup, | 172 | .attach = edge_startup, |
| 169 | .disconnect = edge_disconnect, | 173 | .disconnect = edge_disconnect, |
| 170 | .release = edge_release, | 174 | .release = edge_release, |
| 175 | .port_probe = edge_port_probe, | ||
| 176 | .port_remove = edge_port_remove, | ||
| 171 | .ioctl = edge_ioctl, | 177 | .ioctl = edge_ioctl, |
| 172 | .set_termios = edge_set_termios, | 178 | .set_termios = edge_set_termios, |
| 173 | .tiocmget = edge_tiocmget, | 179 | .tiocmget = edge_tiocmget, |
| @@ -197,6 +203,8 @@ static struct usb_serial_driver epic_device = { | |||
| 197 | .attach = edge_startup, | 203 | .attach = edge_startup, |
| 198 | .disconnect = edge_disconnect, | 204 | .disconnect = edge_disconnect, |
| 199 | .release = edge_release, | 205 | .release = edge_release, |
| 206 | .port_probe = edge_port_probe, | ||
| 207 | .port_remove = edge_port_remove, | ||
| 200 | .ioctl = edge_ioctl, | 208 | .ioctl = edge_ioctl, |
| 201 | .set_termios = edge_set_termios, | 209 | .set_termios = edge_set_termios, |
| 202 | .tiocmget = edge_tiocmget, | 210 | .tiocmget = edge_tiocmget, |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index a2209cd45093..60023c2d2a31 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
| @@ -2532,12 +2532,7 @@ static void edge_break(struct tty_struct *tty, int break_state) | |||
| 2532 | static int edge_startup(struct usb_serial *serial) | 2532 | static int edge_startup(struct usb_serial *serial) |
| 2533 | { | 2533 | { |
| 2534 | struct edgeport_serial *edge_serial; | 2534 | struct edgeport_serial *edge_serial; |
| 2535 | struct edgeport_port *edge_port; | ||
| 2536 | struct usb_device *dev; | ||
| 2537 | int status; | 2535 | int status; |
| 2538 | int i; | ||
| 2539 | |||
| 2540 | dev = serial->dev; | ||
| 2541 | 2536 | ||
| 2542 | /* create our private serial structure */ | 2537 | /* create our private serial structure */ |
| 2543 | edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); | 2538 | edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); |
| @@ -2555,40 +2550,7 @@ static int edge_startup(struct usb_serial *serial) | |||
| 2555 | return status; | 2550 | return status; |
| 2556 | } | 2551 | } |
| 2557 | 2552 | ||
| 2558 | /* set up our port private structures */ | ||
| 2559 | for (i = 0; i < serial->num_ports; ++i) { | ||
| 2560 | edge_port = kzalloc(sizeof(struct edgeport_port), GFP_KERNEL); | ||
| 2561 | if (edge_port == NULL) { | ||
| 2562 | dev_err(&serial->dev->dev, "%s - Out of memory\n", | ||
| 2563 | __func__); | ||
| 2564 | goto cleanup; | ||
| 2565 | } | ||
| 2566 | spin_lock_init(&edge_port->ep_lock); | ||
| 2567 | if (kfifo_alloc(&edge_port->write_fifo, EDGE_OUT_BUF_SIZE, | ||
| 2568 | GFP_KERNEL)) { | ||
| 2569 | dev_err(&serial->dev->dev, "%s - Out of memory\n", | ||
| 2570 | __func__); | ||
| 2571 | kfree(edge_port); | ||
| 2572 | goto cleanup; | ||
| 2573 | } | ||
| 2574 | edge_port->port = serial->port[i]; | ||
| 2575 | edge_port->edge_serial = edge_serial; | ||
| 2576 | usb_set_serial_port_data(serial->port[i], edge_port); | ||
| 2577 | edge_port->bUartMode = default_uart_mode; | ||
| 2578 | } | ||
| 2579 | |||
| 2580 | return 0; | 2553 | return 0; |
| 2581 | |||
| 2582 | cleanup: | ||
| 2583 | for (--i; i >= 0; --i) { | ||
| 2584 | edge_port = usb_get_serial_port_data(serial->port[i]); | ||
| 2585 | kfifo_free(&edge_port->write_fifo); | ||
| 2586 | kfree(edge_port); | ||
| 2587 | usb_set_serial_port_data(serial->port[i], NULL); | ||
| 2588 | } | ||
| 2589 | kfree(edge_serial); | ||
| 2590 | usb_set_serial_data(serial, NULL); | ||
| 2591 | return -ENOMEM; | ||
| 2592 | } | 2554 | } |
| 2593 | 2555 | ||
| 2594 | static void edge_disconnect(struct usb_serial *serial) | 2556 | static void edge_disconnect(struct usb_serial *serial) |
| @@ -2597,17 +2559,54 @@ static void edge_disconnect(struct usb_serial *serial) | |||
| 2597 | 2559 | ||
| 2598 | static void edge_release(struct usb_serial *serial) | 2560 | static void edge_release(struct usb_serial *serial) |
| 2599 | { | 2561 | { |
| 2600 | int i; | 2562 | kfree(usb_get_serial_data(serial)); |
| 2563 | } | ||
| 2564 | |||
| 2565 | static int edge_port_probe(struct usb_serial_port *port) | ||
| 2566 | { | ||
| 2601 | struct edgeport_port *edge_port; | 2567 | struct edgeport_port *edge_port; |
| 2568 | int ret; | ||
| 2602 | 2569 | ||
| 2603 | for (i = 0; i < serial->num_ports; ++i) { | 2570 | edge_port = kzalloc(sizeof(*edge_port), GFP_KERNEL); |
| 2604 | edge_port = usb_get_serial_port_data(serial->port[i]); | 2571 | if (!edge_port) |
| 2572 | return -ENOMEM; | ||
| 2573 | |||
| 2574 | ret = kfifo_alloc(&edge_port->write_fifo, EDGE_OUT_BUF_SIZE, | ||
| 2575 | GFP_KERNEL); | ||
| 2576 | if (ret) { | ||
| 2577 | kfree(edge_port); | ||
| 2578 | return -ENOMEM; | ||
| 2579 | } | ||
| 2580 | |||
| 2581 | spin_lock_init(&edge_port->ep_lock); | ||
| 2582 | edge_port->port = port; | ||
| 2583 | edge_port->edge_serial = usb_get_serial_data(port->serial); | ||
| 2584 | edge_port->bUartMode = default_uart_mode; | ||
| 2585 | |||
| 2586 | usb_set_serial_port_data(port, edge_port); | ||
| 2587 | |||
| 2588 | ret = edge_create_sysfs_attrs(port); | ||
| 2589 | if (ret) { | ||
| 2605 | kfifo_free(&edge_port->write_fifo); | 2590 | kfifo_free(&edge_port->write_fifo); |
| 2606 | kfree(edge_port); | 2591 | kfree(edge_port); |
| 2592 | return ret; | ||
| 2607 | } | 2593 | } |
| 2608 | kfree(usb_get_serial_data(serial)); | 2594 | |
| 2595 | return 0; | ||
| 2609 | } | 2596 | } |
| 2610 | 2597 | ||
| 2598 | static int edge_port_remove(struct usb_serial_port *port) | ||
| 2599 | { | ||
| 2600 | struct edgeport_port *edge_port; | ||
| 2601 | |||
| 2602 | edge_port = usb_get_serial_port_data(port); | ||
| 2603 | |||
| 2604 | edge_remove_sysfs_attrs(port); | ||
| 2605 | kfifo_free(&edge_port->write_fifo); | ||
| 2606 | kfree(edge_port); | ||
| 2607 | |||
| 2608 | return 0; | ||
| 2609 | } | ||
| 2611 | 2610 | ||
| 2612 | /* Sysfs Attributes */ | 2611 | /* Sysfs Attributes */ |
| 2613 | 2612 | ||
| @@ -2667,8 +2666,8 @@ static struct usb_serial_driver edgeport_1port_device = { | |||
| 2667 | .attach = edge_startup, | 2666 | .attach = edge_startup, |
| 2668 | .disconnect = edge_disconnect, | 2667 | .disconnect = edge_disconnect, |
| 2669 | .release = edge_release, | 2668 | .release = edge_release, |
| 2670 | .port_probe = edge_create_sysfs_attrs, | 2669 | .port_probe = edge_port_probe, |
| 2671 | .port_remove = edge_remove_sysfs_attrs, | 2670 | .port_remove = edge_port_remove, |
| 2672 | .ioctl = edge_ioctl, | 2671 | .ioctl = edge_ioctl, |
| 2673 | .set_termios = edge_set_termios, | 2672 | .set_termios = edge_set_termios, |
| 2674 | .tiocmget = edge_tiocmget, | 2673 | .tiocmget = edge_tiocmget, |
| @@ -2698,8 +2697,8 @@ static struct usb_serial_driver edgeport_2port_device = { | |||
| 2698 | .attach = edge_startup, | 2697 | .attach = edge_startup, |
| 2699 | .disconnect = edge_disconnect, | 2698 | .disconnect = edge_disconnect, |
| 2700 | .release = edge_release, | 2699 | .release = edge_release, |
| 2701 | .port_probe = edge_create_sysfs_attrs, | 2700 | .port_probe = edge_port_probe, |
| 2702 | .port_remove = edge_remove_sysfs_attrs, | 2701 | .port_remove = edge_port_remove, |
| 2703 | .ioctl = edge_ioctl, | 2702 | .ioctl = edge_ioctl, |
| 2704 | .set_termios = edge_set_termios, | 2703 | .set_termios = edge_set_termios, |
| 2705 | .tiocmget = edge_tiocmget, | 2704 | .tiocmget = edge_tiocmget, |
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index 20a132ec39e2..4264821a3b34 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
| @@ -203,8 +203,7 @@ static int ipw_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
| 203 | return 0; | 203 | return 0; |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | /* fake probe - only to allocate data structures */ | 206 | static int ipw_attach(struct usb_serial *serial) |
| 207 | static int ipw_probe(struct usb_serial *serial, const struct usb_device_id *id) | ||
| 208 | { | 207 | { |
| 209 | struct usb_wwan_intf_private *data; | 208 | struct usb_wwan_intf_private *data; |
| 210 | 209 | ||
| @@ -303,9 +302,9 @@ static struct usb_serial_driver ipw_device = { | |||
| 303 | .num_ports = 1, | 302 | .num_ports = 1, |
| 304 | .open = ipw_open, | 303 | .open = ipw_open, |
| 305 | .close = ipw_close, | 304 | .close = ipw_close, |
| 306 | .probe = ipw_probe, | 305 | .attach = ipw_attach, |
| 307 | .attach = usb_wwan_startup, | ||
| 308 | .release = ipw_release, | 306 | .release = ipw_release, |
| 307 | .port_probe = usb_wwan_port_probe, | ||
| 309 | .port_remove = usb_wwan_port_remove, | 308 | .port_remove = usb_wwan_port_remove, |
| 310 | .dtr_rts = ipw_dtr_rts, | 309 | .dtr_rts = ipw_dtr_rts, |
| 311 | .write = usb_wwan_write, | 310 | .write = usb_wwan_write, |
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 01da3ea36e89..cd5533e81de7 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
| @@ -53,6 +53,8 @@ static int iuu_cardout; | |||
| 53 | static bool xmas; | 53 | static bool xmas; |
| 54 | static int vcc_default = 5; | 54 | static int vcc_default = 5; |
| 55 | 55 | ||
| 56 | static int iuu_create_sysfs_attrs(struct usb_serial_port *port); | ||
| 57 | static int iuu_remove_sysfs_attrs(struct usb_serial_port *port); | ||
| 56 | static void read_rxcmd_callback(struct urb *urb); | 58 | static void read_rxcmd_callback(struct urb *urb); |
| 57 | 59 | ||
| 58 | struct iuu_private { | 60 | struct iuu_private { |
| @@ -72,63 +74,55 @@ struct iuu_private { | |||
| 72 | u32 clk; | 74 | u32 clk; |
| 73 | }; | 75 | }; |
| 74 | 76 | ||
| 75 | 77 | static int iuu_port_probe(struct usb_serial_port *port) | |
| 76 | static void iuu_free_buf(struct iuu_private *priv) | ||
| 77 | { | ||
| 78 | kfree(priv->buf); | ||
| 79 | kfree(priv->writebuf); | ||
| 80 | } | ||
| 81 | |||
| 82 | static int iuu_alloc_buf(struct usb_serial *serial, struct iuu_private *priv) | ||
| 83 | { | ||
| 84 | priv->buf = kzalloc(256, GFP_KERNEL); | ||
| 85 | priv->writebuf = kzalloc(256, GFP_KERNEL); | ||
| 86 | if (!priv->buf || !priv->writebuf) { | ||
| 87 | iuu_free_buf(priv); | ||
| 88 | dev_dbg(&serial->dev->dev, "%s problem allocation buffer\n", __func__); | ||
| 89 | return -ENOMEM; | ||
| 90 | } | ||
| 91 | dev_dbg(&serial->dev->dev, "%s - Privates buffers allocation success\n", __func__); | ||
| 92 | return 0; | ||
| 93 | } | ||
| 94 | |||
| 95 | static int iuu_startup(struct usb_serial *serial) | ||
| 96 | { | 78 | { |
| 97 | struct iuu_private *priv; | 79 | struct iuu_private *priv; |
| 80 | int ret; | ||
| 98 | 81 | ||
| 99 | priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL); | 82 | priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL); |
| 100 | dev_dbg(&serial->dev->dev, "%s- priv allocation success\n", __func__); | ||
| 101 | if (!priv) | 83 | if (!priv) |
| 102 | return -ENOMEM; | 84 | return -ENOMEM; |
| 103 | if (iuu_alloc_buf(serial, priv)) { | 85 | |
| 86 | priv->buf = kzalloc(256, GFP_KERNEL); | ||
| 87 | if (!priv->buf) { | ||
| 88 | kfree(priv); | ||
| 89 | return -ENOMEM; | ||
| 90 | } | ||
| 91 | |||
| 92 | priv->writebuf = kzalloc(256, GFP_KERNEL); | ||
| 93 | if (!priv->writebuf) { | ||
| 94 | kfree(priv->buf); | ||
| 104 | kfree(priv); | 95 | kfree(priv); |
| 105 | return -ENOMEM; | 96 | return -ENOMEM; |
| 106 | } | 97 | } |
| 98 | |||
| 107 | priv->vcc = vcc_default; | 99 | priv->vcc = vcc_default; |
| 108 | spin_lock_init(&priv->lock); | 100 | spin_lock_init(&priv->lock); |
| 109 | init_waitqueue_head(&priv->delta_msr_wait); | 101 | init_waitqueue_head(&priv->delta_msr_wait); |
| 110 | usb_set_serial_port_data(serial->port[0], priv); | 102 | |
| 103 | usb_set_serial_port_data(port, priv); | ||
| 104 | |||
| 105 | ret = iuu_create_sysfs_attrs(port); | ||
| 106 | if (ret) { | ||
| 107 | kfree(priv->writebuf); | ||
| 108 | kfree(priv->buf); | ||
| 109 | kfree(priv); | ||
| 110 | return ret; | ||
| 111 | } | ||
| 112 | |||
| 111 | return 0; | 113 | return 0; |
| 112 | } | 114 | } |
| 113 | 115 | ||
| 114 | /* Release function */ | 116 | static int iuu_port_remove(struct usb_serial_port *port) |
| 115 | static void iuu_release(struct usb_serial *serial) | ||
| 116 | { | 117 | { |
| 117 | struct usb_serial_port *port = serial->port[0]; | ||
| 118 | struct iuu_private *priv = usb_get_serial_port_data(port); | 118 | struct iuu_private *priv = usb_get_serial_port_data(port); |
| 119 | if (!port) | ||
| 120 | return; | ||
| 121 | 119 | ||
| 122 | if (priv) { | 120 | iuu_remove_sysfs_attrs(port); |
| 123 | iuu_free_buf(priv); | 121 | kfree(priv->writebuf); |
| 124 | dev_dbg(&port->dev, "%s - I will free all\n", __func__); | 122 | kfree(priv->buf); |
| 125 | usb_set_serial_port_data(port, NULL); | 123 | kfree(priv); |
| 126 | |||
| 127 | dev_dbg(&port->dev, "%s - priv is not anymore in port structure\n", __func__); | ||
| 128 | kfree(priv); | ||
| 129 | 124 | ||
| 130 | dev_dbg(&port->dev, "%s priv is now kfree\n", __func__); | 125 | return 0; |
| 131 | } | ||
| 132 | } | 126 | } |
| 133 | 127 | ||
| 134 | static int iuu_tiocmset(struct tty_struct *tty, | 128 | static int iuu_tiocmset(struct tty_struct *tty, |
| @@ -1215,8 +1209,6 @@ static struct usb_serial_driver iuu_device = { | |||
| 1215 | .num_ports = 1, | 1209 | .num_ports = 1, |
| 1216 | .bulk_in_size = 512, | 1210 | .bulk_in_size = 512, |
| 1217 | .bulk_out_size = 512, | 1211 | .bulk_out_size = 512, |
| 1218 | .port_probe = iuu_create_sysfs_attrs, | ||
| 1219 | .port_remove = iuu_remove_sysfs_attrs, | ||
| 1220 | .open = iuu_open, | 1212 | .open = iuu_open, |
| 1221 | .close = iuu_close, | 1213 | .close = iuu_close, |
| 1222 | .write = iuu_uart_write, | 1214 | .write = iuu_uart_write, |
| @@ -1225,8 +1217,8 @@ static struct usb_serial_driver iuu_device = { | |||
| 1225 | .tiocmset = iuu_tiocmset, | 1217 | .tiocmset = iuu_tiocmset, |
| 1226 | .set_termios = iuu_set_termios, | 1218 | .set_termios = iuu_set_termios, |
| 1227 | .init_termios = iuu_init_termios, | 1219 | .init_termios = iuu_init_termios, |
| 1228 | .attach = iuu_startup, | 1220 | .port_probe = iuu_port_probe, |
| 1229 | .release = iuu_release, | 1221 | .port_remove = iuu_port_remove, |
| 1230 | }; | 1222 | }; |
| 1231 | 1223 | ||
| 1232 | static struct usb_serial_driver * const serial_drivers[] = { | 1224 | static struct usb_serial_driver * const serial_drivers[] = { |
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 29c943d737d0..7179b0c5f814 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
| @@ -1374,13 +1374,9 @@ static struct callbacks { | |||
| 1374 | data in device_details */ | 1374 | data in device_details */ |
| 1375 | static void keyspan_setup_urbs(struct usb_serial *serial) | 1375 | static void keyspan_setup_urbs(struct usb_serial *serial) |
| 1376 | { | 1376 | { |
| 1377 | int i, j; | ||
| 1378 | struct keyspan_serial_private *s_priv; | 1377 | struct keyspan_serial_private *s_priv; |
| 1379 | const struct keyspan_device_details *d_details; | 1378 | const struct keyspan_device_details *d_details; |
| 1380 | struct usb_serial_port *port; | ||
| 1381 | struct keyspan_port_private *p_priv; | ||
| 1382 | struct callbacks *cback; | 1379 | struct callbacks *cback; |
| 1383 | int endp; | ||
| 1384 | 1380 | ||
| 1385 | s_priv = usb_get_serial_data(serial); | 1381 | s_priv = usb_get_serial_data(serial); |
| 1386 | d_details = s_priv->device_details; | 1382 | d_details = s_priv->device_details; |
| @@ -1404,45 +1400,6 @@ static void keyspan_setup_urbs(struct usb_serial *serial) | |||
| 1404 | (serial, d_details->glocont_endpoint, USB_DIR_OUT, | 1400 | (serial, d_details->glocont_endpoint, USB_DIR_OUT, |
| 1405 | serial, s_priv->glocont_buf, GLOCONT_BUFLEN, | 1401 | serial, s_priv->glocont_buf, GLOCONT_BUFLEN, |
| 1406 | cback->glocont_callback); | 1402 | cback->glocont_callback); |
| 1407 | |||
| 1408 | /* Setup endpoints for each port specific thing */ | ||
| 1409 | for (i = 0; i < d_details->num_ports; i++) { | ||
| 1410 | port = serial->port[i]; | ||
| 1411 | p_priv = usb_get_serial_port_data(port); | ||
| 1412 | |||
| 1413 | /* Do indat endpoints first, once for each flip */ | ||
| 1414 | endp = d_details->indat_endpoints[i]; | ||
| 1415 | for (j = 0; j <= d_details->indat_endp_flip; ++j, ++endp) { | ||
| 1416 | p_priv->in_urbs[j] = keyspan_setup_urb | ||
| 1417 | (serial, endp, USB_DIR_IN, port, | ||
| 1418 | p_priv->in_buffer[j], 64, | ||
| 1419 | cback->indat_callback); | ||
| 1420 | } | ||
| 1421 | for (; j < 2; ++j) | ||
| 1422 | p_priv->in_urbs[j] = NULL; | ||
| 1423 | |||
| 1424 | /* outdat endpoints also have flip */ | ||
| 1425 | endp = d_details->outdat_endpoints[i]; | ||
| 1426 | for (j = 0; j <= d_details->outdat_endp_flip; ++j, ++endp) { | ||
| 1427 | p_priv->out_urbs[j] = keyspan_setup_urb | ||
| 1428 | (serial, endp, USB_DIR_OUT, port, | ||
| 1429 | p_priv->out_buffer[j], 64, | ||
| 1430 | cback->outdat_callback); | ||
| 1431 | } | ||
| 1432 | for (; j < 2; ++j) | ||
| 1433 | p_priv->out_urbs[j] = NULL; | ||
| 1434 | |||
| 1435 | /* inack endpoint */ | ||
| 1436 | p_priv->inack_urb = keyspan_setup_urb | ||
| 1437 | (serial, d_details->inack_endpoints[i], USB_DIR_IN, | ||
| 1438 | port, p_priv->inack_buffer, 1, cback->inack_callback); | ||
| 1439 | |||
| 1440 | /* outcont endpoint */ | ||
| 1441 | p_priv->outcont_urb = keyspan_setup_urb | ||
| 1442 | (serial, d_details->outcont_endpoints[i], USB_DIR_OUT, | ||
| 1443 | port, p_priv->outcont_buffer, 64, | ||
| 1444 | cback->outcont_callback); | ||
| 1445 | } | ||
| 1446 | } | 1403 | } |
| 1447 | 1404 | ||
| 1448 | /* usa19 function doesn't require prescaler */ | 1405 | /* usa19 function doesn't require prescaler */ |
| @@ -2407,9 +2364,7 @@ static void keyspan_send_setup(struct usb_serial_port *port, int reset_port) | |||
| 2407 | static int keyspan_startup(struct usb_serial *serial) | 2364 | static int keyspan_startup(struct usb_serial *serial) |
| 2408 | { | 2365 | { |
| 2409 | int i, err; | 2366 | int i, err; |
| 2410 | struct usb_serial_port *port; | ||
| 2411 | struct keyspan_serial_private *s_priv; | 2367 | struct keyspan_serial_private *s_priv; |
| 2412 | struct keyspan_port_private *p_priv; | ||
| 2413 | const struct keyspan_device_details *d_details; | 2368 | const struct keyspan_device_details *d_details; |
| 2414 | 2369 | ||
| 2415 | for (i = 0; (d_details = keyspan_devices[i]) != NULL; ++i) | 2370 | for (i = 0; (d_details = keyspan_devices[i]) != NULL; ++i) |
| @@ -2432,19 +2387,6 @@ static int keyspan_startup(struct usb_serial *serial) | |||
| 2432 | s_priv->device_details = d_details; | 2387 | s_priv->device_details = d_details; |
| 2433 | usb_set_serial_data(serial, s_priv); | 2388 | usb_set_serial_data(serial, s_priv); |
| 2434 | 2389 | ||
| 2435 | /* Now setup per port private data */ | ||
| 2436 | for (i = 0; i < serial->num_ports; i++) { | ||
| 2437 | port = serial->port[i]; | ||
| 2438 | p_priv = kzalloc(sizeof(struct keyspan_port_private), | ||
| 2439 | GFP_KERNEL); | ||
| 2440 | if (!p_priv) { | ||
| 2441 | dev_dbg(&port->dev, "%s - kmalloc for keyspan_port_private (%d) failed!.\n", __func__, i); | ||
| 2442 | return 1; | ||
| 2443 | } | ||
| 2444 | p_priv->device_details = d_details; | ||
| 2445 | usb_set_serial_port_data(port, p_priv); | ||
| 2446 | } | ||
| 2447 | |||
| 2448 | keyspan_setup_urbs(serial); | 2390 | keyspan_setup_urbs(serial); |
| 2449 | 2391 | ||
| 2450 | if (s_priv->instat_urb != NULL) { | 2392 | if (s_priv->instat_urb != NULL) { |
| @@ -2463,59 +2405,112 @@ static int keyspan_startup(struct usb_serial *serial) | |||
| 2463 | 2405 | ||
| 2464 | static void keyspan_disconnect(struct usb_serial *serial) | 2406 | static void keyspan_disconnect(struct usb_serial *serial) |
| 2465 | { | 2407 | { |
| 2466 | int i, j; | 2408 | struct keyspan_serial_private *s_priv; |
| 2467 | struct usb_serial_port *port; | ||
| 2468 | struct keyspan_serial_private *s_priv; | ||
| 2469 | struct keyspan_port_private *p_priv; | ||
| 2470 | 2409 | ||
| 2471 | s_priv = usb_get_serial_data(serial); | 2410 | s_priv = usb_get_serial_data(serial); |
| 2472 | 2411 | ||
| 2473 | /* Stop reading/writing urbs */ | ||
| 2474 | stop_urb(s_priv->instat_urb); | 2412 | stop_urb(s_priv->instat_urb); |
| 2475 | stop_urb(s_priv->glocont_urb); | 2413 | stop_urb(s_priv->glocont_urb); |
| 2476 | stop_urb(s_priv->indat_urb); | 2414 | stop_urb(s_priv->indat_urb); |
| 2477 | for (i = 0; i < serial->num_ports; ++i) { | 2415 | } |
| 2478 | port = serial->port[i]; | 2416 | |
| 2479 | p_priv = usb_get_serial_port_data(port); | 2417 | static void keyspan_release(struct usb_serial *serial) |
| 2480 | stop_urb(p_priv->inack_urb); | 2418 | { |
| 2481 | stop_urb(p_priv->outcont_urb); | 2419 | struct keyspan_serial_private *s_priv; |
| 2482 | for (j = 0; j < 2; j++) { | 2420 | |
| 2483 | stop_urb(p_priv->in_urbs[j]); | 2421 | s_priv = usb_get_serial_data(serial); |
| 2484 | stop_urb(p_priv->out_urbs[j]); | ||
| 2485 | } | ||
| 2486 | } | ||
| 2487 | 2422 | ||
| 2488 | /* Now free them */ | ||
| 2489 | usb_free_urb(s_priv->instat_urb); | 2423 | usb_free_urb(s_priv->instat_urb); |
| 2490 | usb_free_urb(s_priv->indat_urb); | 2424 | usb_free_urb(s_priv->indat_urb); |
| 2491 | usb_free_urb(s_priv->glocont_urb); | 2425 | usb_free_urb(s_priv->glocont_urb); |
| 2492 | for (i = 0; i < serial->num_ports; ++i) { | 2426 | |
| 2493 | port = serial->port[i]; | 2427 | kfree(s_priv); |
| 2494 | p_priv = usb_get_serial_port_data(port); | ||
| 2495 | usb_free_urb(p_priv->inack_urb); | ||
| 2496 | usb_free_urb(p_priv->outcont_urb); | ||
| 2497 | for (j = 0; j < 2; j++) { | ||
| 2498 | usb_free_urb(p_priv->in_urbs[j]); | ||
| 2499 | usb_free_urb(p_priv->out_urbs[j]); | ||
| 2500 | } | ||
| 2501 | } | ||
| 2502 | } | 2428 | } |
| 2503 | 2429 | ||
| 2504 | static void keyspan_release(struct usb_serial *serial) | 2430 | static int keyspan_port_probe(struct usb_serial_port *port) |
| 2505 | { | 2431 | { |
| 2506 | int i; | 2432 | struct usb_serial *serial = port->serial; |
| 2507 | struct usb_serial_port *port; | 2433 | struct keyspan_port_private *s_priv; |
| 2508 | struct keyspan_serial_private *s_priv; | 2434 | struct keyspan_port_private *p_priv; |
| 2435 | const struct keyspan_device_details *d_details; | ||
| 2436 | struct callbacks *cback; | ||
| 2437 | int endp; | ||
| 2438 | int port_num; | ||
| 2439 | int i; | ||
| 2509 | 2440 | ||
| 2510 | s_priv = usb_get_serial_data(serial); | 2441 | s_priv = usb_get_serial_data(serial); |
| 2442 | d_details = s_priv->device_details; | ||
| 2511 | 2443 | ||
| 2512 | kfree(s_priv); | 2444 | p_priv = kzalloc(sizeof(*p_priv), GFP_KERNEL); |
| 2445 | if (!p_priv) | ||
| 2446 | return -ENOMEM; | ||
| 2513 | 2447 | ||
| 2514 | /* Now free per port private data */ | 2448 | s_priv = usb_get_serial_data(port->serial); |
| 2515 | for (i = 0; i < serial->num_ports; i++) { | 2449 | p_priv->device_details = d_details; |
| 2516 | port = serial->port[i]; | 2450 | |
| 2517 | kfree(usb_get_serial_port_data(port)); | 2451 | /* Setup values for the various callback routines */ |
| 2452 | cback = &keyspan_callbacks[d_details->msg_format]; | ||
| 2453 | |||
| 2454 | port_num = port->number - port->serial->minor; | ||
| 2455 | |||
| 2456 | /* Do indat endpoints first, once for each flip */ | ||
| 2457 | endp = d_details->indat_endpoints[port_num]; | ||
| 2458 | for (i = 0; i <= d_details->indat_endp_flip; ++i, ++endp) { | ||
| 2459 | p_priv->in_urbs[i] = keyspan_setup_urb(serial, endp, | ||
| 2460 | USB_DIR_IN, port, | ||
| 2461 | p_priv->in_buffer[i], 64, | ||
| 2462 | cback->indat_callback); | ||
| 2463 | } | ||
| 2464 | /* outdat endpoints also have flip */ | ||
| 2465 | endp = d_details->outdat_endpoints[port_num]; | ||
| 2466 | for (i = 0; i <= d_details->outdat_endp_flip; ++i, ++endp) { | ||
| 2467 | p_priv->out_urbs[i] = keyspan_setup_urb(serial, endp, | ||
| 2468 | USB_DIR_OUT, port, | ||
| 2469 | p_priv->out_buffer[i], 64, | ||
| 2470 | cback->outdat_callback); | ||
| 2471 | } | ||
| 2472 | /* inack endpoint */ | ||
| 2473 | p_priv->inack_urb = keyspan_setup_urb(serial, | ||
| 2474 | d_details->inack_endpoints[port_num], | ||
| 2475 | USB_DIR_IN, port, | ||
| 2476 | p_priv->inack_buffer, 1, | ||
| 2477 | cback->inack_callback); | ||
| 2478 | /* outcont endpoint */ | ||
| 2479 | p_priv->outcont_urb = keyspan_setup_urb(serial, | ||
| 2480 | d_details->outcont_endpoints[port_num], | ||
| 2481 | USB_DIR_OUT, port, | ||
| 2482 | p_priv->outcont_buffer, 64, | ||
| 2483 | cback->outcont_callback); | ||
| 2484 | |||
| 2485 | usb_set_serial_port_data(port, p_priv); | ||
| 2486 | |||
| 2487 | return 0; | ||
| 2488 | } | ||
| 2489 | |||
| 2490 | static int keyspan_port_remove(struct usb_serial_port *port) | ||
| 2491 | { | ||
| 2492 | struct keyspan_port_private *p_priv; | ||
| 2493 | int i; | ||
| 2494 | |||
| 2495 | p_priv = usb_get_serial_port_data(port); | ||
| 2496 | |||
| 2497 | stop_urb(p_priv->inack_urb); | ||
| 2498 | stop_urb(p_priv->outcont_urb); | ||
| 2499 | for (i = 0; i < 2; i++) { | ||
| 2500 | stop_urb(p_priv->in_urbs[i]); | ||
| 2501 | stop_urb(p_priv->out_urbs[i]); | ||
| 2502 | } | ||
| 2503 | |||
| 2504 | usb_free_urb(p_priv->inack_urb); | ||
| 2505 | usb_free_urb(p_priv->outcont_urb); | ||
| 2506 | for (i = 0; i < 2; i++) { | ||
| 2507 | usb_free_urb(p_priv->in_urbs[i]); | ||
| 2508 | usb_free_urb(p_priv->out_urbs[i]); | ||
| 2518 | } | 2509 | } |
| 2510 | |||
| 2511 | kfree(p_priv); | ||
| 2512 | |||
| 2513 | return 0; | ||
| 2519 | } | 2514 | } |
| 2520 | 2515 | ||
| 2521 | MODULE_AUTHOR(DRIVER_AUTHOR); | 2516 | MODULE_AUTHOR(DRIVER_AUTHOR); |
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h index 0a8a40b5711e..0273dda303a4 100644 --- a/drivers/usb/serial/keyspan.h +++ b/drivers/usb/serial/keyspan.h | |||
| @@ -42,6 +42,8 @@ static void keyspan_dtr_rts (struct usb_serial_port *port, int on); | |||
| 42 | static int keyspan_startup (struct usb_serial *serial); | 42 | static int keyspan_startup (struct usb_serial *serial); |
| 43 | static void keyspan_disconnect (struct usb_serial *serial); | 43 | static void keyspan_disconnect (struct usb_serial *serial); |
| 44 | static void keyspan_release (struct usb_serial *serial); | 44 | static void keyspan_release (struct usb_serial *serial); |
| 45 | static int keyspan_port_probe(struct usb_serial_port *port); | ||
| 46 | static int keyspan_port_remove(struct usb_serial_port *port); | ||
| 45 | static int keyspan_write_room (struct tty_struct *tty); | 47 | static int keyspan_write_room (struct tty_struct *tty); |
| 46 | 48 | ||
| 47 | static int keyspan_write (struct tty_struct *tty, | 49 | static int keyspan_write (struct tty_struct *tty, |
| @@ -567,6 +569,8 @@ static struct usb_serial_driver keyspan_1port_device = { | |||
| 567 | .attach = keyspan_startup, | 569 | .attach = keyspan_startup, |
| 568 | .disconnect = keyspan_disconnect, | 570 | .disconnect = keyspan_disconnect, |
| 569 | .release = keyspan_release, | 571 | .release = keyspan_release, |
| 572 | .port_probe = keyspan_port_probe, | ||
| 573 | .port_remove = keyspan_port_remove, | ||
| 570 | }; | 574 | }; |
| 571 | 575 | ||
| 572 | static struct usb_serial_driver keyspan_2port_device = { | 576 | static struct usb_serial_driver keyspan_2port_device = { |
| @@ -589,6 +593,8 @@ static struct usb_serial_driver keyspan_2port_device = { | |||
| 589 | .attach = keyspan_startup, | 593 | .attach = keyspan_startup, |
| 590 | .disconnect = keyspan_disconnect, | 594 | .disconnect = keyspan_disconnect, |
| 591 | .release = keyspan_release, | 595 | .release = keyspan_release, |
| 596 | .port_probe = keyspan_port_probe, | ||
| 597 | .port_remove = keyspan_port_remove, | ||
| 592 | }; | 598 | }; |
| 593 | 599 | ||
| 594 | static struct usb_serial_driver keyspan_4port_device = { | 600 | static struct usb_serial_driver keyspan_4port_device = { |
| @@ -611,6 +617,8 @@ static struct usb_serial_driver keyspan_4port_device = { | |||
| 611 | .attach = keyspan_startup, | 617 | .attach = keyspan_startup, |
| 612 | .disconnect = keyspan_disconnect, | 618 | .disconnect = keyspan_disconnect, |
| 613 | .release = keyspan_release, | 619 | .release = keyspan_release, |
| 620 | .port_probe = keyspan_port_probe, | ||
| 621 | .port_remove = keyspan_port_remove, | ||
| 614 | }; | 622 | }; |
| 615 | 623 | ||
| 616 | static struct usb_serial_driver * const serial_drivers[] = { | 624 | static struct usb_serial_driver * const serial_drivers[] = { |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index ca43ecb4a2bd..bb87e29c4ac2 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
| @@ -713,29 +713,33 @@ MODULE_FIRMWARE("keyspan_pda/keyspan_pda.fw"); | |||
| 713 | MODULE_FIRMWARE("keyspan_pda/xircom_pgs.fw"); | 713 | MODULE_FIRMWARE("keyspan_pda/xircom_pgs.fw"); |
| 714 | #endif | 714 | #endif |
| 715 | 715 | ||
| 716 | static int keyspan_pda_startup(struct usb_serial *serial) | 716 | static int keyspan_pda_port_probe(struct usb_serial_port *port) |
| 717 | { | 717 | { |
| 718 | 718 | ||
| 719 | struct keyspan_pda_private *priv; | 719 | struct keyspan_pda_private *priv; |
| 720 | 720 | ||
| 721 | /* allocate the private data structures for all ports. Well, for all | ||
| 722 | one ports. */ | ||
| 723 | |||
| 724 | priv = kmalloc(sizeof(struct keyspan_pda_private), GFP_KERNEL); | 721 | priv = kmalloc(sizeof(struct keyspan_pda_private), GFP_KERNEL); |
| 725 | if (!priv) | 722 | if (!priv) |
| 726 | return 1; /* error */ | 723 | return -ENOMEM; |
| 727 | usb_set_serial_port_data(serial->port[0], priv); | 724 | |
| 728 | init_waitqueue_head(&serial->port[0]->write_wait); | ||
| 729 | INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write); | 725 | INIT_WORK(&priv->wakeup_work, keyspan_pda_wakeup_write); |
| 730 | INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle); | 726 | INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle); |
| 731 | priv->serial = serial; | 727 | priv->serial = port->serial; |
| 732 | priv->port = serial->port[0]; | 728 | priv->port = port; |
| 729 | |||
| 730 | usb_set_serial_port_data(port, priv); | ||
| 731 | |||
| 733 | return 0; | 732 | return 0; |
| 734 | } | 733 | } |
| 735 | 734 | ||
| 736 | static void keyspan_pda_release(struct usb_serial *serial) | 735 | static int keyspan_pda_port_remove(struct usb_serial_port *port) |
| 737 | { | 736 | { |
| 738 | kfree(usb_get_serial_port_data(serial->port[0])); | 737 | struct keyspan_pda_private *priv; |
| 738 | |||
| 739 | priv = usb_get_serial_port_data(port); | ||
| 740 | kfree(priv); | ||
| 741 | |||
| 742 | return 0; | ||
| 739 | } | 743 | } |
| 740 | 744 | ||
| 741 | #ifdef KEYSPAN | 745 | #ifdef KEYSPAN |
| @@ -786,8 +790,8 @@ static struct usb_serial_driver keyspan_pda_device = { | |||
| 786 | .break_ctl = keyspan_pda_break_ctl, | 790 | .break_ctl = keyspan_pda_break_ctl, |
| 787 | .tiocmget = keyspan_pda_tiocmget, | 791 | .tiocmget = keyspan_pda_tiocmget, |
| 788 | .tiocmset = keyspan_pda_tiocmset, | 792 | .tiocmset = keyspan_pda_tiocmset, |
| 789 | .attach = keyspan_pda_startup, | 793 | .port_probe = keyspan_pda_port_probe, |
| 790 | .release = keyspan_pda_release, | 794 | .port_remove = keyspan_pda_port_remove, |
| 791 | }; | 795 | }; |
| 792 | 796 | ||
| 793 | static struct usb_serial_driver * const serial_drivers[] = { | 797 | static struct usb_serial_driver * const serial_drivers[] = { |
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index 3f6d7376c02d..1f4517864cd2 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c | |||
| @@ -60,8 +60,8 @@ | |||
| 60 | /* | 60 | /* |
| 61 | * Function prototypes | 61 | * Function prototypes |
| 62 | */ | 62 | */ |
| 63 | static int klsi_105_startup(struct usb_serial *serial); | 63 | static int klsi_105_port_probe(struct usb_serial_port *port); |
| 64 | static void klsi_105_release(struct usb_serial *serial); | 64 | static int klsi_105_port_remove(struct usb_serial_port *port); |
| 65 | static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port); | 65 | static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port); |
| 66 | static void klsi_105_close(struct usb_serial_port *port); | 66 | static void klsi_105_close(struct usb_serial_port *port); |
| 67 | static void klsi_105_set_termios(struct tty_struct *tty, | 67 | static void klsi_105_set_termios(struct tty_struct *tty, |
| @@ -99,8 +99,8 @@ static struct usb_serial_driver kl5kusb105d_device = { | |||
| 99 | /*.break_ctl = klsi_105_break_ctl,*/ | 99 | /*.break_ctl = klsi_105_break_ctl,*/ |
| 100 | .tiocmget = klsi_105_tiocmget, | 100 | .tiocmget = klsi_105_tiocmget, |
| 101 | .tiocmset = klsi_105_tiocmset, | 101 | .tiocmset = klsi_105_tiocmset, |
| 102 | .attach = klsi_105_startup, | 102 | .port_probe = klsi_105_port_probe, |
| 103 | .release = klsi_105_release, | 103 | .port_remove = klsi_105_port_remove, |
| 104 | .throttle = usb_serial_generic_throttle, | 104 | .throttle = usb_serial_generic_throttle, |
| 105 | .unthrottle = usb_serial_generic_unthrottle, | 105 | .unthrottle = usb_serial_generic_unthrottle, |
| 106 | .process_read_urb = klsi_105_process_read_urb, | 106 | .process_read_urb = klsi_105_process_read_urb, |
| @@ -223,60 +223,40 @@ static int klsi_105_get_line_state(struct usb_serial_port *port, | |||
| 223 | * Driver's tty interface functions | 223 | * Driver's tty interface functions |
| 224 | */ | 224 | */ |
| 225 | 225 | ||
| 226 | static int klsi_105_startup(struct usb_serial *serial) | 226 | static int klsi_105_port_probe(struct usb_serial_port *port) |
| 227 | { | 227 | { |
| 228 | struct klsi_105_private *priv; | 228 | struct klsi_105_private *priv; |
| 229 | int i; | ||
| 230 | 229 | ||
| 231 | /* check if we support the product id (see keyspan.c) | 230 | priv = kmalloc(sizeof(*priv), GFP_KERNEL); |
| 232 | * FIXME | 231 | if (!priv) |
| 233 | */ | 232 | return -ENOMEM; |
| 234 | 233 | ||
| 235 | /* allocate the private data structure */ | 234 | /* set initial values for control structures */ |
| 236 | for (i = 0; i < serial->num_ports; i++) { | 235 | priv->cfg.pktlen = 5; |
| 237 | priv = kmalloc(sizeof(struct klsi_105_private), | 236 | priv->cfg.baudrate = kl5kusb105a_sio_b9600; |
| 238 | GFP_KERNEL); | 237 | priv->cfg.databits = kl5kusb105a_dtb_8; |
| 239 | if (!priv) { | 238 | priv->cfg.unknown1 = 0; |
| 240 | dev_dbg(&serial->interface->dev, | 239 | priv->cfg.unknown2 = 1; |
| 241 | "%s - kmalloc for klsi_105_private failed.\n", | ||
| 242 | __func__); | ||
| 243 | i--; | ||
| 244 | goto err_cleanup; | ||
| 245 | } | ||
| 246 | /* set initial values for control structures */ | ||
| 247 | priv->cfg.pktlen = 5; | ||
| 248 | priv->cfg.baudrate = kl5kusb105a_sio_b9600; | ||
| 249 | priv->cfg.databits = kl5kusb105a_dtb_8; | ||
| 250 | priv->cfg.unknown1 = 0; | ||
| 251 | priv->cfg.unknown2 = 1; | ||
| 252 | 240 | ||
| 253 | priv->line_state = 0; | 241 | priv->line_state = 0; |
| 254 | 242 | ||
| 255 | usb_set_serial_port_data(serial->port[i], priv); | 243 | spin_lock_init(&priv->lock); |
| 256 | 244 | ||
| 257 | spin_lock_init(&priv->lock); | 245 | /* priv->termios is left uninitialized until port opening */ |
| 258 | 246 | ||
| 259 | /* priv->termios is left uninitialized until port opening */ | 247 | usb_set_serial_port_data(port, priv); |
| 260 | init_waitqueue_head(&serial->port[i]->write_wait); | ||
| 261 | } | ||
| 262 | 248 | ||
| 263 | return 0; | 249 | return 0; |
| 264 | |||
| 265 | err_cleanup: | ||
| 266 | for (; i >= 0; i--) { | ||
| 267 | priv = usb_get_serial_port_data(serial->port[i]); | ||
| 268 | kfree(priv); | ||
| 269 | usb_set_serial_port_data(serial->port[i], NULL); | ||
| 270 | } | ||
| 271 | return -ENOMEM; | ||
| 272 | } | 250 | } |
| 273 | 251 | ||
| 274 | static void klsi_105_release(struct usb_serial *serial) | 252 | static int klsi_105_port_remove(struct usb_serial_port *port) |
| 275 | { | 253 | { |
| 276 | int i; | 254 | struct klsi_105_private *priv; |
| 255 | |||
| 256 | priv = usb_get_serial_port_data(port); | ||
| 257 | kfree(priv); | ||
| 277 | 258 | ||
| 278 | for (i = 0; i < serial->num_ports; ++i) | 259 | return 0; |
| 279 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
| 280 | } | 260 | } |
| 281 | 261 | ||
| 282 | static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port) | 262 | static int klsi_105_open(struct tty_struct *tty, struct usb_serial_port *port) |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 5c4d2fbd4e11..c9ca7a5b12e0 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
| @@ -54,8 +54,8 @@ | |||
| 54 | 54 | ||
| 55 | 55 | ||
| 56 | /* Function prototypes */ | 56 | /* Function prototypes */ |
| 57 | static int kobil_startup(struct usb_serial *serial); | 57 | static int kobil_port_probe(struct usb_serial_port *probe); |
| 58 | static void kobil_release(struct usb_serial *serial); | 58 | static int kobil_port_remove(struct usb_serial_port *probe); |
| 59 | static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port); | 59 | static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port); |
| 60 | static void kobil_close(struct usb_serial_port *port); | 60 | static void kobil_close(struct usb_serial_port *port); |
| 61 | static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, | 61 | static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, |
| @@ -89,8 +89,8 @@ static struct usb_serial_driver kobil_device = { | |||
| 89 | .description = "KOBIL USB smart card terminal", | 89 | .description = "KOBIL USB smart card terminal", |
| 90 | .id_table = id_table, | 90 | .id_table = id_table, |
| 91 | .num_ports = 1, | 91 | .num_ports = 1, |
| 92 | .attach = kobil_startup, | 92 | .port_probe = kobil_port_probe, |
| 93 | .release = kobil_release, | 93 | .port_remove = kobil_port_remove, |
| 94 | .ioctl = kobil_ioctl, | 94 | .ioctl = kobil_ioctl, |
| 95 | .set_termios = kobil_set_termios, | 95 | .set_termios = kobil_set_termios, |
| 96 | .init_termios = kobil_init_termios, | 96 | .init_termios = kobil_init_termios, |
| @@ -117,9 +117,10 @@ struct kobil_private { | |||
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | 119 | ||
| 120 | static int kobil_startup(struct usb_serial *serial) | 120 | static int kobil_port_probe(struct usb_serial_port *port) |
| 121 | { | 121 | { |
| 122 | int i; | 122 | int i; |
| 123 | struct usb_serial *serial = port->serial; | ||
| 123 | struct kobil_private *priv; | 124 | struct kobil_private *priv; |
| 124 | struct usb_device *pdev; | 125 | struct usb_device *pdev; |
| 125 | struct usb_host_config *actconfig; | 126 | struct usb_host_config *actconfig; |
| @@ -149,7 +150,7 @@ static int kobil_startup(struct usb_serial *serial) | |||
| 149 | dev_dbg(&serial->dev->dev, "KOBIL KAAN SIM detected\n"); | 150 | dev_dbg(&serial->dev->dev, "KOBIL KAAN SIM detected\n"); |
| 150 | break; | 151 | break; |
| 151 | } | 152 | } |
| 152 | usb_set_serial_port_data(serial->port[0], priv); | 153 | usb_set_serial_port_data(port, priv); |
| 153 | 154 | ||
| 154 | /* search for the necessary endpoints */ | 155 | /* search for the necessary endpoints */ |
| 155 | pdev = serial->dev; | 156 | pdev = serial->dev; |
| @@ -179,12 +180,14 @@ static int kobil_startup(struct usb_serial *serial) | |||
| 179 | } | 180 | } |
| 180 | 181 | ||
| 181 | 182 | ||
| 182 | static void kobil_release(struct usb_serial *serial) | 183 | static int kobil_port_remove(struct usb_serial_port *port) |
| 183 | { | 184 | { |
| 184 | int i; | 185 | struct kobil_private *priv; |
| 185 | 186 | ||
| 186 | for (i = 0; i < serial->num_ports; ++i) | 187 | priv = usb_get_serial_port_data(port); |
| 187 | kfree(usb_get_serial_port_data(serial->port[i])); | 188 | kfree(priv); |
| 189 | |||
| 190 | return 0; | ||
| 188 | } | 191 | } |
| 189 | 192 | ||
| 190 | static void kobil_init_termios(struct tty_struct *tty) | 193 | static void kobil_init_termios(struct tty_struct *tty) |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index f3947712e137..8a2081004107 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
| @@ -49,7 +49,8 @@ | |||
| 49 | * Function prototypes | 49 | * Function prototypes |
| 50 | */ | 50 | */ |
| 51 | static int mct_u232_startup(struct usb_serial *serial); | 51 | static int mct_u232_startup(struct usb_serial *serial); |
| 52 | static void mct_u232_release(struct usb_serial *serial); | 52 | static int mct_u232_port_probe(struct usb_serial_port *port); |
| 53 | static int mct_u232_port_remove(struct usb_serial_port *remove); | ||
| 53 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port); | 54 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port); |
| 54 | static void mct_u232_close(struct usb_serial_port *port); | 55 | static void mct_u232_close(struct usb_serial_port *port); |
| 55 | static void mct_u232_dtr_rts(struct usb_serial_port *port, int on); | 56 | static void mct_u232_dtr_rts(struct usb_serial_port *port, int on); |
| @@ -99,7 +100,8 @@ static struct usb_serial_driver mct_u232_device = { | |||
| 99 | .tiocmget = mct_u232_tiocmget, | 100 | .tiocmget = mct_u232_tiocmget, |
| 100 | .tiocmset = mct_u232_tiocmset, | 101 | .tiocmset = mct_u232_tiocmset, |
| 101 | .attach = mct_u232_startup, | 102 | .attach = mct_u232_startup, |
| 102 | .release = mct_u232_release, | 103 | .port_probe = mct_u232_port_probe, |
| 104 | .port_remove = mct_u232_port_remove, | ||
| 103 | .ioctl = mct_u232_ioctl, | 105 | .ioctl = mct_u232_ioctl, |
| 104 | .get_icount = mct_u232_get_icount, | 106 | .get_icount = mct_u232_get_icount, |
| 105 | }; | 107 | }; |
| @@ -388,18 +390,8 @@ static void mct_u232_msr_to_state(struct usb_serial_port *port, | |||
| 388 | 390 | ||
| 389 | static int mct_u232_startup(struct usb_serial *serial) | 391 | static int mct_u232_startup(struct usb_serial *serial) |
| 390 | { | 392 | { |
| 391 | struct mct_u232_private *priv; | ||
| 392 | struct usb_serial_port *port, *rport; | 393 | struct usb_serial_port *port, *rport; |
| 393 | 394 | ||
| 394 | priv = kzalloc(sizeof(struct mct_u232_private), GFP_KERNEL); | ||
| 395 | if (!priv) | ||
| 396 | return -ENOMEM; | ||
| 397 | spin_lock_init(&priv->lock); | ||
| 398 | init_waitqueue_head(&priv->msr_wait); | ||
| 399 | usb_set_serial_port_data(serial->port[0], priv); | ||
| 400 | |||
| 401 | init_waitqueue_head(&serial->port[0]->write_wait); | ||
| 402 | |||
| 403 | /* Puh, that's dirty */ | 395 | /* Puh, that's dirty */ |
| 404 | port = serial->port[0]; | 396 | port = serial->port[0]; |
| 405 | rport = serial->port[1]; | 397 | rport = serial->port[1]; |
| @@ -412,18 +404,31 @@ static int mct_u232_startup(struct usb_serial *serial) | |||
| 412 | return 0; | 404 | return 0; |
| 413 | } /* mct_u232_startup */ | 405 | } /* mct_u232_startup */ |
| 414 | 406 | ||
| 407 | static int mct_u232_port_probe(struct usb_serial_port *port) | ||
| 408 | { | ||
| 409 | struct mct_u232_private *priv; | ||
| 410 | |||
| 411 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
| 412 | if (!priv) | ||
| 413 | return -ENOMEM; | ||
| 414 | |||
| 415 | spin_lock_init(&priv->lock); | ||
| 416 | init_waitqueue_head(&priv->msr_wait); | ||
| 417 | |||
| 418 | usb_set_serial_port_data(port, priv); | ||
| 415 | 419 | ||
| 416 | static void mct_u232_release(struct usb_serial *serial) | 420 | return 0; |
| 421 | } | ||
| 422 | |||
| 423 | static int mct_u232_port_remove(struct usb_serial_port *port) | ||
| 417 | { | 424 | { |
| 418 | struct mct_u232_private *priv; | 425 | struct mct_u232_private *priv; |
| 419 | int i; | ||
| 420 | 426 | ||
| 421 | for (i = 0; i < serial->num_ports; ++i) { | 427 | priv = usb_get_serial_port_data(port); |
| 422 | /* My special items, the standard routines free my urbs */ | 428 | kfree(priv); |
| 423 | priv = usb_get_serial_port_data(serial->port[i]); | 429 | |
| 424 | kfree(priv); | 430 | return 0; |
| 425 | } | 431 | } |
| 426 | } /* mct_u232_release */ | ||
| 427 | 432 | ||
| 428 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port) | 433 | static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port) |
| 429 | { | 434 | { |
| @@ -515,12 +520,14 @@ static void mct_u232_dtr_rts(struct usb_serial_port *port, int on) | |||
| 515 | 520 | ||
| 516 | static void mct_u232_close(struct usb_serial_port *port) | 521 | static void mct_u232_close(struct usb_serial_port *port) |
| 517 | { | 522 | { |
| 518 | if (port->serial->dev) { | 523 | /* |
| 519 | /* shutdown our urbs */ | 524 | * Must kill the read urb as it is actually an interrupt urb, which |
| 520 | usb_kill_urb(port->write_urb); | 525 | * generic close thus fails to kill. |
| 521 | usb_kill_urb(port->read_urb); | 526 | */ |
| 522 | usb_kill_urb(port->interrupt_in_urb); | 527 | usb_kill_urb(port->read_urb); |
| 523 | } | 528 | usb_kill_urb(port->interrupt_in_urb); |
| 529 | |||
| 530 | usb_serial_generic_close(port); | ||
| 524 | } /* mct_u232_close */ | 531 | } /* mct_u232_close */ |
| 525 | 532 | ||
| 526 | 533 | ||
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 0b257ddffbdb..6f29c74eb769 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
| @@ -179,16 +179,13 @@ static void metrousb_cleanup(struct usb_serial_port *port) | |||
| 179 | { | 179 | { |
| 180 | dev_dbg(&port->dev, "%s\n", __func__); | 180 | dev_dbg(&port->dev, "%s\n", __func__); |
| 181 | 181 | ||
| 182 | if (port->serial->dev) { | 182 | usb_unlink_urb(port->interrupt_in_urb); |
| 183 | /* Shutdown any interrupt in urbs. */ | 183 | usb_kill_urb(port->interrupt_in_urb); |
| 184 | if (port->interrupt_in_urb) { | 184 | |
| 185 | usb_unlink_urb(port->interrupt_in_urb); | 185 | mutex_lock(&port->serial->disc_mutex); |
| 186 | usb_kill_urb(port->interrupt_in_urb); | 186 | if (!port->serial->disconnected) |
| 187 | } | ||
| 188 | |||
| 189 | /* Send deactivate cmd to device */ | ||
| 190 | metrousb_send_unidirectional_cmd(UNI_CMD_CLOSE, port); | 187 | metrousb_send_unidirectional_cmd(UNI_CMD_CLOSE, port); |
| 191 | } | 188 | mutex_unlock(&port->serial->disc_mutex); |
| 192 | } | 189 | } |
| 193 | 190 | ||
| 194 | static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) | 191 | static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) |
| @@ -271,51 +268,27 @@ static int metrousb_set_modem_ctrl(struct usb_serial *serial, unsigned int contr | |||
| 271 | return retval; | 268 | return retval; |
| 272 | } | 269 | } |
| 273 | 270 | ||
| 274 | static void metrousb_shutdown(struct usb_serial *serial) | 271 | static int metrousb_port_probe(struct usb_serial_port *port) |
| 275 | { | 272 | { |
| 276 | int i = 0; | 273 | struct metrousb_private *metro_priv; |
| 277 | 274 | ||
| 278 | dev_dbg(&serial->dev->dev, "%s\n", __func__); | 275 | metro_priv = kzalloc(sizeof(*metro_priv), GFP_KERNEL); |
| 276 | if (!metro_priv) | ||
| 277 | return -ENOMEM; | ||
| 279 | 278 | ||
| 280 | /* Stop reading and writing on all ports. */ | 279 | spin_lock_init(&metro_priv->lock); |
| 281 | for (i = 0; i < serial->num_ports; ++i) { | ||
| 282 | /* Close any open urbs. */ | ||
| 283 | metrousb_cleanup(serial->port[i]); | ||
| 284 | 280 | ||
| 285 | /* Free memory. */ | 281 | usb_set_serial_port_data(port, metro_priv); |
| 286 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
| 287 | usb_set_serial_port_data(serial->port[i], NULL); | ||
| 288 | 282 | ||
| 289 | dev_dbg(&serial->dev->dev, "%s - freed port number=%d\n", | 283 | return 0; |
| 290 | __func__, serial->port[i]->number); | ||
| 291 | } | ||
| 292 | } | 284 | } |
| 293 | 285 | ||
| 294 | static int metrousb_startup(struct usb_serial *serial) | 286 | static int metrousb_port_remove(struct usb_serial_port *port) |
| 295 | { | 287 | { |
| 296 | struct metrousb_private *metro_priv; | 288 | struct metrousb_private *metro_priv; |
| 297 | struct usb_serial_port *port; | ||
| 298 | int i = 0; | ||
| 299 | 289 | ||
| 300 | dev_dbg(&serial->dev->dev, "%s\n", __func__); | 290 | metro_priv = usb_get_serial_port_data(port); |
| 301 | 291 | kfree(metro_priv); | |
| 302 | /* Loop through the serial ports setting up the private structures. | ||
| 303 | * Currently we only use one port. */ | ||
| 304 | for (i = 0; i < serial->num_ports; ++i) { | ||
| 305 | port = serial->port[i]; | ||
| 306 | |||
| 307 | /* Declare memory. */ | ||
| 308 | metro_priv = kzalloc(sizeof(struct metrousb_private), GFP_KERNEL); | ||
| 309 | if (!metro_priv) | ||
| 310 | return -ENOMEM; | ||
| 311 | |||
| 312 | /* Initialize memory. */ | ||
| 313 | spin_lock_init(&metro_priv->lock); | ||
| 314 | usb_set_serial_port_data(port, metro_priv); | ||
| 315 | |||
| 316 | dev_dbg(&serial->dev->dev, "%s - port number=%d\n ", | ||
| 317 | __func__, port->number); | ||
| 318 | } | ||
| 319 | 292 | ||
| 320 | return 0; | 293 | return 0; |
| 321 | } | 294 | } |
| @@ -414,8 +387,8 @@ static struct usb_serial_driver metrousb_device = { | |||
| 414 | .close = metrousb_cleanup, | 387 | .close = metrousb_cleanup, |
| 415 | .read_int_callback = metrousb_read_int_callback, | 388 | .read_int_callback = metrousb_read_int_callback, |
| 416 | .write_int_callback = metrousb_write_int_callback, | 389 | .write_int_callback = metrousb_write_int_callback, |
| 417 | .attach = metrousb_startup, | 390 | .port_probe = metrousb_port_probe, |
| 418 | .release = metrousb_shutdown, | 391 | .port_remove = metrousb_port_remove, |
| 419 | .throttle = metrousb_throttle, | 392 | .throttle = metrousb_throttle, |
| 420 | .unthrottle = metrousb_unthrottle, | 393 | .unthrottle = metrousb_unthrottle, |
| 421 | .tiocmget = metrousb_tiocmget, | 394 | .tiocmget = metrousb_tiocmget, |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 1bf1ad066666..75267421aad8 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
| @@ -1966,9 +1966,7 @@ static int mos7720_ioctl(struct tty_struct *tty, | |||
| 1966 | 1966 | ||
| 1967 | static int mos7720_startup(struct usb_serial *serial) | 1967 | static int mos7720_startup(struct usb_serial *serial) |
| 1968 | { | 1968 | { |
| 1969 | struct moschip_port *mos7720_port; | ||
| 1970 | struct usb_device *dev; | 1969 | struct usb_device *dev; |
| 1971 | int i; | ||
| 1972 | char data; | 1970 | char data; |
| 1973 | u16 product; | 1971 | u16 product; |
| 1974 | int ret_val; | 1972 | int ret_val; |
| @@ -1999,29 +1997,6 @@ static int mos7720_startup(struct usb_serial *serial) | |||
| 1999 | serial->port[1]->interrupt_in_buffer = NULL; | 1997 | serial->port[1]->interrupt_in_buffer = NULL; |
| 2000 | } | 1998 | } |
| 2001 | 1999 | ||
| 2002 | |||
| 2003 | /* set up serial port private structures */ | ||
| 2004 | for (i = 0; i < serial->num_ports; ++i) { | ||
| 2005 | mos7720_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); | ||
| 2006 | if (mos7720_port == NULL) { | ||
| 2007 | dev_err(&dev->dev, "%s - Out of memory\n", __func__); | ||
| 2008 | return -ENOMEM; | ||
| 2009 | } | ||
| 2010 | |||
| 2011 | /* Initialize all port interrupt end point to port 0 int | ||
| 2012 | * endpoint. Our device has only one interrupt endpoint | ||
| 2013 | * common to all ports */ | ||
| 2014 | serial->port[i]->interrupt_in_endpointAddress = | ||
| 2015 | serial->port[0]->interrupt_in_endpointAddress; | ||
| 2016 | |||
| 2017 | mos7720_port->port = serial->port[i]; | ||
| 2018 | usb_set_serial_port_data(serial->port[i], mos7720_port); | ||
| 2019 | |||
| 2020 | dev_dbg(&dev->dev, "port number is %d\n", serial->port[i]->number); | ||
| 2021 | dev_dbg(&dev->dev, "serial number is %d\n", serial->minor); | ||
| 2022 | } | ||
| 2023 | |||
| 2024 | |||
| 2025 | /* setting configuration feature to one */ | 2000 | /* setting configuration feature to one */ |
| 2026 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 2001 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
| 2027 | (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ); | 2002 | (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ); |
| @@ -2049,8 +2024,6 @@ static int mos7720_startup(struct usb_serial *serial) | |||
| 2049 | 2024 | ||
| 2050 | static void mos7720_release(struct usb_serial *serial) | 2025 | static void mos7720_release(struct usb_serial *serial) |
| 2051 | { | 2026 | { |
| 2052 | int i; | ||
| 2053 | |||
| 2054 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT | 2027 | #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT |
| 2055 | /* close the parallel port */ | 2028 | /* close the parallel port */ |
| 2056 | 2029 | ||
| @@ -2089,9 +2062,36 @@ static void mos7720_release(struct usb_serial *serial) | |||
| 2089 | kref_put(&mos_parport->ref_count, destroy_mos_parport); | 2062 | kref_put(&mos_parport->ref_count, destroy_mos_parport); |
| 2090 | } | 2063 | } |
| 2091 | #endif | 2064 | #endif |
| 2092 | /* free private structure allocated for serial port */ | 2065 | } |
| 2093 | for (i = 0; i < serial->num_ports; ++i) | 2066 | |
| 2094 | kfree(usb_get_serial_port_data(serial->port[i])); | 2067 | static int mos7720_port_probe(struct usb_serial_port *port) |
| 2068 | { | ||
| 2069 | struct moschip_port *mos7720_port; | ||
| 2070 | |||
| 2071 | mos7720_port = kzalloc(sizeof(*mos7720_port), GFP_KERNEL); | ||
| 2072 | if (!mos7720_port) | ||
| 2073 | return -ENOMEM; | ||
| 2074 | |||
| 2075 | /* Initialize all port interrupt end point to port 0 int endpoint. | ||
| 2076 | * Our device has only one interrupt endpoint common to all ports. | ||
| 2077 | */ | ||
| 2078 | port->interrupt_in_endpointAddress = | ||
| 2079 | port->serial->port[0]->interrupt_in_endpointAddress; | ||
| 2080 | mos7720_port->port = port; | ||
| 2081 | |||
| 2082 | usb_set_serial_port_data(port, mos7720_port); | ||
| 2083 | |||
| 2084 | return 0; | ||
| 2085 | } | ||
| 2086 | |||
| 2087 | static int mos7720_port_remove(struct usb_serial_port *port) | ||
| 2088 | { | ||
| 2089 | struct moschip_port *mos7720_port; | ||
| 2090 | |||
| 2091 | mos7720_port = usb_get_serial_port_data(port); | ||
| 2092 | kfree(mos7720_port); | ||
| 2093 | |||
| 2094 | return 0; | ||
| 2095 | } | 2095 | } |
| 2096 | 2096 | ||
| 2097 | static struct usb_serial_driver moschip7720_2port_driver = { | 2097 | static struct usb_serial_driver moschip7720_2port_driver = { |
| @@ -2109,6 +2109,8 @@ static struct usb_serial_driver moschip7720_2port_driver = { | |||
| 2109 | .probe = mos77xx_probe, | 2109 | .probe = mos77xx_probe, |
| 2110 | .attach = mos7720_startup, | 2110 | .attach = mos7720_startup, |
| 2111 | .release = mos7720_release, | 2111 | .release = mos7720_release, |
| 2112 | .port_probe = mos7720_port_probe, | ||
| 2113 | .port_remove = mos7720_port_remove, | ||
| 2112 | .ioctl = mos7720_ioctl, | 2114 | .ioctl = mos7720_ioctl, |
| 2113 | .tiocmget = mos7720_tiocmget, | 2115 | .tiocmget = mos7720_tiocmget, |
| 2114 | .tiocmset = mos7720_tiocmset, | 2116 | .tiocmset = mos7720_tiocmset, |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index d6d4eeca8c68..1cf3375ec1af 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
| @@ -218,12 +218,10 @@ struct moschip_port { | |||
| 218 | int port_num; /*Actual port number in the device(1,2,etc) */ | 218 | int port_num; /*Actual port number in the device(1,2,etc) */ |
| 219 | struct urb *write_urb; /* write URB for this port */ | 219 | struct urb *write_urb; /* write URB for this port */ |
| 220 | struct urb *read_urb; /* read URB for this port */ | 220 | struct urb *read_urb; /* read URB for this port */ |
| 221 | struct urb *int_urb; | ||
| 222 | __u8 shadowLCR; /* last LCR value received */ | 221 | __u8 shadowLCR; /* last LCR value received */ |
| 223 | __u8 shadowMCR; /* last MCR value received */ | 222 | __u8 shadowMCR; /* last MCR value received */ |
| 224 | char open; | 223 | char open; |
| 225 | char open_ports; | 224 | char open_ports; |
| 226 | char zombie; | ||
| 227 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ | 225 | wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */ |
| 228 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ | 226 | wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */ |
| 229 | int delta_msr_cond; | 227 | int delta_msr_cond; |
| @@ -478,7 +476,6 @@ static void mos7840_control_callback(struct urb *urb) | |||
| 478 | struct moschip_port *mos7840_port; | 476 | struct moschip_port *mos7840_port; |
| 479 | struct device *dev = &urb->dev->dev; | 477 | struct device *dev = &urb->dev->dev; |
| 480 | __u8 regval = 0x0; | 478 | __u8 regval = 0x0; |
| 481 | int result = 0; | ||
| 482 | int status = urb->status; | 479 | int status = urb->status; |
| 483 | 480 | ||
| 484 | mos7840_port = urb->context; | 481 | mos7840_port = urb->context; |
| @@ -495,7 +492,7 @@ static void mos7840_control_callback(struct urb *urb) | |||
| 495 | return; | 492 | return; |
| 496 | default: | 493 | default: |
| 497 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); | 494 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); |
| 498 | goto exit; | 495 | return; |
| 499 | } | 496 | } |
| 500 | 497 | ||
| 501 | dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); | 498 | dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); |
| @@ -508,16 +505,6 @@ static void mos7840_control_callback(struct urb *urb) | |||
| 508 | mos7840_handle_new_msr(mos7840_port, regval); | 505 | mos7840_handle_new_msr(mos7840_port, regval); |
| 509 | else if (mos7840_port->MsrLsr == 1) | 506 | else if (mos7840_port->MsrLsr == 1) |
| 510 | mos7840_handle_new_lsr(mos7840_port, regval); | 507 | mos7840_handle_new_lsr(mos7840_port, regval); |
| 511 | |||
| 512 | exit: | ||
| 513 | spin_lock(&mos7840_port->pool_lock); | ||
| 514 | if (!mos7840_port->zombie) | ||
| 515 | result = usb_submit_urb(mos7840_port->int_urb, GFP_ATOMIC); | ||
| 516 | spin_unlock(&mos7840_port->pool_lock); | ||
| 517 | if (result) { | ||
| 518 | dev_err(dev, "%s - Error %d submitting interrupt urb\n", | ||
| 519 | __func__, result); | ||
| 520 | } | ||
| 521 | } | 508 | } |
| 522 | 509 | ||
| 523 | static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, | 510 | static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, |
| @@ -686,14 +673,7 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
| 686 | wreg = MODEM_STATUS_REGISTER; | 673 | wreg = MODEM_STATUS_REGISTER; |
| 687 | break; | 674 | break; |
| 688 | } | 675 | } |
| 689 | spin_lock(&mos7840_port->pool_lock); | 676 | rv = mos7840_get_reg(mos7840_port, wval, wreg, &Data); |
| 690 | if (!mos7840_port->zombie) { | ||
| 691 | rv = mos7840_get_reg(mos7840_port, wval, wreg, &Data); | ||
| 692 | } else { | ||
| 693 | spin_unlock(&mos7840_port->pool_lock); | ||
| 694 | return; | ||
| 695 | } | ||
| 696 | spin_unlock(&mos7840_port->pool_lock); | ||
| 697 | } | 677 | } |
| 698 | } | 678 | } |
| 699 | } | 679 | } |
| @@ -2347,309 +2327,249 @@ static int mos7840_calc_num_ports(struct usb_serial *serial) | |||
| 2347 | return mos7840_num_ports; | 2327 | return mos7840_num_ports; |
| 2348 | } | 2328 | } |
| 2349 | 2329 | ||
| 2350 | /**************************************************************************** | 2330 | static int mos7840_port_probe(struct usb_serial_port *port) |
| 2351 | * mos7840_startup | ||
| 2352 | ****************************************************************************/ | ||
| 2353 | |||
| 2354 | static int mos7840_startup(struct usb_serial *serial) | ||
| 2355 | { | 2331 | { |
| 2332 | struct usb_serial *serial = port->serial; | ||
| 2356 | struct moschip_port *mos7840_port; | 2333 | struct moschip_port *mos7840_port; |
| 2357 | struct usb_device *dev; | 2334 | int status; |
| 2358 | int i, status; | 2335 | int pnum; |
| 2359 | __u16 Data; | 2336 | __u16 Data; |
| 2360 | 2337 | ||
| 2361 | dev = serial->dev; | ||
| 2362 | |||
| 2363 | /* we set up the pointers to the endpoints in the mos7840_open * | 2338 | /* we set up the pointers to the endpoints in the mos7840_open * |
| 2364 | * function, as the structures aren't created yet. */ | 2339 | * function, as the structures aren't created yet. */ |
| 2365 | 2340 | ||
| 2366 | /* set up port private structures */ | 2341 | pnum = port->number - serial->minor; |
| 2367 | for (i = 0; i < serial->num_ports; ++i) { | ||
| 2368 | dev_dbg(&dev->dev, "mos7840_startup: configuring port %d............\n", i); | ||
| 2369 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); | ||
| 2370 | if (mos7840_port == NULL) { | ||
| 2371 | dev_err(&dev->dev, "%s - Out of memory\n", __func__); | ||
| 2372 | status = -ENOMEM; | ||
| 2373 | i--; /* don't follow NULL pointer cleaning up */ | ||
| 2374 | goto error; | ||
| 2375 | } | ||
| 2376 | |||
| 2377 | /* Initialize all port interrupt end point to port 0 int | ||
| 2378 | * endpoint. Our device has only one interrupt end point | ||
| 2379 | * common to all port */ | ||
| 2380 | |||
| 2381 | mos7840_port->port = serial->port[i]; | ||
| 2382 | mos7840_set_port_private(serial->port[i], mos7840_port); | ||
| 2383 | spin_lock_init(&mos7840_port->pool_lock); | ||
| 2384 | |||
| 2385 | /* minor is not initialised until later by | ||
| 2386 | * usb-serial.c:get_free_serial() and cannot therefore be used | ||
| 2387 | * to index device instances */ | ||
| 2388 | mos7840_port->port_num = i + 1; | ||
| 2389 | dev_dbg(&dev->dev, "serial->port[i]->number = %d\n", serial->port[i]->number); | ||
| 2390 | dev_dbg(&dev->dev, "serial->port[i]->serial->minor = %d\n", serial->port[i]->serial->minor); | ||
| 2391 | dev_dbg(&dev->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num); | ||
| 2392 | dev_dbg(&dev->dev, "serial->minor = %d\n", serial->minor); | ||
| 2393 | |||
| 2394 | if (mos7840_port->port_num == 1) { | ||
| 2395 | mos7840_port->SpRegOffset = 0x0; | ||
| 2396 | mos7840_port->ControlRegOffset = 0x1; | ||
| 2397 | mos7840_port->DcrRegOffset = 0x4; | ||
| 2398 | } else if ((mos7840_port->port_num == 2) | ||
| 2399 | && (serial->num_ports == 4)) { | ||
| 2400 | mos7840_port->SpRegOffset = 0x8; | ||
| 2401 | mos7840_port->ControlRegOffset = 0x9; | ||
| 2402 | mos7840_port->DcrRegOffset = 0x16; | ||
| 2403 | } else if ((mos7840_port->port_num == 2) | ||
| 2404 | && (serial->num_ports == 2)) { | ||
| 2405 | mos7840_port->SpRegOffset = 0xa; | ||
| 2406 | mos7840_port->ControlRegOffset = 0xb; | ||
| 2407 | mos7840_port->DcrRegOffset = 0x19; | ||
| 2408 | } else if ((mos7840_port->port_num == 3) | ||
| 2409 | && (serial->num_ports == 4)) { | ||
| 2410 | mos7840_port->SpRegOffset = 0xa; | ||
| 2411 | mos7840_port->ControlRegOffset = 0xb; | ||
| 2412 | mos7840_port->DcrRegOffset = 0x19; | ||
| 2413 | } else if ((mos7840_port->port_num == 4) | ||
| 2414 | && (serial->num_ports == 4)) { | ||
| 2415 | mos7840_port->SpRegOffset = 0xc; | ||
| 2416 | mos7840_port->ControlRegOffset = 0xd; | ||
| 2417 | mos7840_port->DcrRegOffset = 0x1c; | ||
| 2418 | } | ||
| 2419 | mos7840_dump_serial_port(serial->port[i], mos7840_port); | ||
| 2420 | mos7840_set_port_private(serial->port[i], mos7840_port); | ||
| 2421 | 2342 | ||
| 2422 | /* enable rx_disable bit in control register */ | 2343 | dev_dbg(&port->dev, "mos7840_startup: configuring port %d\n", pnum); |
| 2423 | status = mos7840_get_reg_sync(serial->port[i], | 2344 | mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); |
| 2424 | mos7840_port->ControlRegOffset, &Data); | 2345 | if (mos7840_port == NULL) { |
| 2425 | if (status < 0) { | 2346 | dev_err(&port->dev, "%s - Out of memory\n", __func__); |
| 2426 | dev_dbg(&dev->dev, "Reading ControlReg failed status-0x%x\n", status); | 2347 | return -ENOMEM; |
| 2427 | break; | 2348 | } |
| 2428 | } else | ||
| 2429 | dev_dbg(&dev->dev, "ControlReg Reading success val is %x, status%d\n", Data, status); | ||
| 2430 | Data |= 0x08; /* setting driver done bit */ | ||
| 2431 | Data |= 0x04; /* sp1_bit to have cts change reflect in | ||
| 2432 | modem status reg */ | ||
| 2433 | |||
| 2434 | /* Data |= 0x20; //rx_disable bit */ | ||
| 2435 | status = mos7840_set_reg_sync(serial->port[i], | ||
| 2436 | mos7840_port->ControlRegOffset, Data); | ||
| 2437 | if (status < 0) { | ||
| 2438 | dev_dbg(&dev->dev, "Writing ControlReg failed(rx_disable) status-0x%x\n", status); | ||
| 2439 | break; | ||
| 2440 | } else | ||
| 2441 | dev_dbg(&dev->dev, "ControlReg Writing success(rx_disable) status%d\n", status); | ||
| 2442 | 2349 | ||
| 2443 | /* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2 | 2350 | /* Initialize all port interrupt end point to port 0 int |
| 2444 | and 0x24 in DCR3 */ | 2351 | * endpoint. Our device has only one interrupt end point |
| 2445 | Data = 0x01; | 2352 | * common to all port */ |
| 2446 | status = mos7840_set_reg_sync(serial->port[i], | 2353 | |
| 2447 | (__u16) (mos7840_port->DcrRegOffset + 0), Data); | 2354 | mos7840_port->port = port; |
| 2448 | if (status < 0) { | 2355 | mos7840_set_port_private(port, mos7840_port); |
| 2449 | dev_dbg(&dev->dev, "Writing DCR0 failed status-0x%x\n", status); | 2356 | spin_lock_init(&mos7840_port->pool_lock); |
| 2450 | break; | 2357 | |
| 2451 | } else | 2358 | /* minor is not initialised until later by |
| 2452 | dev_dbg(&dev->dev, "DCR0 Writing success status%d\n", status); | 2359 | * usb-serial.c:get_free_serial() and cannot therefore be used |
| 2360 | * to index device instances */ | ||
| 2361 | mos7840_port->port_num = pnum + 1; | ||
| 2362 | dev_dbg(&port->dev, "port->number = %d\n", port->number); | ||
| 2363 | dev_dbg(&port->dev, "port->serial->minor = %d\n", port->serial->minor); | ||
| 2364 | dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num); | ||
| 2365 | dev_dbg(&port->dev, "serial->minor = %d\n", serial->minor); | ||
| 2366 | |||
| 2367 | if (mos7840_port->port_num == 1) { | ||
| 2368 | mos7840_port->SpRegOffset = 0x0; | ||
| 2369 | mos7840_port->ControlRegOffset = 0x1; | ||
| 2370 | mos7840_port->DcrRegOffset = 0x4; | ||
| 2371 | } else if ((mos7840_port->port_num == 2) && (serial->num_ports == 4)) { | ||
| 2372 | mos7840_port->SpRegOffset = 0x8; | ||
| 2373 | mos7840_port->ControlRegOffset = 0x9; | ||
| 2374 | mos7840_port->DcrRegOffset = 0x16; | ||
| 2375 | } else if ((mos7840_port->port_num == 2) && (serial->num_ports == 2)) { | ||
| 2376 | mos7840_port->SpRegOffset = 0xa; | ||
| 2377 | mos7840_port->ControlRegOffset = 0xb; | ||
| 2378 | mos7840_port->DcrRegOffset = 0x19; | ||
| 2379 | } else if ((mos7840_port->port_num == 3) && (serial->num_ports == 4)) { | ||
| 2380 | mos7840_port->SpRegOffset = 0xa; | ||
| 2381 | mos7840_port->ControlRegOffset = 0xb; | ||
| 2382 | mos7840_port->DcrRegOffset = 0x19; | ||
| 2383 | } else if ((mos7840_port->port_num == 4) && (serial->num_ports == 4)) { | ||
| 2384 | mos7840_port->SpRegOffset = 0xc; | ||
| 2385 | mos7840_port->ControlRegOffset = 0xd; | ||
| 2386 | mos7840_port->DcrRegOffset = 0x1c; | ||
| 2387 | } | ||
| 2388 | mos7840_dump_serial_port(port, mos7840_port); | ||
| 2389 | mos7840_set_port_private(port, mos7840_port); | ||
| 2390 | |||
| 2391 | /* enable rx_disable bit in control register */ | ||
| 2392 | status = mos7840_get_reg_sync(port, | ||
| 2393 | mos7840_port->ControlRegOffset, &Data); | ||
| 2394 | if (status < 0) { | ||
| 2395 | dev_dbg(&port->dev, "Reading ControlReg failed status-0x%x\n", status); | ||
| 2396 | goto out; | ||
| 2397 | } else | ||
| 2398 | dev_dbg(&port->dev, "ControlReg Reading success val is %x, status%d\n", Data, status); | ||
| 2399 | Data |= 0x08; /* setting driver done bit */ | ||
| 2400 | Data |= 0x04; /* sp1_bit to have cts change reflect in | ||
| 2401 | modem status reg */ | ||
| 2453 | 2402 | ||
| 2454 | Data = 0x05; | 2403 | /* Data |= 0x20; //rx_disable bit */ |
| 2455 | status = mos7840_set_reg_sync(serial->port[i], | 2404 | status = mos7840_set_reg_sync(port, |
| 2456 | (__u16) (mos7840_port->DcrRegOffset + 1), Data); | 2405 | mos7840_port->ControlRegOffset, Data); |
| 2457 | if (status < 0) { | 2406 | if (status < 0) { |
| 2458 | dev_dbg(&dev->dev, "Writing DCR1 failed status-0x%x\n", status); | 2407 | dev_dbg(&port->dev, "Writing ControlReg failed(rx_disable) status-0x%x\n", status); |
| 2459 | break; | 2408 | goto out; |
| 2460 | } else | 2409 | } else |
| 2461 | dev_dbg(&dev->dev, "DCR1 Writing success status%d\n", status); | 2410 | dev_dbg(&port->dev, "ControlReg Writing success(rx_disable) status%d\n", status); |
| 2462 | 2411 | ||
| 2463 | Data = 0x24; | 2412 | /* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2 |
| 2464 | status = mos7840_set_reg_sync(serial->port[i], | 2413 | and 0x24 in DCR3 */ |
| 2465 | (__u16) (mos7840_port->DcrRegOffset + 2), Data); | 2414 | Data = 0x01; |
| 2466 | if (status < 0) { | 2415 | status = mos7840_set_reg_sync(port, |
| 2467 | dev_dbg(&dev->dev, "Writing DCR2 failed status-0x%x\n", status); | 2416 | (__u16) (mos7840_port->DcrRegOffset + 0), Data); |
| 2468 | break; | 2417 | if (status < 0) { |
| 2469 | } else | 2418 | dev_dbg(&port->dev, "Writing DCR0 failed status-0x%x\n", status); |
| 2470 | dev_dbg(&dev->dev, "DCR2 Writing success status%d\n", status); | 2419 | goto out; |
| 2420 | } else | ||
| 2421 | dev_dbg(&port->dev, "DCR0 Writing success status%d\n", status); | ||
| 2471 | 2422 | ||
| 2472 | /* write values in clkstart0x0 and clkmulti 0x20 */ | 2423 | Data = 0x05; |
| 2473 | Data = 0x0; | 2424 | status = mos7840_set_reg_sync(port, |
| 2474 | status = mos7840_set_reg_sync(serial->port[i], | 2425 | (__u16) (mos7840_port->DcrRegOffset + 1), Data); |
| 2475 | CLK_START_VALUE_REGISTER, Data); | 2426 | if (status < 0) { |
| 2476 | if (status < 0) { | 2427 | dev_dbg(&port->dev, "Writing DCR1 failed status-0x%x\n", status); |
| 2477 | dev_dbg(&dev->dev, "Writing CLK_START_VALUE_REGISTER failed status-0x%x\n", status); | 2428 | goto out; |
| 2478 | break; | 2429 | } else |
| 2479 | } else | 2430 | dev_dbg(&port->dev, "DCR1 Writing success status%d\n", status); |
| 2480 | dev_dbg(&dev->dev, "CLK_START_VALUE_REGISTER Writing success status%d\n", status); | ||
| 2481 | 2431 | ||
| 2482 | Data = 0x20; | 2432 | Data = 0x24; |
| 2483 | status = mos7840_set_reg_sync(serial->port[i], | 2433 | status = mos7840_set_reg_sync(port, |
| 2484 | CLK_MULTI_REGISTER, Data); | 2434 | (__u16) (mos7840_port->DcrRegOffset + 2), Data); |
| 2485 | if (status < 0) { | 2435 | if (status < 0) { |
| 2486 | dev_dbg(&dev->dev, "Writing CLK_MULTI_REGISTER failed status-0x%x\n", status); | 2436 | dev_dbg(&port->dev, "Writing DCR2 failed status-0x%x\n", status); |
| 2487 | goto error; | 2437 | goto out; |
| 2488 | } else | 2438 | } else |
| 2489 | dev_dbg(&dev->dev, "CLK_MULTI_REGISTER Writing success status%d\n", status); | 2439 | dev_dbg(&port->dev, "DCR2 Writing success status%d\n", status); |
| 2490 | 2440 | ||
| 2491 | /* write value 0x0 to scratchpad register */ | 2441 | /* write values in clkstart0x0 and clkmulti 0x20 */ |
| 2492 | Data = 0x00; | 2442 | Data = 0x0; |
| 2493 | status = mos7840_set_uart_reg(serial->port[i], | 2443 | status = mos7840_set_reg_sync(port, CLK_START_VALUE_REGISTER, Data); |
| 2494 | SCRATCH_PAD_REGISTER, Data); | 2444 | if (status < 0) { |
| 2495 | if (status < 0) { | 2445 | dev_dbg(&port->dev, "Writing CLK_START_VALUE_REGISTER failed status-0x%x\n", status); |
| 2496 | dev_dbg(&dev->dev, "Writing SCRATCH_PAD_REGISTER failed status-0x%x\n", status); | 2446 | goto out; |
| 2497 | break; | 2447 | } else |
| 2498 | } else | 2448 | dev_dbg(&port->dev, "CLK_START_VALUE_REGISTER Writing success status%d\n", status); |
| 2499 | dev_dbg(&dev->dev, "SCRATCH_PAD_REGISTER Writing success status%d\n", status); | ||
| 2500 | 2449 | ||
| 2501 | /* Zero Length flag register */ | 2450 | Data = 0x20; |
| 2502 | if ((mos7840_port->port_num != 1) | 2451 | status = mos7840_set_reg_sync(port, CLK_MULTI_REGISTER, Data); |
| 2503 | && (serial->num_ports == 2)) { | 2452 | if (status < 0) { |
| 2453 | dev_dbg(&port->dev, "Writing CLK_MULTI_REGISTER failed status-0x%x\n", status); | ||
| 2454 | goto error; | ||
| 2455 | } else | ||
| 2456 | dev_dbg(&port->dev, "CLK_MULTI_REGISTER Writing success status%d\n", status); | ||
| 2504 | 2457 | ||
| 2505 | Data = 0xff; | 2458 | /* write value 0x0 to scratchpad register */ |
| 2506 | status = mos7840_set_reg_sync(serial->port[i], | 2459 | Data = 0x00; |
| 2507 | (__u16) (ZLP_REG1 + | 2460 | status = mos7840_set_uart_reg(port, SCRATCH_PAD_REGISTER, Data); |
| 2508 | ((__u16)mos7840_port->port_num)), Data); | 2461 | if (status < 0) { |
| 2509 | dev_dbg(&dev->dev, "ZLIP offset %x\n", | 2462 | dev_dbg(&port->dev, "Writing SCRATCH_PAD_REGISTER failed status-0x%x\n", status); |
| 2463 | goto out; | ||
| 2464 | } else | ||
| 2465 | dev_dbg(&port->dev, "SCRATCH_PAD_REGISTER Writing success status%d\n", status); | ||
| 2466 | |||
| 2467 | /* Zero Length flag register */ | ||
| 2468 | if ((mos7840_port->port_num != 1) && (serial->num_ports == 2)) { | ||
| 2469 | Data = 0xff; | ||
| 2470 | status = mos7840_set_reg_sync(port, | ||
| 2471 | (__u16) (ZLP_REG1 + | ||
| 2472 | ((__u16)mos7840_port->port_num)), Data); | ||
| 2473 | dev_dbg(&port->dev, "ZLIP offset %x\n", | ||
| 2510 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num))); | 2474 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num))); |
| 2511 | if (status < 0) { | 2475 | if (status < 0) { |
| 2512 | dev_dbg(&dev->dev, "Writing ZLP_REG%d failed status-0x%x\n", i + 2, status); | 2476 | dev_dbg(&port->dev, "Writing ZLP_REG%d failed status-0x%x\n", pnum + 2, status); |
| 2513 | break; | 2477 | goto out; |
| 2514 | } else | 2478 | } else |
| 2515 | dev_dbg(&dev->dev, "ZLP_REG%d Writing success status%d\n", i + 2, status); | 2479 | dev_dbg(&port->dev, "ZLP_REG%d Writing success status%d\n", pnum + 2, status); |
| 2516 | } else { | 2480 | } else { |
| 2517 | Data = 0xff; | 2481 | Data = 0xff; |
| 2518 | status = mos7840_set_reg_sync(serial->port[i], | 2482 | status = mos7840_set_reg_sync(port, |
| 2519 | (__u16) (ZLP_REG1 + | 2483 | (__u16) (ZLP_REG1 + |
| 2520 | ((__u16)mos7840_port->port_num) - 0x1), Data); | 2484 | ((__u16)mos7840_port->port_num) - 0x1), Data); |
| 2521 | dev_dbg(&dev->dev, "ZLIP offset %x\n", | 2485 | dev_dbg(&port->dev, "ZLIP offset %x\n", |
| 2522 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num) - 0x1)); | 2486 | (__u16)(ZLP_REG1 + ((__u16) mos7840_port->port_num) - 0x1)); |
| 2523 | if (status < 0) { | 2487 | if (status < 0) { |
| 2524 | dev_dbg(&dev->dev, "Writing ZLP_REG%d failed status-0x%x\n", i + 1, status); | 2488 | dev_dbg(&port->dev, "Writing ZLP_REG%d failed status-0x%x\n", pnum + 1, status); |
| 2525 | break; | 2489 | goto out; |
| 2526 | } else | 2490 | } else |
| 2527 | dev_dbg(&dev->dev, "ZLP_REG%d Writing success status%d\n", i + 1, status); | 2491 | dev_dbg(&port->dev, "ZLP_REG%d Writing success status%d\n", pnum + 1, status); |
| 2528 | 2492 | ||
| 2529 | } | 2493 | } |
| 2530 | mos7840_port->control_urb = usb_alloc_urb(0, GFP_KERNEL); | 2494 | mos7840_port->control_urb = usb_alloc_urb(0, GFP_KERNEL); |
| 2531 | mos7840_port->ctrl_buf = kmalloc(16, GFP_KERNEL); | 2495 | mos7840_port->ctrl_buf = kmalloc(16, GFP_KERNEL); |
| 2532 | mos7840_port->dr = kmalloc(sizeof(struct usb_ctrlrequest), | 2496 | mos7840_port->dr = kmalloc(sizeof(struct usb_ctrlrequest), |
| 2533 | GFP_KERNEL); | 2497 | GFP_KERNEL); |
| 2534 | if (!mos7840_port->control_urb || !mos7840_port->ctrl_buf || | 2498 | if (!mos7840_port->control_urb || !mos7840_port->ctrl_buf || |
| 2535 | !mos7840_port->dr) { | 2499 | !mos7840_port->dr) { |
| 2536 | status = -ENOMEM; | 2500 | status = -ENOMEM; |
| 2537 | goto error; | 2501 | goto error; |
| 2538 | } | 2502 | } |
| 2539 | 2503 | ||
| 2540 | mos7840_port->has_led = false; | 2504 | mos7840_port->has_led = false; |
| 2541 | 2505 | ||
| 2542 | /* Initialize LED timers */ | 2506 | /* Initialize LED timers */ |
| 2543 | if (device_type == MOSCHIP_DEVICE_ID_7810) { | 2507 | if (device_type == MOSCHIP_DEVICE_ID_7810) { |
| 2544 | mos7840_port->has_led = true; | 2508 | mos7840_port->has_led = true; |
| 2545 | 2509 | ||
| 2546 | init_timer(&mos7840_port->led_timer1); | 2510 | init_timer(&mos7840_port->led_timer1); |
| 2547 | mos7840_port->led_timer1.function = mos7840_led_off; | 2511 | mos7840_port->led_timer1.function = mos7840_led_off; |
| 2548 | mos7840_port->led_timer1.expires = | 2512 | mos7840_port->led_timer1.expires = |
| 2549 | jiffies + msecs_to_jiffies(LED_ON_MS); | 2513 | jiffies + msecs_to_jiffies(LED_ON_MS); |
| 2550 | mos7840_port->led_timer1.data = | 2514 | mos7840_port->led_timer1.data = (unsigned long)mos7840_port; |
| 2551 | (unsigned long)mos7840_port; | ||
| 2552 | 2515 | ||
| 2553 | init_timer(&mos7840_port->led_timer2); | 2516 | init_timer(&mos7840_port->led_timer2); |
| 2554 | mos7840_port->led_timer2.function = | 2517 | mos7840_port->led_timer2.function = mos7840_led_flag_off; |
| 2555 | mos7840_led_flag_off; | 2518 | mos7840_port->led_timer2.expires = |
| 2556 | mos7840_port->led_timer2.expires = | 2519 | jiffies + msecs_to_jiffies(LED_OFF_MS); |
| 2557 | jiffies + msecs_to_jiffies(LED_OFF_MS); | 2520 | mos7840_port->led_timer2.data = (unsigned long)mos7840_port; |
| 2558 | mos7840_port->led_timer2.data = | ||
| 2559 | (unsigned long)mos7840_port; | ||
| 2560 | 2521 | ||
| 2561 | mos7840_port->led_flag = false; | 2522 | mos7840_port->led_flag = false; |
| 2562 | 2523 | ||
| 2563 | /* Turn off LED */ | 2524 | /* Turn off LED */ |
| 2564 | mos7840_set_led_sync(serial->port[i], | 2525 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300); |
| 2565 | MODEM_CONTROL_REGISTER, 0x0300); | ||
| 2566 | } | ||
| 2567 | } | 2526 | } |
| 2527 | out: | ||
| 2528 | if (pnum == serial->num_ports - 1) { | ||
| 2529 | /* Zero Length flag enable */ | ||
| 2530 | Data = 0x0f; | ||
| 2531 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); | ||
| 2532 | if (status < 0) { | ||
| 2533 | dev_dbg(&port->dev, "Writing ZLP_REG5 failed status-0x%x\n", status); | ||
| 2534 | goto error; | ||
| 2535 | } else | ||
| 2536 | dev_dbg(&port->dev, "ZLP_REG5 Writing success status%d\n", status); | ||
| 2568 | 2537 | ||
| 2569 | /* Zero Length flag enable */ | 2538 | /* setting configuration feature to one */ |
| 2570 | Data = 0x0f; | 2539 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
| 2571 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); | 2540 | 0x03, 0x00, 0x01, 0x00, NULL, 0x00, |
| 2572 | if (status < 0) { | 2541 | MOS_WDR_TIMEOUT); |
| 2573 | dev_dbg(&dev->dev, "Writing ZLP_REG5 failed status-0x%x\n", status); | 2542 | } |
| 2574 | goto error; | ||
| 2575 | } else | ||
| 2576 | dev_dbg(&dev->dev, "ZLP_REG5 Writing success status%d\n", status); | ||
| 2577 | |||
| 2578 | /* setting configuration feature to one */ | ||
| 2579 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | ||
| 2580 | (__u8) 0x03, 0x00, 0x01, 0x00, NULL, 0x00, MOS_WDR_TIMEOUT); | ||
| 2581 | return 0; | 2543 | return 0; |
| 2582 | error: | 2544 | error: |
| 2583 | for (/* nothing */; i >= 0; i--) { | 2545 | kfree(mos7840_port->dr); |
| 2584 | mos7840_port = mos7840_get_port_private(serial->port[i]); | 2546 | kfree(mos7840_port->ctrl_buf); |
| 2547 | usb_free_urb(mos7840_port->control_urb); | ||
| 2548 | kfree(mos7840_port); | ||
| 2585 | 2549 | ||
| 2586 | kfree(mos7840_port->dr); | ||
| 2587 | kfree(mos7840_port->ctrl_buf); | ||
| 2588 | usb_free_urb(mos7840_port->control_urb); | ||
| 2589 | kfree(mos7840_port); | ||
| 2590 | serial->port[i] = NULL; | ||
| 2591 | } | ||
| 2592 | return status; | 2550 | return status; |
| 2593 | } | 2551 | } |
| 2594 | 2552 | ||
| 2595 | /**************************************************************************** | 2553 | static int mos7840_port_remove(struct usb_serial_port *port) |
| 2596 | * mos7840_disconnect | ||
| 2597 | * This function is called whenever the device is removed from the usb bus. | ||
| 2598 | ****************************************************************************/ | ||
| 2599 | |||
| 2600 | static void mos7840_disconnect(struct usb_serial *serial) | ||
| 2601 | { | 2554 | { |
| 2602 | int i; | ||
| 2603 | unsigned long flags; | ||
| 2604 | struct moschip_port *mos7840_port; | 2555 | struct moschip_port *mos7840_port; |
| 2605 | 2556 | ||
| 2606 | /* check for the ports to be closed,close the ports and disconnect */ | 2557 | mos7840_port = mos7840_get_port_private(port); |
| 2607 | 2558 | ||
| 2608 | /* free private structure allocated for serial port * | 2559 | if (mos7840_port->has_led) { |
| 2609 | * stop reads and writes on all ports */ | 2560 | /* Turn off LED */ |
| 2561 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300); | ||
| 2610 | 2562 | ||
| 2611 | for (i = 0; i < serial->num_ports; ++i) { | 2563 | del_timer_sync(&mos7840_port->led_timer1); |
| 2612 | mos7840_port = mos7840_get_port_private(serial->port[i]); | 2564 | del_timer_sync(&mos7840_port->led_timer2); |
| 2613 | if (mos7840_port) { | ||
| 2614 | spin_lock_irqsave(&mos7840_port->pool_lock, flags); | ||
| 2615 | mos7840_port->zombie = 1; | ||
| 2616 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); | ||
| 2617 | usb_kill_urb(mos7840_port->control_urb); | ||
| 2618 | } | ||
| 2619 | } | 2565 | } |
| 2620 | } | 2566 | usb_kill_urb(mos7840_port->control_urb); |
| 2621 | 2567 | usb_free_urb(mos7840_port->control_urb); | |
| 2622 | /**************************************************************************** | 2568 | kfree(mos7840_port->ctrl_buf); |
| 2623 | * mos7840_release | 2569 | kfree(mos7840_port->dr); |
| 2624 | * This function is called when the usb_serial structure is freed. | 2570 | kfree(mos7840_port); |
| 2625 | ****************************************************************************/ | ||
| 2626 | |||
| 2627 | static void mos7840_release(struct usb_serial *serial) | ||
| 2628 | { | ||
| 2629 | int i; | ||
| 2630 | struct moschip_port *mos7840_port; | ||
| 2631 | |||
| 2632 | /* check for the ports to be closed,close the ports and disconnect */ | ||
| 2633 | 2571 | ||
| 2634 | /* free private structure allocated for serial port * | 2572 | return 0; |
| 2635 | * stop reads and writes on all ports */ | ||
| 2636 | |||
| 2637 | for (i = 0; i < serial->num_ports; ++i) { | ||
| 2638 | mos7840_port = mos7840_get_port_private(serial->port[i]); | ||
| 2639 | if (mos7840_port) { | ||
| 2640 | if (mos7840_port->has_led) { | ||
| 2641 | /* Turn off LED */ | ||
| 2642 | mos7840_set_led_sync(mos7840_port->port, | ||
| 2643 | MODEM_CONTROL_REGISTER, 0x0300); | ||
| 2644 | |||
| 2645 | del_timer_sync(&mos7840_port->led_timer1); | ||
| 2646 | del_timer_sync(&mos7840_port->led_timer2); | ||
| 2647 | } | ||
| 2648 | kfree(mos7840_port->ctrl_buf); | ||
| 2649 | kfree(mos7840_port->dr); | ||
| 2650 | kfree(mos7840_port); | ||
| 2651 | } | ||
| 2652 | } | ||
| 2653 | } | 2573 | } |
| 2654 | 2574 | ||
| 2655 | static struct usb_serial_driver moschip7840_4port_device = { | 2575 | static struct usb_serial_driver moschip7840_4port_device = { |
| @@ -2677,9 +2597,8 @@ static struct usb_serial_driver moschip7840_4port_device = { | |||
| 2677 | .tiocmget = mos7840_tiocmget, | 2597 | .tiocmget = mos7840_tiocmget, |
| 2678 | .tiocmset = mos7840_tiocmset, | 2598 | .tiocmset = mos7840_tiocmset, |
| 2679 | .get_icount = mos7840_get_icount, | 2599 | .get_icount = mos7840_get_icount, |
| 2680 | .attach = mos7840_startup, | 2600 | .port_probe = mos7840_port_probe, |
| 2681 | .disconnect = mos7840_disconnect, | 2601 | .port_remove = mos7840_port_remove, |
| 2682 | .release = mos7840_release, | ||
| 2683 | .read_bulk_callback = mos7840_bulk_in_callback, | 2602 | .read_bulk_callback = mos7840_bulk_in_callback, |
| 2684 | .read_int_callback = mos7840_interrupt_callback, | 2603 | .read_int_callback = mos7840_interrupt_callback, |
| 2685 | }; | 2604 | }; |
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 6def58b79382..9ab73d295774 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
| @@ -44,8 +44,8 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
| 44 | const unsigned char *buf, int count); | 44 | const unsigned char *buf, int count); |
| 45 | static int omninet_write_room(struct tty_struct *tty); | 45 | static int omninet_write_room(struct tty_struct *tty); |
| 46 | static void omninet_disconnect(struct usb_serial *serial); | 46 | static void omninet_disconnect(struct usb_serial *serial); |
| 47 | static void omninet_release(struct usb_serial *serial); | 47 | static int omninet_port_probe(struct usb_serial_port *port); |
| 48 | static int omninet_attach(struct usb_serial *serial); | 48 | static int omninet_port_remove(struct usb_serial_port *port); |
| 49 | 49 | ||
| 50 | static const struct usb_device_id id_table[] = { | 50 | static const struct usb_device_id id_table[] = { |
| 51 | { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, | 51 | { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, |
| @@ -62,7 +62,8 @@ static struct usb_serial_driver zyxel_omninet_device = { | |||
| 62 | .description = "ZyXEL - omni.net lcd plus usb", | 62 | .description = "ZyXEL - omni.net lcd plus usb", |
| 63 | .id_table = id_table, | 63 | .id_table = id_table, |
| 64 | .num_ports = 1, | 64 | .num_ports = 1, |
| 65 | .attach = omninet_attach, | 65 | .port_probe = omninet_port_probe, |
| 66 | .port_remove = omninet_port_remove, | ||
| 66 | .open = omninet_open, | 67 | .open = omninet_open, |
| 67 | .close = omninet_close, | 68 | .close = omninet_close, |
| 68 | .write = omninet_write, | 69 | .write = omninet_write, |
| @@ -70,7 +71,6 @@ static struct usb_serial_driver zyxel_omninet_device = { | |||
| 70 | .read_bulk_callback = omninet_read_bulk_callback, | 71 | .read_bulk_callback = omninet_read_bulk_callback, |
| 71 | .write_bulk_callback = omninet_write_bulk_callback, | 72 | .write_bulk_callback = omninet_write_bulk_callback, |
| 72 | .disconnect = omninet_disconnect, | 73 | .disconnect = omninet_disconnect, |
| 73 | .release = omninet_release, | ||
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | static struct usb_serial_driver * const serial_drivers[] = { | 76 | static struct usb_serial_driver * const serial_drivers[] = { |
| @@ -112,18 +112,26 @@ struct omninet_data { | |||
| 112 | __u8 od_outseq; /* Sequence number for bulk_out URBs */ | 112 | __u8 od_outseq; /* Sequence number for bulk_out URBs */ |
| 113 | }; | 113 | }; |
| 114 | 114 | ||
| 115 | static int omninet_attach(struct usb_serial *serial) | 115 | static int omninet_port_probe(struct usb_serial_port *port) |
| 116 | { | 116 | { |
| 117 | struct omninet_data *od; | 117 | struct omninet_data *od; |
| 118 | struct usb_serial_port *port = serial->port[0]; | ||
| 119 | 118 | ||
| 120 | od = kmalloc(sizeof(struct omninet_data), GFP_KERNEL); | 119 | od = kmalloc(sizeof(struct omninet_data), GFP_KERNEL); |
| 121 | if (!od) { | 120 | if (!od) |
| 122 | dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", | ||
| 123 | __func__, sizeof(struct omninet_data)); | ||
| 124 | return -ENOMEM; | 121 | return -ENOMEM; |
| 125 | } | 122 | |
| 126 | usb_set_serial_port_data(port, od); | 123 | usb_set_serial_port_data(port, od); |
| 124 | |||
| 125 | return 0; | ||
| 126 | } | ||
| 127 | |||
| 128 | static int omninet_port_remove(struct usb_serial_port *port) | ||
| 129 | { | ||
| 130 | struct omninet_data *od; | ||
| 131 | |||
| 132 | od = usb_get_serial_port_data(port); | ||
| 133 | kfree(od); | ||
| 134 | |||
| 127 | return 0; | 135 | return 0; |
| 128 | } | 136 | } |
| 129 | 137 | ||
| @@ -279,14 +287,6 @@ static void omninet_disconnect(struct usb_serial *serial) | |||
| 279 | usb_kill_urb(wport->write_urb); | 287 | usb_kill_urb(wport->write_urb); |
| 280 | } | 288 | } |
| 281 | 289 | ||
| 282 | |||
| 283 | static void omninet_release(struct usb_serial *serial) | ||
| 284 | { | ||
| 285 | struct usb_serial_port *port = serial->port[0]; | ||
| 286 | |||
| 287 | kfree(usb_get_serial_port_data(port)); | ||
| 288 | } | ||
| 289 | |||
| 290 | module_usb_serial_driver(serial_drivers, id_table); | 290 | module_usb_serial_driver(serial_drivers, id_table); |
| 291 | 291 | ||
| 292 | MODULE_AUTHOR(DRIVER_AUTHOR); | 292 | MODULE_AUTHOR(DRIVER_AUTHOR); |
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index 41b1647306eb..6aba731d4864 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
| @@ -155,7 +155,11 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, | |||
| 155 | { | 155 | { |
| 156 | struct usb_serial *serial = port->serial; | 156 | struct usb_serial *serial = port->serial; |
| 157 | int retval; | 157 | int retval; |
| 158 | u8 buffer[2]; | 158 | u8 *buffer; |
| 159 | |||
| 160 | buffer = kzalloc(1, GFP_KERNEL); | ||
| 161 | if (!buffer) | ||
| 162 | return -ENOMEM; | ||
| 159 | 163 | ||
| 160 | buffer[0] = val; | 164 | buffer[0] = val; |
| 161 | /* Send the message to the vendor control endpoint | 165 | /* Send the message to the vendor control endpoint |
| @@ -164,6 +168,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype, | |||
| 164 | requesttype, | 168 | requesttype, |
| 165 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, | 169 | USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, |
| 166 | 0, 0, buffer, 1, 0); | 170 | 0, 0, buffer, 1, 0); |
| 171 | kfree(buffer); | ||
| 167 | 172 | ||
| 168 | return retval; | 173 | return retval; |
| 169 | } | 174 | } |
| @@ -281,7 +286,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
| 281 | if (!dr) { | 286 | if (!dr) { |
| 282 | dev_err(&port->dev, "out of memory\n"); | 287 | dev_err(&port->dev, "out of memory\n"); |
| 283 | count = -ENOMEM; | 288 | count = -ENOMEM; |
| 284 | goto error; | 289 | goto error_no_dr; |
| 285 | } | 290 | } |
| 286 | 291 | ||
| 287 | dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT; | 292 | dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT; |
| @@ -311,6 +316,8 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
| 311 | 316 | ||
| 312 | return count; | 317 | return count; |
| 313 | error: | 318 | error: |
| 319 | kfree(dr); | ||
| 320 | error_no_dr: | ||
| 314 | usb_free_urb(urb); | 321 | usb_free_urb(urb); |
| 315 | error_no_urb: | 322 | error_no_urb: |
| 316 | kfree(buffer); | 323 | kfree(buffer); |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 30cff03e9f01..5dee7d61241e 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | /* Function prototypes */ | 47 | /* Function prototypes */ |
| 48 | static int option_probe(struct usb_serial *serial, | 48 | static int option_probe(struct usb_serial *serial, |
| 49 | const struct usb_device_id *id); | 49 | const struct usb_device_id *id); |
| 50 | static int option_attach(struct usb_serial *serial); | ||
| 50 | static void option_release(struct usb_serial *serial); | 51 | static void option_release(struct usb_serial *serial); |
| 51 | static int option_send_setup(struct usb_serial_port *port); | 52 | static int option_send_setup(struct usb_serial_port *port); |
| 52 | static void option_instat_callback(struct urb *urb); | 53 | static void option_instat_callback(struct urb *urb); |
| @@ -503,11 +504,19 @@ static const struct option_blacklist_info net_intf5_blacklist = { | |||
| 503 | .reserved = BIT(5), | 504 | .reserved = BIT(5), |
| 504 | }; | 505 | }; |
| 505 | 506 | ||
| 507 | static const struct option_blacklist_info net_intf6_blacklist = { | ||
| 508 | .reserved = BIT(6), | ||
| 509 | }; | ||
| 510 | |||
| 506 | static const struct option_blacklist_info zte_mf626_blacklist = { | 511 | static const struct option_blacklist_info zte_mf626_blacklist = { |
| 507 | .sendsetup = BIT(0) | BIT(1), | 512 | .sendsetup = BIT(0) | BIT(1), |
| 508 | .reserved = BIT(4), | 513 | .reserved = BIT(4), |
| 509 | }; | 514 | }; |
| 510 | 515 | ||
| 516 | static const struct option_blacklist_info zte_1255_blacklist = { | ||
| 517 | .reserved = BIT(3) | BIT(4), | ||
| 518 | }; | ||
| 519 | |||
| 511 | static const struct usb_device_id option_ids[] = { | 520 | static const struct usb_device_id option_ids[] = { |
| 512 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 521 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
| 513 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, | 522 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
| @@ -853,13 +862,19 @@ static const struct usb_device_id option_ids[] = { | |||
| 853 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff), | 862 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff), |
| 854 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, | 863 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, |
| 855 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0117, 0xff, 0xff, 0xff) }, | 864 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0117, 0xff, 0xff, 0xff) }, |
| 856 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0118, 0xff, 0xff, 0xff) }, | 865 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0118, 0xff, 0xff, 0xff), |
| 857 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0121, 0xff, 0xff, 0xff) }, | 866 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, |
| 867 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0121, 0xff, 0xff, 0xff), | ||
| 868 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, | ||
| 858 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0122, 0xff, 0xff, 0xff) }, | 869 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0122, 0xff, 0xff, 0xff) }, |
| 859 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0123, 0xff, 0xff, 0xff) }, | 870 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0123, 0xff, 0xff, 0xff), |
| 860 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0124, 0xff, 0xff, 0xff) }, | 871 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 861 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0125, 0xff, 0xff, 0xff) }, | 872 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0124, 0xff, 0xff, 0xff), |
| 862 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0126, 0xff, 0xff, 0xff) }, | 873 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, |
| 874 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0125, 0xff, 0xff, 0xff), | ||
| 875 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, | ||
| 876 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0126, 0xff, 0xff, 0xff), | ||
| 877 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, | ||
| 863 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0128, 0xff, 0xff, 0xff) }, | 878 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0128, 0xff, 0xff, 0xff) }, |
| 864 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0142, 0xff, 0xff, 0xff) }, | 879 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0142, 0xff, 0xff, 0xff) }, |
| 865 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0143, 0xff, 0xff, 0xff) }, | 880 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0143, 0xff, 0xff, 0xff) }, |
| @@ -872,7 +887,8 @@ static const struct usb_device_id option_ids[] = { | |||
| 872 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) }, | 887 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) }, |
| 873 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff), | 888 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff), |
| 874 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, | 889 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, |
| 875 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff) }, | 890 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff), |
| 891 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, | ||
| 876 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) }, | 892 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) }, |
| 877 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) }, | 893 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) }, |
| 878 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) }, | 894 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) }, |
| @@ -880,13 +896,22 @@ static const struct usb_device_id option_ids[] = { | |||
| 880 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) }, | 896 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) }, |
| 881 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff), | 897 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff), |
| 882 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | 898 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 899 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0191, 0xff, 0xff, 0xff), /* ZTE EuFi890 */ | ||
| 900 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
| 901 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0199, 0xff, 0xff, 0xff), /* ZTE MF820S */ | ||
| 902 | .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, | ||
| 903 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */ | ||
| 904 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, | ||
| 883 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff), | 905 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff), |
| 884 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | 906 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 885 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff), | 907 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff), |
| 886 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | 908 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 887 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff), | 909 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff), |
| 888 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | 910 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 889 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) }, | 911 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff), |
| 912 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
| 913 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1021, 0xff, 0xff, 0xff), | ||
| 914 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | ||
| 890 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) }, | 915 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) }, |
| 891 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) }, | 916 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) }, |
| 892 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) }, | 917 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) }, |
| @@ -1002,18 +1027,24 @@ static const struct usb_device_id option_ids[] = { | |||
| 1002 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1169, 0xff, 0xff, 0xff) }, | 1027 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1169, 0xff, 0xff, 0xff) }, |
| 1003 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1170, 0xff, 0xff, 0xff) }, | 1028 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1170, 0xff, 0xff, 0xff) }, |
| 1004 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1244, 0xff, 0xff, 0xff) }, | 1029 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1244, 0xff, 0xff, 0xff) }, |
| 1005 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1245, 0xff, 0xff, 0xff) }, | 1030 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1245, 0xff, 0xff, 0xff), |
| 1031 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
| 1006 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1246, 0xff, 0xff, 0xff) }, | 1032 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1246, 0xff, 0xff, 0xff) }, |
| 1007 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1247, 0xff, 0xff, 0xff) }, | 1033 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1247, 0xff, 0xff, 0xff), |
| 1034 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
| 1008 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1248, 0xff, 0xff, 0xff) }, | 1035 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1248, 0xff, 0xff, 0xff) }, |
| 1009 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1249, 0xff, 0xff, 0xff) }, | 1036 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1249, 0xff, 0xff, 0xff) }, |
| 1010 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1250, 0xff, 0xff, 0xff) }, | 1037 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1250, 0xff, 0xff, 0xff) }, |
| 1011 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1251, 0xff, 0xff, 0xff) }, | 1038 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1251, 0xff, 0xff, 0xff) }, |
| 1012 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1252, 0xff, 0xff, 0xff) }, | 1039 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1252, 0xff, 0xff, 0xff), |
| 1040 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
| 1013 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1253, 0xff, 0xff, 0xff) }, | 1041 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1253, 0xff, 0xff, 0xff) }, |
| 1014 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1254, 0xff, 0xff, 0xff) }, | 1042 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1254, 0xff, 0xff, 0xff), |
| 1015 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1255, 0xff, 0xff, 0xff) }, | 1043 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 1016 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1256, 0xff, 0xff, 0xff) }, | 1044 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1255, 0xff, 0xff, 0xff), |
| 1045 | .driver_info = (kernel_ulong_t)&zte_1255_blacklist }, | ||
| 1046 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1256, 0xff, 0xff, 0xff), | ||
| 1047 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
| 1017 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1257, 0xff, 0xff, 0xff) }, | 1048 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1257, 0xff, 0xff, 0xff) }, |
| 1018 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1258, 0xff, 0xff, 0xff) }, | 1049 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1258, 0xff, 0xff, 0xff) }, |
| 1019 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1259, 0xff, 0xff, 0xff) }, | 1050 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1259, 0xff, 0xff, 0xff) }, |
| @@ -1058,8 +1089,16 @@ static const struct usb_device_id option_ids[] = { | |||
| 1058 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) }, | 1089 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) }, |
| 1059 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) }, | 1090 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) }, |
| 1060 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) }, | 1091 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) }, |
| 1092 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1401, 0xff, 0xff, 0xff), | ||
| 1093 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | ||
| 1061 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff), | 1094 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff), |
| 1062 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | 1095 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, |
| 1096 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1424, 0xff, 0xff, 0xff), | ||
| 1097 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | ||
| 1098 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1425, 0xff, 0xff, 0xff), | ||
| 1099 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | ||
| 1100 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff), /* ZTE MF91 */ | ||
| 1101 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | ||
| 1063 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, | 1102 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, |
| 1064 | 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist }, | 1103 | 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist }, |
| 1065 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, | 1104 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, |
| @@ -1071,15 +1110,21 @@ static const struct usb_device_id option_ids[] = { | |||
| 1071 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) }, | 1110 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) }, |
| 1072 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, | 1111 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, |
| 1073 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) }, | 1112 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) }, |
| 1074 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) }, | 1113 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff), |
| 1075 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff) }, | 1114 | .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, |
| 1076 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) }, | 1115 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff), |
| 1116 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, | ||
| 1117 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff), | ||
| 1118 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, | ||
| 1077 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) }, | 1119 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) }, |
| 1078 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) }, | 1120 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) }, |
| 1079 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff) }, | 1121 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff), |
| 1122 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
| 1080 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0170, 0xff, 0xff, 0xff) }, | 1123 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0170, 0xff, 0xff, 0xff) }, |
| 1081 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff) }, | 1124 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff), |
| 1082 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff) }, | 1125 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, |
| 1126 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff), | ||
| 1127 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, | ||
| 1083 | 1128 | ||
| 1084 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, | 1129 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, |
| 1085 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, | 1130 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, |
| @@ -1244,8 +1289,9 @@ static struct usb_serial_driver option_1port_device = { | |||
| 1244 | .tiocmget = usb_wwan_tiocmget, | 1289 | .tiocmget = usb_wwan_tiocmget, |
| 1245 | .tiocmset = usb_wwan_tiocmset, | 1290 | .tiocmset = usb_wwan_tiocmset, |
| 1246 | .ioctl = usb_wwan_ioctl, | 1291 | .ioctl = usb_wwan_ioctl, |
| 1247 | .attach = usb_wwan_startup, | 1292 | .attach = option_attach, |
| 1248 | .release = option_release, | 1293 | .release = option_release, |
| 1294 | .port_probe = usb_wwan_port_probe, | ||
| 1249 | .port_remove = usb_wwan_port_remove, | 1295 | .port_remove = usb_wwan_port_remove, |
| 1250 | .read_int_callback = option_instat_callback, | 1296 | .read_int_callback = option_instat_callback, |
| 1251 | #ifdef CONFIG_PM | 1297 | #ifdef CONFIG_PM |
| @@ -1291,8 +1337,6 @@ static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason, | |||
| 1291 | static int option_probe(struct usb_serial *serial, | 1337 | static int option_probe(struct usb_serial *serial, |
| 1292 | const struct usb_device_id *id) | 1338 | const struct usb_device_id *id) |
| 1293 | { | 1339 | { |
| 1294 | struct usb_wwan_intf_private *data; | ||
| 1295 | struct option_private *priv; | ||
| 1296 | struct usb_interface_descriptor *iface_desc = | 1340 | struct usb_interface_descriptor *iface_desc = |
| 1297 | &serial->interface->cur_altsetting->desc; | 1341 | &serial->interface->cur_altsetting->desc; |
| 1298 | struct usb_device_descriptor *dev_desc = &serial->dev->descriptor; | 1342 | struct usb_device_descriptor *dev_desc = &serial->dev->descriptor; |
| @@ -1330,6 +1374,19 @@ static int option_probe(struct usb_serial *serial, | |||
| 1330 | iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA) | 1374 | iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA) |
| 1331 | return -ENODEV; | 1375 | return -ENODEV; |
| 1332 | 1376 | ||
| 1377 | /* Store device id so we can use it during attach. */ | ||
| 1378 | usb_set_serial_data(serial, (void *)id); | ||
| 1379 | |||
| 1380 | return 0; | ||
| 1381 | } | ||
| 1382 | |||
| 1383 | static int option_attach(struct usb_serial *serial) | ||
| 1384 | { | ||
| 1385 | struct usb_interface_descriptor *iface_desc; | ||
| 1386 | const struct usb_device_id *id; | ||
| 1387 | struct usb_wwan_intf_private *data; | ||
| 1388 | struct option_private *priv; | ||
| 1389 | |||
| 1333 | data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); | 1390 | data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); |
| 1334 | if (!data) | 1391 | if (!data) |
| 1335 | return -ENOMEM; | 1392 | return -ENOMEM; |
| @@ -1340,6 +1397,10 @@ static int option_probe(struct usb_serial *serial, | |||
| 1340 | return -ENOMEM; | 1397 | return -ENOMEM; |
| 1341 | } | 1398 | } |
| 1342 | 1399 | ||
| 1400 | /* Retrieve device id stored at probe. */ | ||
| 1401 | id = usb_get_serial_data(serial); | ||
| 1402 | iface_desc = &serial->interface->cur_altsetting->desc; | ||
| 1403 | |||
| 1343 | priv->bInterfaceNumber = iface_desc->bInterfaceNumber; | 1404 | priv->bInterfaceNumber = iface_desc->bInterfaceNumber; |
| 1344 | data->private = priv; | 1405 | data->private = priv; |
| 1345 | 1406 | ||
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index 933241f03fd8..cee9a52ca891 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
| @@ -137,8 +137,8 @@ static int oti6858_chars_in_buffer(struct tty_struct *tty); | |||
| 137 | static int oti6858_tiocmget(struct tty_struct *tty); | 137 | static int oti6858_tiocmget(struct tty_struct *tty); |
| 138 | static int oti6858_tiocmset(struct tty_struct *tty, | 138 | static int oti6858_tiocmset(struct tty_struct *tty, |
| 139 | unsigned int set, unsigned int clear); | 139 | unsigned int set, unsigned int clear); |
| 140 | static int oti6858_startup(struct usb_serial *serial); | 140 | static int oti6858_port_probe(struct usb_serial_port *port); |
| 141 | static void oti6858_release(struct usb_serial *serial); | 141 | static int oti6858_port_remove(struct usb_serial_port *port); |
| 142 | 142 | ||
| 143 | /* device info */ | 143 | /* device info */ |
| 144 | static struct usb_serial_driver oti6858_device = { | 144 | static struct usb_serial_driver oti6858_device = { |
| @@ -161,8 +161,8 @@ static struct usb_serial_driver oti6858_device = { | |||
| 161 | .write_bulk_callback = oti6858_write_bulk_callback, | 161 | .write_bulk_callback = oti6858_write_bulk_callback, |
| 162 | .write_room = oti6858_write_room, | 162 | .write_room = oti6858_write_room, |
| 163 | .chars_in_buffer = oti6858_chars_in_buffer, | 163 | .chars_in_buffer = oti6858_chars_in_buffer, |
| 164 | .attach = oti6858_startup, | 164 | .port_probe = oti6858_port_probe, |
| 165 | .release = oti6858_release, | 165 | .port_remove = oti6858_port_remove, |
| 166 | }; | 166 | }; |
| 167 | 167 | ||
| 168 | static struct usb_serial_driver * const serial_drivers[] = { | 168 | static struct usb_serial_driver * const serial_drivers[] = { |
| @@ -331,36 +331,33 @@ static void send_data(struct work_struct *work) | |||
| 331 | usb_serial_port_softint(port); | 331 | usb_serial_port_softint(port); |
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | static int oti6858_startup(struct usb_serial *serial) | 334 | static int oti6858_port_probe(struct usb_serial_port *port) |
| 335 | { | 335 | { |
| 336 | struct usb_serial_port *port = serial->port[0]; | ||
| 337 | struct oti6858_private *priv; | 336 | struct oti6858_private *priv; |
| 338 | int i; | ||
| 339 | |||
| 340 | for (i = 0; i < serial->num_ports; ++i) { | ||
| 341 | priv = kzalloc(sizeof(struct oti6858_private), GFP_KERNEL); | ||
| 342 | if (!priv) | ||
| 343 | break; | ||
| 344 | |||
| 345 | spin_lock_init(&priv->lock); | ||
| 346 | init_waitqueue_head(&priv->intr_wait); | ||
| 347 | /* INIT_WORK(&priv->setup_work, setup_line, serial->port[i]); */ | ||
| 348 | /* INIT_WORK(&priv->write_work, send_data, serial->port[i]); */ | ||
| 349 | priv->port = port; | ||
| 350 | INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line); | ||
| 351 | INIT_DELAYED_WORK(&priv->delayed_write_work, send_data); | ||
| 352 | |||
| 353 | usb_set_serial_port_data(serial->port[i], priv); | ||
| 354 | } | ||
| 355 | if (i == serial->num_ports) | ||
| 356 | return 0; | ||
| 357 | 337 | ||
| 358 | for (--i; i >= 0; --i) { | 338 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 359 | priv = usb_get_serial_port_data(serial->port[i]); | 339 | if (!priv) |
| 360 | kfree(priv); | 340 | return -ENOMEM; |
| 361 | usb_set_serial_port_data(serial->port[i], NULL); | 341 | |
| 362 | } | 342 | spin_lock_init(&priv->lock); |
| 363 | return -ENOMEM; | 343 | init_waitqueue_head(&priv->intr_wait); |
| 344 | priv->port = port; | ||
| 345 | INIT_DELAYED_WORK(&priv->delayed_setup_work, setup_line); | ||
| 346 | INIT_DELAYED_WORK(&priv->delayed_write_work, send_data); | ||
| 347 | |||
| 348 | usb_set_serial_port_data(port, priv); | ||
| 349 | |||
| 350 | return 0; | ||
| 351 | } | ||
| 352 | |||
| 353 | static int oti6858_port_remove(struct usb_serial_port *port) | ||
| 354 | { | ||
| 355 | struct oti6858_private *priv; | ||
| 356 | |||
| 357 | priv = usb_get_serial_port_data(port); | ||
| 358 | kfree(priv); | ||
| 359 | |||
| 360 | return 0; | ||
| 364 | } | 361 | } |
| 365 | 362 | ||
| 366 | static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port, | 363 | static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port, |
| @@ -709,15 +706,6 @@ static int oti6858_ioctl(struct tty_struct *tty, | |||
| 709 | return -ENOIOCTLCMD; | 706 | return -ENOIOCTLCMD; |
| 710 | } | 707 | } |
| 711 | 708 | ||
| 712 | |||
| 713 | static void oti6858_release(struct usb_serial *serial) | ||
| 714 | { | ||
| 715 | int i; | ||
| 716 | |||
| 717 | for (i = 0; i < serial->num_ports; ++i) | ||
| 718 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
| 719 | } | ||
| 720 | |||
| 721 | static void oti6858_read_int_callback(struct urb *urb) | 709 | static void oti6858_read_int_callback(struct urb *urb) |
| 722 | { | 710 | { |
| 723 | struct usb_serial_port *port = urb->context; | 711 | struct usb_serial_port *port = urb->context; |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 892ebdc7a364..600241901361 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
| @@ -133,12 +133,15 @@ enum pl2303_type { | |||
| 133 | HX, /* HX version of the pl2303 chip */ | 133 | HX, /* HX version of the pl2303 chip */ |
| 134 | }; | 134 | }; |
| 135 | 135 | ||
| 136 | struct pl2303_serial_private { | ||
| 137 | enum pl2303_type type; | ||
| 138 | }; | ||
| 139 | |||
| 136 | struct pl2303_private { | 140 | struct pl2303_private { |
| 137 | spinlock_t lock; | 141 | spinlock_t lock; |
| 138 | wait_queue_head_t delta_msr_wait; | 142 | wait_queue_head_t delta_msr_wait; |
| 139 | u8 line_control; | 143 | u8 line_control; |
| 140 | u8 line_status; | 144 | u8 line_status; |
| 141 | enum pl2303_type type; | ||
| 142 | }; | 145 | }; |
| 143 | 146 | ||
| 144 | static int pl2303_vendor_read(__u16 value, __u16 index, | 147 | static int pl2303_vendor_read(__u16 value, __u16 index, |
| @@ -167,14 +170,19 @@ static int pl2303_vendor_write(__u16 value, __u16 index, | |||
| 167 | 170 | ||
| 168 | static int pl2303_startup(struct usb_serial *serial) | 171 | static int pl2303_startup(struct usb_serial *serial) |
| 169 | { | 172 | { |
| 170 | struct pl2303_private *priv; | 173 | struct pl2303_serial_private *spriv; |
| 171 | enum pl2303_type type = type_0; | 174 | enum pl2303_type type = type_0; |
| 172 | unsigned char *buf; | 175 | unsigned char *buf; |
| 173 | int i; | 176 | |
| 177 | spriv = kzalloc(sizeof(*spriv), GFP_KERNEL); | ||
| 178 | if (!spriv) | ||
| 179 | return -ENOMEM; | ||
| 174 | 180 | ||
| 175 | buf = kmalloc(10, GFP_KERNEL); | 181 | buf = kmalloc(10, GFP_KERNEL); |
| 176 | if (buf == NULL) | 182 | if (!buf) { |
| 183 | kfree(spriv); | ||
| 177 | return -ENOMEM; | 184 | return -ENOMEM; |
| 185 | } | ||
| 178 | 186 | ||
| 179 | if (serial->dev->descriptor.bDeviceClass == 0x02) | 187 | if (serial->dev->descriptor.bDeviceClass == 0x02) |
| 180 | type = type_0; | 188 | type = type_0; |
| @@ -186,15 +194,8 @@ static int pl2303_startup(struct usb_serial *serial) | |||
| 186 | type = type_1; | 194 | type = type_1; |
| 187 | dev_dbg(&serial->interface->dev, "device type: %d\n", type); | 195 | dev_dbg(&serial->interface->dev, "device type: %d\n", type); |
| 188 | 196 | ||
| 189 | for (i = 0; i < serial->num_ports; ++i) { | 197 | spriv->type = type; |
| 190 | priv = kzalloc(sizeof(struct pl2303_private), GFP_KERNEL); | 198 | usb_set_serial_data(serial, spriv); |
| 191 | if (!priv) | ||
| 192 | goto cleanup; | ||
| 193 | spin_lock_init(&priv->lock); | ||
| 194 | init_waitqueue_head(&priv->delta_msr_wait); | ||
| 195 | priv->type = type; | ||
| 196 | usb_set_serial_port_data(serial->port[i], priv); | ||
| 197 | } | ||
| 198 | 199 | ||
| 199 | pl2303_vendor_read(0x8484, 0, serial, buf); | 200 | pl2303_vendor_read(0x8484, 0, serial, buf); |
| 200 | pl2303_vendor_write(0x0404, 0, serial); | 201 | pl2303_vendor_write(0x0404, 0, serial); |
| @@ -213,15 +214,40 @@ static int pl2303_startup(struct usb_serial *serial) | |||
| 213 | 214 | ||
| 214 | kfree(buf); | 215 | kfree(buf); |
| 215 | return 0; | 216 | return 0; |
| 217 | } | ||
| 216 | 218 | ||
| 217 | cleanup: | 219 | static void pl2303_release(struct usb_serial *serial) |
| 218 | kfree(buf); | 220 | { |
| 219 | for (--i; i >= 0; --i) { | 221 | struct pl2303_serial_private *spriv; |
| 220 | priv = usb_get_serial_port_data(serial->port[i]); | 222 | |
| 221 | kfree(priv); | 223 | spriv = usb_get_serial_data(serial); |
| 222 | usb_set_serial_port_data(serial->port[i], NULL); | 224 | kfree(spriv); |
| 223 | } | 225 | } |
| 224 | return -ENOMEM; | 226 | |
| 227 | static int pl2303_port_probe(struct usb_serial_port *port) | ||
| 228 | { | ||
| 229 | struct pl2303_private *priv; | ||
| 230 | |||
| 231 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
| 232 | if (!priv) | ||
| 233 | return -ENOMEM; | ||
| 234 | |||
| 235 | spin_lock_init(&priv->lock); | ||
| 236 | init_waitqueue_head(&priv->delta_msr_wait); | ||
| 237 | |||
| 238 | usb_set_serial_port_data(port, priv); | ||
| 239 | |||
| 240 | return 0; | ||
| 241 | } | ||
| 242 | |||
| 243 | static int pl2303_port_remove(struct usb_serial_port *port) | ||
| 244 | { | ||
| 245 | struct pl2303_private *priv; | ||
| 246 | |||
| 247 | priv = usb_get_serial_port_data(port); | ||
| 248 | kfree(priv); | ||
| 249 | |||
| 250 | return 0; | ||
| 225 | } | 251 | } |
| 226 | 252 | ||
| 227 | static int set_control_lines(struct usb_device *dev, u8 value) | 253 | static int set_control_lines(struct usb_device *dev, u8 value) |
| @@ -240,6 +266,7 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
| 240 | struct usb_serial_port *port, struct ktermios *old_termios) | 266 | struct usb_serial_port *port, struct ktermios *old_termios) |
| 241 | { | 267 | { |
| 242 | struct usb_serial *serial = port->serial; | 268 | struct usb_serial *serial = port->serial; |
| 269 | struct pl2303_serial_private *spriv = usb_get_serial_data(serial); | ||
| 243 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 270 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
| 244 | unsigned long flags; | 271 | unsigned long flags; |
| 245 | unsigned int cflag; | 272 | unsigned int cflag; |
| @@ -323,7 +350,7 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
| 323 | } | 350 | } |
| 324 | if (baud > 1228800) { | 351 | if (baud > 1228800) { |
| 325 | /* type_0, type_1 only support up to 1228800 baud */ | 352 | /* type_0, type_1 only support up to 1228800 baud */ |
| 326 | if (priv->type != HX) | 353 | if (spriv->type != HX) |
| 327 | baud = 1228800; | 354 | baud = 1228800; |
| 328 | else if (baud > 6000000) | 355 | else if (baud > 6000000) |
| 329 | baud = 6000000; | 356 | baud = 6000000; |
| @@ -426,7 +453,7 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
| 426 | buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]); | 453 | buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]); |
| 427 | 454 | ||
| 428 | if (cflag & CRTSCTS) { | 455 | if (cflag & CRTSCTS) { |
| 429 | if (priv->type == HX) | 456 | if (spriv->type == HX) |
| 430 | pl2303_vendor_write(0x0, 0x61, serial); | 457 | pl2303_vendor_write(0x0, 0x61, serial); |
| 431 | else | 458 | else |
| 432 | pl2303_vendor_write(0x0, 0x41, serial); | 459 | pl2303_vendor_write(0x0, 0x41, serial); |
| @@ -468,10 +495,10 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
| 468 | { | 495 | { |
| 469 | struct ktermios tmp_termios; | 496 | struct ktermios tmp_termios; |
| 470 | struct usb_serial *serial = port->serial; | 497 | struct usb_serial *serial = port->serial; |
| 471 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 498 | struct pl2303_serial_private *spriv = usb_get_serial_data(serial); |
| 472 | int result; | 499 | int result; |
| 473 | 500 | ||
| 474 | if (priv->type != HX) { | 501 | if (spriv->type != HX) { |
| 475 | usb_clear_halt(serial->dev, port->write_urb->pipe); | 502 | usb_clear_halt(serial->dev, port->write_urb->pipe); |
| 476 | usb_clear_halt(serial->dev, port->read_urb->pipe); | 503 | usb_clear_halt(serial->dev, port->read_urb->pipe); |
| 477 | } else { | 504 | } else { |
| @@ -655,17 +682,6 @@ static void pl2303_break_ctl(struct tty_struct *tty, int break_state) | |||
| 655 | dev_err(&port->dev, "error sending break = %d\n", result); | 682 | dev_err(&port->dev, "error sending break = %d\n", result); |
| 656 | } | 683 | } |
| 657 | 684 | ||
| 658 | static void pl2303_release(struct usb_serial *serial) | ||
| 659 | { | ||
| 660 | int i; | ||
| 661 | struct pl2303_private *priv; | ||
| 662 | |||
| 663 | for (i = 0; i < serial->num_ports; ++i) { | ||
| 664 | priv = usb_get_serial_port_data(serial->port[i]); | ||
| 665 | kfree(priv); | ||
| 666 | } | ||
| 667 | } | ||
| 668 | |||
| 669 | static void pl2303_update_line_status(struct usb_serial_port *port, | 685 | static void pl2303_update_line_status(struct usb_serial_port *port, |
| 670 | unsigned char *data, | 686 | unsigned char *data, |
| 671 | unsigned int actual_length) | 687 | unsigned int actual_length) |
| @@ -827,6 +843,8 @@ static struct usb_serial_driver pl2303_device = { | |||
| 827 | .read_int_callback = pl2303_read_int_callback, | 843 | .read_int_callback = pl2303_read_int_callback, |
| 828 | .attach = pl2303_startup, | 844 | .attach = pl2303_startup, |
| 829 | .release = pl2303_release, | 845 | .release = pl2303_release, |
| 846 | .port_probe = pl2303_port_probe, | ||
| 847 | .port_remove = pl2303_port_remove, | ||
| 830 | }; | 848 | }; |
| 831 | 849 | ||
| 832 | static struct usb_serial_driver * const serial_drivers[] = { | 850 | static struct usb_serial_driver * const serial_drivers[] = { |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index c3ddb65c05f2..aa148c21ea40 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
| @@ -138,7 +138,6 @@ MODULE_DEVICE_TABLE(usb, id_table); | |||
| 138 | 138 | ||
| 139 | static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | 139 | static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
| 140 | { | 140 | { |
| 141 | struct usb_wwan_intf_private *data; | ||
| 142 | struct usb_host_interface *intf = serial->interface->cur_altsetting; | 141 | struct usb_host_interface *intf = serial->interface->cur_altsetting; |
| 143 | struct device *dev = &serial->dev->dev; | 142 | struct device *dev = &serial->dev->dev; |
| 144 | int retval = -ENODEV; | 143 | int retval = -ENODEV; |
| @@ -154,13 +153,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
| 154 | ifnum = intf->desc.bInterfaceNumber; | 153 | ifnum = intf->desc.bInterfaceNumber; |
| 155 | dev_dbg(dev, "This Interface = %d\n", ifnum); | 154 | dev_dbg(dev, "This Interface = %d\n", ifnum); |
| 156 | 155 | ||
| 157 | data = kzalloc(sizeof(struct usb_wwan_intf_private), | ||
| 158 | GFP_KERNEL); | ||
| 159 | if (!data) | ||
| 160 | return -ENOMEM; | ||
| 161 | |||
| 162 | spin_lock_init(&data->susp_lock); | ||
| 163 | |||
| 164 | if (nintf == 1) { | 156 | if (nintf == 1) { |
| 165 | /* QDL mode */ | 157 | /* QDL mode */ |
| 166 | /* Gobi 2000 has a single altsetting, older ones have two */ | 158 | /* Gobi 2000 has a single altsetting, older ones have two */ |
| @@ -253,20 +245,28 @@ done: | |||
| 253 | } | 245 | } |
| 254 | } | 246 | } |
| 255 | 247 | ||
| 256 | /* Set serial->private if not returning error */ | ||
| 257 | if (retval == 0) | ||
| 258 | usb_set_serial_data(serial, data); | ||
| 259 | else | ||
| 260 | kfree(data); | ||
| 261 | |||
| 262 | return retval; | 248 | return retval; |
| 263 | } | 249 | } |
| 264 | 250 | ||
| 251 | static int qc_attach(struct usb_serial *serial) | ||
| 252 | { | ||
| 253 | struct usb_wwan_intf_private *data; | ||
| 254 | |||
| 255 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
| 256 | if (!data) | ||
| 257 | return -ENOMEM; | ||
| 258 | |||
| 259 | spin_lock_init(&data->susp_lock); | ||
| 260 | |||
| 261 | usb_set_serial_data(serial, data); | ||
| 262 | |||
| 263 | return 0; | ||
| 264 | } | ||
| 265 | |||
| 265 | static void qc_release(struct usb_serial *serial) | 266 | static void qc_release(struct usb_serial *serial) |
| 266 | { | 267 | { |
| 267 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); | 268 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); |
| 268 | 269 | ||
| 269 | /* Free the private data allocated in qcprobe */ | ||
| 270 | usb_set_serial_data(serial, NULL); | 270 | usb_set_serial_data(serial, NULL); |
| 271 | kfree(priv); | 271 | kfree(priv); |
| 272 | } | 272 | } |
| @@ -285,8 +285,9 @@ static struct usb_serial_driver qcdevice = { | |||
| 285 | .write = usb_wwan_write, | 285 | .write = usb_wwan_write, |
| 286 | .write_room = usb_wwan_write_room, | 286 | .write_room = usb_wwan_write_room, |
| 287 | .chars_in_buffer = usb_wwan_chars_in_buffer, | 287 | .chars_in_buffer = usb_wwan_chars_in_buffer, |
| 288 | .attach = usb_wwan_startup, | 288 | .attach = qc_attach, |
| 289 | .release = qc_release, | 289 | .release = qc_release, |
| 290 | .port_probe = usb_wwan_port_probe, | ||
| 290 | .port_remove = usb_wwan_port_remove, | 291 | .port_remove = usb_wwan_port_remove, |
| 291 | #ifdef CONFIG_PM | 292 | #ifdef CONFIG_PM |
| 292 | .suspend = usb_wwan_suspend, | 293 | .suspend = usb_wwan_suspend, |
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index 2cdfdcc90b37..ffcfc962ab10 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c | |||
| @@ -143,12 +143,12 @@ static void qt2_read_bulk_callback(struct urb *urb); | |||
| 143 | 143 | ||
| 144 | static void qt2_release(struct usb_serial *serial) | 144 | static void qt2_release(struct usb_serial *serial) |
| 145 | { | 145 | { |
| 146 | int i; | 146 | struct qt2_serial_private *serial_priv; |
| 147 | 147 | ||
| 148 | kfree(usb_get_serial_data(serial)); | 148 | serial_priv = usb_get_serial_data(serial); |
| 149 | 149 | ||
| 150 | for (i = 0; i < serial->num_ports; i++) | 150 | usb_free_urb(serial_priv->read_urb); |
| 151 | kfree(usb_get_serial_port_data(serial->port[i])); | 151 | kfree(serial_priv); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static inline int calc_baud_divisor(int baudrate) | 154 | static inline int calc_baud_divisor(int baudrate) |
| @@ -423,11 +423,16 @@ static void qt2_close(struct usb_serial_port *port) | |||
| 423 | port_priv->is_open = false; | 423 | port_priv->is_open = false; |
| 424 | 424 | ||
| 425 | spin_lock_irqsave(&port_priv->urb_lock, flags); | 425 | spin_lock_irqsave(&port_priv->urb_lock, flags); |
| 426 | if (port_priv->write_urb->status == -EINPROGRESS) | 426 | usb_kill_urb(port_priv->write_urb); |
| 427 | usb_kill_urb(port_priv->write_urb); | ||
| 428 | port_priv->urb_in_use = false; | 427 | port_priv->urb_in_use = false; |
| 429 | spin_unlock_irqrestore(&port_priv->urb_lock, flags); | 428 | spin_unlock_irqrestore(&port_priv->urb_lock, flags); |
| 430 | 429 | ||
| 430 | mutex_lock(&port->serial->disc_mutex); | ||
| 431 | if (port->serial->disconnected) { | ||
| 432 | mutex_unlock(&port->serial->disc_mutex); | ||
| 433 | return; | ||
| 434 | } | ||
| 435 | |||
| 431 | /* flush the port transmit buffer */ | 436 | /* flush the port transmit buffer */ |
| 432 | i = usb_control_msg(serial->dev, | 437 | i = usb_control_msg(serial->dev, |
| 433 | usb_rcvctrlpipe(serial->dev, 0), | 438 | usb_rcvctrlpipe(serial->dev, 0), |
| @@ -459,26 +464,14 @@ static void qt2_close(struct usb_serial_port *port) | |||
| 459 | dev_err(&port->dev, "%s - close port failed %i\n", | 464 | dev_err(&port->dev, "%s - close port failed %i\n", |
| 460 | __func__, i); | 465 | __func__, i); |
| 461 | 466 | ||
| 467 | mutex_unlock(&port->serial->disc_mutex); | ||
| 462 | } | 468 | } |
| 463 | 469 | ||
| 464 | static void qt2_disconnect(struct usb_serial *serial) | 470 | static void qt2_disconnect(struct usb_serial *serial) |
| 465 | { | 471 | { |
| 466 | struct qt2_serial_private *serial_priv = usb_get_serial_data(serial); | 472 | struct qt2_serial_private *serial_priv = usb_get_serial_data(serial); |
| 467 | struct qt2_port_private *port_priv; | ||
| 468 | int i; | ||
| 469 | |||
| 470 | if (serial_priv->read_urb->status == -EINPROGRESS) | ||
| 471 | usb_kill_urb(serial_priv->read_urb); | ||
| 472 | |||
| 473 | usb_free_urb(serial_priv->read_urb); | ||
| 474 | 473 | ||
| 475 | for (i = 0; i < serial->num_ports; i++) { | 474 | usb_kill_urb(serial_priv->read_urb); |
| 476 | port_priv = usb_get_serial_port_data(serial->port[i]); | ||
| 477 | |||
| 478 | if (port_priv->write_urb->status == -EINPROGRESS) | ||
| 479 | usb_kill_urb(port_priv->write_urb); | ||
| 480 | usb_free_urb(port_priv->write_urb); | ||
| 481 | } | ||
| 482 | } | 475 | } |
| 483 | 476 | ||
| 484 | static int get_serial_info(struct usb_serial_port *port, | 477 | static int get_serial_info(struct usb_serial_port *port, |
| @@ -773,11 +766,9 @@ static void qt2_read_bulk_callback(struct urb *urb) | |||
| 773 | 766 | ||
| 774 | static int qt2_setup_urbs(struct usb_serial *serial) | 767 | static int qt2_setup_urbs(struct usb_serial *serial) |
| 775 | { | 768 | { |
| 776 | struct usb_serial_port *port; | ||
| 777 | struct usb_serial_port *port0; | 769 | struct usb_serial_port *port0; |
| 778 | struct qt2_serial_private *serial_priv; | 770 | struct qt2_serial_private *serial_priv; |
| 779 | struct qt2_port_private *port_priv; | 771 | int status; |
| 780 | int pcount, status; | ||
| 781 | 772 | ||
| 782 | port0 = serial->port[0]; | 773 | port0 = serial->port[0]; |
| 783 | 774 | ||
| @@ -795,46 +786,21 @@ static int qt2_setup_urbs(struct usb_serial *serial) | |||
| 795 | sizeof(serial_priv->read_buffer), | 786 | sizeof(serial_priv->read_buffer), |
| 796 | qt2_read_bulk_callback, serial); | 787 | qt2_read_bulk_callback, serial); |
| 797 | 788 | ||
| 798 | /* setup write_urb for each port */ | ||
| 799 | for (pcount = 0; pcount < serial->num_ports; pcount++) { | ||
| 800 | |||
| 801 | port = serial->port[pcount]; | ||
| 802 | port_priv = usb_get_serial_port_data(port); | ||
| 803 | |||
| 804 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
| 805 | if (!port_priv->write_urb) { | ||
| 806 | dev_err(&serial->dev->dev, | ||
| 807 | "failed to alloc write_urb for port %i\n", | ||
| 808 | pcount); | ||
| 809 | return -ENOMEM; | ||
| 810 | } | ||
| 811 | |||
| 812 | usb_fill_bulk_urb(port_priv->write_urb, | ||
| 813 | serial->dev, | ||
| 814 | usb_sndbulkpipe(serial->dev, | ||
| 815 | port0-> | ||
| 816 | bulk_out_endpointAddress), | ||
| 817 | port_priv->write_buffer, | ||
| 818 | sizeof(port_priv->write_buffer), | ||
| 819 | qt2_write_bulk_callback, port); | ||
| 820 | } | ||
| 821 | |||
| 822 | status = usb_submit_urb(serial_priv->read_urb, GFP_KERNEL); | 789 | status = usb_submit_urb(serial_priv->read_urb, GFP_KERNEL); |
| 823 | if (status != 0) { | 790 | if (status != 0) { |
| 824 | dev_err(&serial->dev->dev, | 791 | dev_err(&serial->dev->dev, |
| 825 | "%s - submit read urb failed %i\n", __func__, status); | 792 | "%s - submit read urb failed %i\n", __func__, status); |
| 793 | usb_free_urb(serial_priv->read_urb); | ||
| 826 | return status; | 794 | return status; |
| 827 | } | 795 | } |
| 828 | 796 | ||
| 829 | return 0; | 797 | return 0; |
| 830 | |||
| 831 | } | 798 | } |
| 832 | 799 | ||
| 833 | static int qt2_attach(struct usb_serial *serial) | 800 | static int qt2_attach(struct usb_serial *serial) |
| 834 | { | 801 | { |
| 835 | struct qt2_serial_private *serial_priv; | 802 | struct qt2_serial_private *serial_priv; |
| 836 | struct qt2_port_private *port_priv; | 803 | int status; |
| 837 | int status, pcount; | ||
| 838 | 804 | ||
| 839 | /* power on unit */ | 805 | /* power on unit */ |
| 840 | status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 806 | status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
| @@ -854,26 +820,6 @@ static int qt2_attach(struct usb_serial *serial) | |||
| 854 | 820 | ||
| 855 | usb_set_serial_data(serial, serial_priv); | 821 | usb_set_serial_data(serial, serial_priv); |
| 856 | 822 | ||
| 857 | for (pcount = 0; pcount < serial->num_ports; pcount++) { | ||
| 858 | port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL); | ||
| 859 | if (!port_priv) { | ||
| 860 | dev_err(&serial->dev->dev, | ||
| 861 | "%s- kmalloc(%Zd) failed.\n", __func__, | ||
| 862 | sizeof(*port_priv)); | ||
| 863 | pcount--; | ||
| 864 | status = -ENOMEM; | ||
| 865 | goto attach_failed; | ||
| 866 | } | ||
| 867 | |||
| 868 | spin_lock_init(&port_priv->lock); | ||
| 869 | spin_lock_init(&port_priv->urb_lock); | ||
| 870 | init_waitqueue_head(&port_priv->delta_msr_wait); | ||
| 871 | |||
| 872 | port_priv->port = serial->port[pcount]; | ||
| 873 | |||
| 874 | usb_set_serial_port_data(serial->port[pcount], port_priv); | ||
| 875 | } | ||
| 876 | |||
| 877 | status = qt2_setup_urbs(serial); | 823 | status = qt2_setup_urbs(serial); |
| 878 | if (status != 0) | 824 | if (status != 0) |
| 879 | goto attach_failed; | 825 | goto attach_failed; |
| @@ -881,14 +827,53 @@ static int qt2_attach(struct usb_serial *serial) | |||
| 881 | return 0; | 827 | return 0; |
| 882 | 828 | ||
| 883 | attach_failed: | 829 | attach_failed: |
| 884 | for (/* empty */; pcount >= 0; pcount--) { | ||
| 885 | port_priv = usb_get_serial_port_data(serial->port[pcount]); | ||
| 886 | kfree(port_priv); | ||
| 887 | } | ||
| 888 | kfree(serial_priv); | 830 | kfree(serial_priv); |
| 889 | return status; | 831 | return status; |
| 890 | } | 832 | } |
| 891 | 833 | ||
| 834 | static int qt2_port_probe(struct usb_serial_port *port) | ||
| 835 | { | ||
| 836 | struct usb_serial *serial = port->serial; | ||
| 837 | struct qt2_port_private *port_priv; | ||
| 838 | u8 bEndpointAddress; | ||
| 839 | |||
| 840 | port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL); | ||
| 841 | if (!port_priv) | ||
| 842 | return -ENOMEM; | ||
| 843 | |||
| 844 | spin_lock_init(&port_priv->lock); | ||
| 845 | spin_lock_init(&port_priv->urb_lock); | ||
| 846 | init_waitqueue_head(&port_priv->delta_msr_wait); | ||
| 847 | port_priv->port = port; | ||
| 848 | |||
| 849 | port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
| 850 | if (!port_priv->write_urb) { | ||
| 851 | kfree(port_priv); | ||
| 852 | return -ENOMEM; | ||
| 853 | } | ||
| 854 | bEndpointAddress = serial->port[0]->bulk_out_endpointAddress; | ||
| 855 | usb_fill_bulk_urb(port_priv->write_urb, serial->dev, | ||
| 856 | usb_sndbulkpipe(serial->dev, bEndpointAddress), | ||
| 857 | port_priv->write_buffer, | ||
| 858 | sizeof(port_priv->write_buffer), | ||
| 859 | qt2_write_bulk_callback, port); | ||
| 860 | |||
| 861 | usb_set_serial_port_data(port, port_priv); | ||
| 862 | |||
| 863 | return 0; | ||
| 864 | } | ||
| 865 | |||
| 866 | static int qt2_port_remove(struct usb_serial_port *port) | ||
| 867 | { | ||
| 868 | struct qt2_port_private *port_priv; | ||
| 869 | |||
| 870 | port_priv = usb_get_serial_port_data(port); | ||
| 871 | usb_free_urb(port_priv->write_urb); | ||
| 872 | kfree(port_priv); | ||
| 873 | |||
| 874 | return 0; | ||
| 875 | } | ||
| 876 | |||
| 892 | static int qt2_tiocmget(struct tty_struct *tty) | 877 | static int qt2_tiocmget(struct tty_struct *tty) |
| 893 | { | 878 | { |
| 894 | struct usb_serial_port *port = tty->driver_data; | 879 | struct usb_serial_port *port = tty->driver_data; |
| @@ -1127,6 +1112,8 @@ static struct usb_serial_driver qt2_device = { | |||
| 1127 | .attach = qt2_attach, | 1112 | .attach = qt2_attach, |
| 1128 | .release = qt2_release, | 1113 | .release = qt2_release, |
| 1129 | .disconnect = qt2_disconnect, | 1114 | .disconnect = qt2_disconnect, |
| 1115 | .port_probe = qt2_port_probe, | ||
| 1116 | .port_remove = qt2_port_remove, | ||
| 1130 | .dtr_rts = qt2_dtr_rts, | 1117 | .dtr_rts = qt2_dtr_rts, |
| 1131 | .break_ctl = qt2_break_ctl, | 1118 | .break_ctl = qt2_break_ctl, |
| 1132 | .tiocmget = qt2_tiocmget, | 1119 | .tiocmget = qt2_tiocmget, |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 01d882cf3775..270860f6bb2a 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
| @@ -161,7 +161,6 @@ static int sierra_probe(struct usb_serial *serial, | |||
| 161 | { | 161 | { |
| 162 | int result = 0; | 162 | int result = 0; |
| 163 | struct usb_device *udev; | 163 | struct usb_device *udev; |
| 164 | struct sierra_intf_private *data; | ||
| 165 | u8 ifnum; | 164 | u8 ifnum; |
| 166 | 165 | ||
| 167 | udev = serial->dev; | 166 | udev = serial->dev; |
| @@ -188,11 +187,6 @@ static int sierra_probe(struct usb_serial *serial, | |||
| 188 | return -ENODEV; | 187 | return -ENODEV; |
| 189 | } | 188 | } |
| 190 | 189 | ||
| 191 | data = serial->private = kzalloc(sizeof(struct sierra_intf_private), GFP_KERNEL); | ||
| 192 | if (!data) | ||
| 193 | return -ENOMEM; | ||
| 194 | spin_lock_init(&data->susp_lock); | ||
| 195 | |||
| 196 | return result; | 190 | return result; |
| 197 | } | 191 | } |
| 198 | 192 | ||
| @@ -884,11 +878,15 @@ static void sierra_dtr_rts(struct usb_serial_port *port, int on) | |||
| 884 | 878 | ||
| 885 | static int sierra_startup(struct usb_serial *serial) | 879 | static int sierra_startup(struct usb_serial *serial) |
| 886 | { | 880 | { |
| 887 | struct usb_serial_port *port; | 881 | struct sierra_intf_private *intfdata; |
| 888 | struct sierra_port_private *portdata; | 882 | |
| 889 | struct sierra_iface_info *himemoryp = NULL; | 883 | intfdata = kzalloc(sizeof(*intfdata), GFP_KERNEL); |
| 890 | int i; | 884 | if (!intfdata) |
| 891 | u8 ifnum; | 885 | return -ENOMEM; |
| 886 | |||
| 887 | spin_lock_init(&intfdata->susp_lock); | ||
| 888 | |||
| 889 | usb_set_serial_data(serial, intfdata); | ||
| 892 | 890 | ||
| 893 | /* Set Device mode to D0 */ | 891 | /* Set Device mode to D0 */ |
| 894 | sierra_set_power_state(serial->dev, 0x0000); | 892 | sierra_set_power_state(serial->dev, 0x0000); |
| @@ -897,68 +895,71 @@ static int sierra_startup(struct usb_serial *serial) | |||
| 897 | if (nmea) | 895 | if (nmea) |
| 898 | sierra_vsc_set_nmea(serial->dev, 1); | 896 | sierra_vsc_set_nmea(serial->dev, 1); |
| 899 | 897 | ||
| 900 | /* Now setup per port private data */ | ||
| 901 | for (i = 0; i < serial->num_ports; i++) { | ||
| 902 | port = serial->port[i]; | ||
| 903 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); | ||
| 904 | if (!portdata) { | ||
| 905 | dev_dbg(&port->dev, "%s: kmalloc for " | ||
| 906 | "sierra_port_private (%d) failed!\n", | ||
| 907 | __func__, i); | ||
| 908 | return -ENOMEM; | ||
| 909 | } | ||
| 910 | spin_lock_init(&portdata->lock); | ||
| 911 | init_usb_anchor(&portdata->active); | ||
| 912 | init_usb_anchor(&portdata->delayed); | ||
| 913 | ifnum = i; | ||
| 914 | /* Assume low memory requirements */ | ||
| 915 | portdata->num_out_urbs = N_OUT_URB; | ||
| 916 | portdata->num_in_urbs = N_IN_URB; | ||
| 917 | |||
| 918 | /* Determine actual memory requirements */ | ||
| 919 | if (serial->num_ports == 1) { | ||
| 920 | /* Get interface number for composite device */ | ||
| 921 | ifnum = sierra_calc_interface(serial); | ||
| 922 | himemoryp = | ||
| 923 | (struct sierra_iface_info *)&typeB_interface_list; | ||
| 924 | if (is_himemory(ifnum, himemoryp)) { | ||
| 925 | portdata->num_out_urbs = N_OUT_URB_HM; | ||
| 926 | portdata->num_in_urbs = N_IN_URB_HM; | ||
| 927 | } | ||
| 928 | } | ||
| 929 | else { | ||
| 930 | himemoryp = | ||
| 931 | (struct sierra_iface_info *)&typeA_interface_list; | ||
| 932 | if (is_himemory(i, himemoryp)) { | ||
| 933 | portdata->num_out_urbs = N_OUT_URB_HM; | ||
| 934 | portdata->num_in_urbs = N_IN_URB_HM; | ||
| 935 | } | ||
| 936 | } | ||
| 937 | dev_dbg(&serial->dev->dev, | ||
| 938 | "Memory usage (urbs) interface #%d, in=%d, out=%d\n", | ||
| 939 | ifnum,portdata->num_in_urbs, portdata->num_out_urbs ); | ||
| 940 | /* Set the port private data pointer */ | ||
| 941 | usb_set_serial_port_data(port, portdata); | ||
| 942 | } | ||
| 943 | |||
| 944 | return 0; | 898 | return 0; |
| 945 | } | 899 | } |
| 946 | 900 | ||
| 947 | static void sierra_release(struct usb_serial *serial) | 901 | static void sierra_release(struct usb_serial *serial) |
| 948 | { | 902 | { |
| 949 | int i; | 903 | struct sierra_intf_private *intfdata; |
| 950 | struct usb_serial_port *port; | 904 | |
| 905 | intfdata = usb_get_serial_data(serial); | ||
| 906 | kfree(intfdata); | ||
| 907 | } | ||
| 908 | |||
| 909 | static int sierra_port_probe(struct usb_serial_port *port) | ||
| 910 | { | ||
| 911 | struct usb_serial *serial = port->serial; | ||
| 951 | struct sierra_port_private *portdata; | 912 | struct sierra_port_private *portdata; |
| 913 | const struct sierra_iface_info *himemoryp; | ||
| 914 | u8 ifnum; | ||
| 952 | 915 | ||
| 953 | for (i = 0; i < serial->num_ports; ++i) { | 916 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); |
| 954 | port = serial->port[i]; | 917 | if (!portdata) |
| 955 | if (!port) | 918 | return -ENOMEM; |
| 956 | continue; | 919 | |
| 957 | portdata = usb_get_serial_port_data(port); | 920 | spin_lock_init(&portdata->lock); |
| 958 | if (!portdata) | 921 | init_usb_anchor(&portdata->active); |
| 959 | continue; | 922 | init_usb_anchor(&portdata->delayed); |
| 960 | kfree(portdata); | 923 | |
| 924 | /* Assume low memory requirements */ | ||
| 925 | portdata->num_out_urbs = N_OUT_URB; | ||
| 926 | portdata->num_in_urbs = N_IN_URB; | ||
| 927 | |||
| 928 | /* Determine actual memory requirements */ | ||
| 929 | if (serial->num_ports == 1) { | ||
| 930 | /* Get interface number for composite device */ | ||
| 931 | ifnum = sierra_calc_interface(serial); | ||
| 932 | himemoryp = &typeB_interface_list; | ||
| 933 | } else { | ||
| 934 | /* This is really the usb-serial port number of the interface | ||
| 935 | * rather than the interface number. | ||
| 936 | */ | ||
| 937 | ifnum = port->number - serial->minor; | ||
| 938 | himemoryp = &typeA_interface_list; | ||
| 961 | } | 939 | } |
| 940 | |||
| 941 | if (is_himemory(ifnum, himemoryp)) { | ||
| 942 | portdata->num_out_urbs = N_OUT_URB_HM; | ||
| 943 | portdata->num_in_urbs = N_IN_URB_HM; | ||
| 944 | } | ||
| 945 | |||
| 946 | dev_dbg(&port->dev, | ||
| 947 | "Memory usage (urbs) interface #%d, in=%d, out=%d\n", | ||
| 948 | ifnum, portdata->num_in_urbs, portdata->num_out_urbs); | ||
| 949 | |||
| 950 | usb_set_serial_port_data(port, portdata); | ||
| 951 | |||
| 952 | return 0; | ||
| 953 | } | ||
| 954 | |||
| 955 | static int sierra_port_remove(struct usb_serial_port *port) | ||
| 956 | { | ||
| 957 | struct sierra_port_private *portdata; | ||
| 958 | |||
| 959 | portdata = usb_get_serial_port_data(port); | ||
| 960 | kfree(portdata); | ||
| 961 | |||
| 962 | return 0; | ||
| 962 | } | 963 | } |
| 963 | 964 | ||
| 964 | #ifdef CONFIG_PM | 965 | #ifdef CONFIG_PM |
| @@ -1062,6 +1063,8 @@ static struct usb_serial_driver sierra_device = { | |||
| 1062 | .tiocmset = sierra_tiocmset, | 1063 | .tiocmset = sierra_tiocmset, |
| 1063 | .attach = sierra_startup, | 1064 | .attach = sierra_startup, |
| 1064 | .release = sierra_release, | 1065 | .release = sierra_release, |
| 1066 | .port_probe = sierra_port_probe, | ||
| 1067 | .port_remove = sierra_port_remove, | ||
| 1065 | .suspend = sierra_suspend, | 1068 | .suspend = sierra_suspend, |
| 1066 | .resume = sierra_resume, | 1069 | .resume = sierra_resume, |
| 1067 | .read_int_callback = sierra_instat_callback, | 1070 | .read_int_callback = sierra_instat_callback, |
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 9716efe92955..769c137f8975 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
| @@ -157,13 +157,10 @@ struct spcp8x5_private { | |||
| 157 | u8 line_status; | 157 | u8 line_status; |
| 158 | }; | 158 | }; |
| 159 | 159 | ||
| 160 | /* desc : when device plug in,this function would be called. | 160 | static int spcp8x5_port_probe(struct usb_serial_port *port) |
| 161 | * thanks to usb_serial subsystem,then do almost every things for us. And what | ||
| 162 | * we should do just alloc the buffer */ | ||
| 163 | static int spcp8x5_startup(struct usb_serial *serial) | ||
| 164 | { | 161 | { |
| 162 | struct usb_serial *serial = port->serial; | ||
| 165 | struct spcp8x5_private *priv; | 163 | struct spcp8x5_private *priv; |
| 166 | int i; | ||
| 167 | enum spcp8x5_type type = SPCP825_007_TYPE; | 164 | enum spcp8x5_type type = SPCP825_007_TYPE; |
| 168 | u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); | 165 | u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); |
| 169 | 166 | ||
| @@ -180,34 +177,27 @@ static int spcp8x5_startup(struct usb_serial *serial) | |||
| 180 | type = SPCP825_PHILIP_TYPE; | 177 | type = SPCP825_PHILIP_TYPE; |
| 181 | dev_dbg(&serial->dev->dev, "device type = %d\n", (int)type); | 178 | dev_dbg(&serial->dev->dev, "device type = %d\n", (int)type); |
| 182 | 179 | ||
| 183 | for (i = 0; i < serial->num_ports; ++i) { | 180 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 184 | priv = kzalloc(sizeof(struct spcp8x5_private), GFP_KERNEL); | 181 | if (!priv) |
| 185 | if (!priv) | 182 | return -ENOMEM; |
| 186 | goto cleanup; | ||
| 187 | 183 | ||
| 188 | spin_lock_init(&priv->lock); | 184 | spin_lock_init(&priv->lock); |
| 189 | init_waitqueue_head(&priv->delta_msr_wait); | 185 | init_waitqueue_head(&priv->delta_msr_wait); |
| 190 | priv->type = type; | 186 | priv->type = type; |
| 191 | usb_set_serial_port_data(serial->port[i] , priv); | 187 | |
| 192 | } | 188 | usb_set_serial_port_data(port , priv); |
| 193 | 189 | ||
| 194 | return 0; | 190 | return 0; |
| 195 | cleanup: | ||
| 196 | for (--i; i >= 0; --i) { | ||
| 197 | priv = usb_get_serial_port_data(serial->port[i]); | ||
| 198 | kfree(priv); | ||
| 199 | usb_set_serial_port_data(serial->port[i] , NULL); | ||
| 200 | } | ||
| 201 | return -ENOMEM; | ||
| 202 | } | 191 | } |
| 203 | 192 | ||
| 204 | /* call when the device plug out. free all the memory alloced by probe */ | 193 | static int spcp8x5_port_remove(struct usb_serial_port *port) |
| 205 | static void spcp8x5_release(struct usb_serial *serial) | ||
| 206 | { | 194 | { |
| 207 | int i; | 195 | struct spcp8x5_private *priv; |
| 208 | 196 | ||
| 209 | for (i = 0; i < serial->num_ports; i++) | 197 | priv = usb_get_serial_port_data(port); |
| 210 | kfree(usb_get_serial_port_data(serial->port[i])); | 198 | kfree(priv); |
| 199 | |||
| 200 | return 0; | ||
| 211 | } | 201 | } |
| 212 | 202 | ||
| 213 | /* set the modem control line of the device. | 203 | /* set the modem control line of the device. |
| @@ -649,8 +639,8 @@ static struct usb_serial_driver spcp8x5_device = { | |||
| 649 | .ioctl = spcp8x5_ioctl, | 639 | .ioctl = spcp8x5_ioctl, |
| 650 | .tiocmget = spcp8x5_tiocmget, | 640 | .tiocmget = spcp8x5_tiocmget, |
| 651 | .tiocmset = spcp8x5_tiocmset, | 641 | .tiocmset = spcp8x5_tiocmset, |
| 652 | .attach = spcp8x5_startup, | 642 | .port_probe = spcp8x5_port_probe, |
| 653 | .release = spcp8x5_release, | 643 | .port_remove = spcp8x5_port_remove, |
| 654 | .process_read_urb = spcp8x5_process_read_urb, | 644 | .process_read_urb = spcp8x5_process_read_urb, |
| 655 | }; | 645 | }; |
| 656 | 646 | ||
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index 015810b3785b..868d1e6852e2 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
| @@ -67,13 +67,6 @@ struct ssu100_port_private { | |||
| 67 | struct async_icount icount; | 67 | struct async_icount icount; |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | static void ssu100_release(struct usb_serial *serial) | ||
| 71 | { | ||
| 72 | struct ssu100_port_private *priv = usb_get_serial_port_data(*serial->port); | ||
| 73 | |||
| 74 | kfree(priv); | ||
| 75 | } | ||
| 76 | |||
| 77 | static inline int ssu100_control_msg(struct usb_device *dev, | 70 | static inline int ssu100_control_msg(struct usb_device *dev, |
| 78 | u8 request, u16 data, u16 index) | 71 | u8 request, u16 data, u16 index) |
| 79 | { | 72 | { |
| @@ -442,21 +435,33 @@ static int ssu100_ioctl(struct tty_struct *tty, | |||
| 442 | 435 | ||
| 443 | static int ssu100_attach(struct usb_serial *serial) | 436 | static int ssu100_attach(struct usb_serial *serial) |
| 444 | { | 437 | { |
| 438 | return ssu100_initdevice(serial->dev); | ||
| 439 | } | ||
| 440 | |||
| 441 | static int ssu100_port_probe(struct usb_serial_port *port) | ||
| 442 | { | ||
| 445 | struct ssu100_port_private *priv; | 443 | struct ssu100_port_private *priv; |
| 446 | struct usb_serial_port *port = *serial->port; | ||
| 447 | 444 | ||
| 448 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 445 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 449 | if (!priv) { | 446 | if (!priv) |
| 450 | dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__, | ||
| 451 | sizeof(*priv)); | ||
| 452 | return -ENOMEM; | 447 | return -ENOMEM; |
| 453 | } | ||
| 454 | 448 | ||
| 455 | spin_lock_init(&priv->status_lock); | 449 | spin_lock_init(&priv->status_lock); |
| 456 | init_waitqueue_head(&priv->delta_msr_wait); | 450 | init_waitqueue_head(&priv->delta_msr_wait); |
| 451 | |||
| 457 | usb_set_serial_port_data(port, priv); | 452 | usb_set_serial_port_data(port, priv); |
| 458 | 453 | ||
| 459 | return ssu100_initdevice(serial->dev); | 454 | return 0; |
| 455 | } | ||
| 456 | |||
| 457 | static int ssu100_port_remove(struct usb_serial_port *port) | ||
| 458 | { | ||
| 459 | struct ssu100_port_private *priv; | ||
| 460 | |||
| 461 | priv = usb_get_serial_port_data(port); | ||
| 462 | kfree(priv); | ||
| 463 | |||
| 464 | return 0; | ||
| 460 | } | 465 | } |
| 461 | 466 | ||
| 462 | static int ssu100_tiocmget(struct tty_struct *tty) | 467 | static int ssu100_tiocmget(struct tty_struct *tty) |
| @@ -647,7 +652,8 @@ static struct usb_serial_driver ssu100_device = { | |||
| 647 | .open = ssu100_open, | 652 | .open = ssu100_open, |
| 648 | .close = ssu100_close, | 653 | .close = ssu100_close, |
| 649 | .attach = ssu100_attach, | 654 | .attach = ssu100_attach, |
| 650 | .release = ssu100_release, | 655 | .port_probe = ssu100_port_probe, |
| 656 | .port_remove = ssu100_port_remove, | ||
| 651 | .dtr_rts = ssu100_dtr_rts, | 657 | .dtr_rts = ssu100_dtr_rts, |
| 652 | .process_read_urb = ssu100_process_read_urb, | 658 | .process_read_urb = ssu100_process_read_urb, |
| 653 | .tiocmget = ssu100_tiocmget, | 659 | .tiocmget = ssu100_tiocmget, |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 6f49392cda5b..f2530d2ef3c4 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
| @@ -97,6 +97,8 @@ struct ti_device { | |||
| 97 | 97 | ||
| 98 | static int ti_startup(struct usb_serial *serial); | 98 | static int ti_startup(struct usb_serial *serial); |
| 99 | static void ti_release(struct usb_serial *serial); | 99 | static void ti_release(struct usb_serial *serial); |
| 100 | static int ti_port_probe(struct usb_serial_port *port); | ||
| 101 | static int ti_port_remove(struct usb_serial_port *port); | ||
| 100 | static int ti_open(struct tty_struct *tty, struct usb_serial_port *port); | 102 | static int ti_open(struct tty_struct *tty, struct usb_serial_port *port); |
| 101 | static void ti_close(struct usb_serial_port *port); | 103 | static void ti_close(struct usb_serial_port *port); |
| 102 | static int ti_write(struct tty_struct *tty, struct usb_serial_port *port, | 104 | static int ti_write(struct tty_struct *tty, struct usb_serial_port *port, |
| @@ -221,6 +223,8 @@ static struct usb_serial_driver ti_1port_device = { | |||
| 221 | .num_ports = 1, | 223 | .num_ports = 1, |
| 222 | .attach = ti_startup, | 224 | .attach = ti_startup, |
| 223 | .release = ti_release, | 225 | .release = ti_release, |
| 226 | .port_probe = ti_port_probe, | ||
| 227 | .port_remove = ti_port_remove, | ||
| 224 | .open = ti_open, | 228 | .open = ti_open, |
| 225 | .close = ti_close, | 229 | .close = ti_close, |
| 226 | .write = ti_write, | 230 | .write = ti_write, |
| @@ -249,6 +253,8 @@ static struct usb_serial_driver ti_2port_device = { | |||
| 249 | .num_ports = 2, | 253 | .num_ports = 2, |
| 250 | .attach = ti_startup, | 254 | .attach = ti_startup, |
| 251 | .release = ti_release, | 255 | .release = ti_release, |
| 256 | .port_probe = ti_port_probe, | ||
| 257 | .port_remove = ti_port_remove, | ||
| 252 | .open = ti_open, | 258 | .open = ti_open, |
| 253 | .close = ti_close, | 259 | .close = ti_close, |
| 254 | .write = ti_write, | 260 | .write = ti_write, |
| @@ -347,11 +353,8 @@ module_exit(ti_exit); | |||
| 347 | static int ti_startup(struct usb_serial *serial) | 353 | static int ti_startup(struct usb_serial *serial) |
| 348 | { | 354 | { |
| 349 | struct ti_device *tdev; | 355 | struct ti_device *tdev; |
| 350 | struct ti_port *tport; | ||
| 351 | struct usb_device *dev = serial->dev; | 356 | struct usb_device *dev = serial->dev; |
| 352 | int status; | 357 | int status; |
| 353 | int i; | ||
| 354 | |||
| 355 | 358 | ||
| 356 | dev_dbg(&dev->dev, | 359 | dev_dbg(&dev->dev, |
| 357 | "%s - product 0x%4X, num configurations %d, configuration value %d", | 360 | "%s - product 0x%4X, num configurations %d, configuration value %d", |
| @@ -399,42 +402,8 @@ static int ti_startup(struct usb_serial *serial) | |||
| 399 | goto free_tdev; | 402 | goto free_tdev; |
| 400 | } | 403 | } |
| 401 | 404 | ||
| 402 | /* set up port structures */ | ||
| 403 | for (i = 0; i < serial->num_ports; ++i) { | ||
| 404 | tport = kzalloc(sizeof(struct ti_port), GFP_KERNEL); | ||
| 405 | if (tport == NULL) { | ||
| 406 | dev_err(&dev->dev, "%s - out of memory\n", __func__); | ||
| 407 | status = -ENOMEM; | ||
| 408 | goto free_tports; | ||
| 409 | } | ||
| 410 | spin_lock_init(&tport->tp_lock); | ||
| 411 | tport->tp_uart_base_addr = (i == 0 ? | ||
| 412 | TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR); | ||
| 413 | tport->tp_closing_wait = closing_wait; | ||
| 414 | init_waitqueue_head(&tport->tp_msr_wait); | ||
| 415 | init_waitqueue_head(&tport->tp_write_wait); | ||
| 416 | if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, | ||
| 417 | GFP_KERNEL)) { | ||
| 418 | dev_err(&dev->dev, "%s - out of memory\n", __func__); | ||
| 419 | kfree(tport); | ||
| 420 | status = -ENOMEM; | ||
| 421 | goto free_tports; | ||
| 422 | } | ||
| 423 | tport->tp_port = serial->port[i]; | ||
| 424 | tport->tp_tdev = tdev; | ||
| 425 | usb_set_serial_port_data(serial->port[i], tport); | ||
| 426 | tport->tp_uart_mode = 0; /* default is RS232 */ | ||
| 427 | } | ||
| 428 | |||
| 429 | return 0; | 405 | return 0; |
| 430 | 406 | ||
| 431 | free_tports: | ||
| 432 | for (--i; i >= 0; --i) { | ||
| 433 | tport = usb_get_serial_port_data(serial->port[i]); | ||
| 434 | kfifo_free(&tport->write_fifo); | ||
| 435 | kfree(tport); | ||
| 436 | usb_set_serial_port_data(serial->port[i], NULL); | ||
| 437 | } | ||
| 438 | free_tdev: | 407 | free_tdev: |
| 439 | kfree(tdev); | 408 | kfree(tdev); |
| 440 | usb_set_serial_data(serial, NULL); | 409 | usb_set_serial_data(serial, NULL); |
| @@ -444,21 +413,50 @@ free_tdev: | |||
| 444 | 413 | ||
| 445 | static void ti_release(struct usb_serial *serial) | 414 | static void ti_release(struct usb_serial *serial) |
| 446 | { | 415 | { |
| 447 | int i; | ||
| 448 | struct ti_device *tdev = usb_get_serial_data(serial); | 416 | struct ti_device *tdev = usb_get_serial_data(serial); |
| 417 | |||
| 418 | kfree(tdev); | ||
| 419 | } | ||
| 420 | |||
| 421 | static int ti_port_probe(struct usb_serial_port *port) | ||
| 422 | { | ||
| 449 | struct ti_port *tport; | 423 | struct ti_port *tport; |
| 450 | 424 | ||
| 451 | for (i = 0; i < serial->num_ports; ++i) { | 425 | tport = kzalloc(sizeof(*tport), GFP_KERNEL); |
| 452 | tport = usb_get_serial_port_data(serial->port[i]); | 426 | if (!tport) |
| 453 | if (tport) { | 427 | return -ENOMEM; |
| 454 | kfifo_free(&tport->write_fifo); | 428 | |
| 455 | kfree(tport); | 429 | spin_lock_init(&tport->tp_lock); |
| 456 | } | 430 | if (port == port->serial->port[0]) |
| 431 | tport->tp_uart_base_addr = TI_UART1_BASE_ADDR; | ||
| 432 | else | ||
| 433 | tport->tp_uart_base_addr = TI_UART2_BASE_ADDR; | ||
| 434 | tport->tp_closing_wait = closing_wait; | ||
| 435 | init_waitqueue_head(&tport->tp_msr_wait); | ||
| 436 | init_waitqueue_head(&tport->tp_write_wait); | ||
| 437 | if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, GFP_KERNEL)) { | ||
| 438 | kfree(tport); | ||
| 439 | return -ENOMEM; | ||
| 457 | } | 440 | } |
| 441 | tport->tp_port = port; | ||
| 442 | tport->tp_tdev = usb_get_serial_data(port->serial); | ||
| 443 | tport->tp_uart_mode = 0; /* default is RS232 */ | ||
| 458 | 444 | ||
| 459 | kfree(tdev); | 445 | usb_set_serial_port_data(port, tport); |
| 446 | |||
| 447 | return 0; | ||
| 460 | } | 448 | } |
| 461 | 449 | ||
| 450 | static int ti_port_remove(struct usb_serial_port *port) | ||
| 451 | { | ||
| 452 | struct ti_port *tport; | ||
| 453 | |||
| 454 | tport = usb_get_serial_port_data(port); | ||
| 455 | kfifo_free(&tport->write_fifo); | ||
| 456 | kfree(tport); | ||
| 457 | |||
| 458 | return 0; | ||
| 459 | } | ||
| 462 | 460 | ||
| 463 | static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) | 461 | static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) |
| 464 | { | 462 | { |
diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h index 1f034d2397c6..684739b8efd0 100644 --- a/drivers/usb/serial/usb-wwan.h +++ b/drivers/usb/serial/usb-wwan.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on); | 8 | extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on); |
| 9 | extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port); | 9 | extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port); |
| 10 | extern void usb_wwan_close(struct usb_serial_port *port); | 10 | extern void usb_wwan_close(struct usb_serial_port *port); |
| 11 | extern int usb_wwan_startup(struct usb_serial *serial); | 11 | extern int usb_wwan_port_probe(struct usb_serial_port *port); |
| 12 | extern int usb_wwan_port_remove(struct usb_serial_port *port); | 12 | extern int usb_wwan_port_remove(struct usb_serial_port *port); |
| 13 | extern int usb_wwan_write_room(struct tty_struct *tty); | 13 | extern int usb_wwan_write_room(struct tty_struct *tty); |
| 14 | extern void usb_wwan_set_termios(struct tty_struct *tty, | 14 | extern void usb_wwan_set_termios(struct tty_struct *tty, |
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index e42aa398ed37..61a73ad1a187 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c | |||
| @@ -447,10 +447,12 @@ void usb_wwan_close(struct usb_serial_port *port) | |||
| 447 | EXPORT_SYMBOL(usb_wwan_close); | 447 | EXPORT_SYMBOL(usb_wwan_close); |
| 448 | 448 | ||
| 449 | /* Helper functions used by usb_wwan_setup_urbs */ | 449 | /* Helper functions used by usb_wwan_setup_urbs */ |
| 450 | static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint, | 450 | static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, |
| 451 | int endpoint, | ||
| 451 | int dir, void *ctx, char *buf, int len, | 452 | int dir, void *ctx, char *buf, int len, |
| 452 | void (*callback) (struct urb *)) | 453 | void (*callback) (struct urb *)) |
| 453 | { | 454 | { |
| 455 | struct usb_serial *serial = port->serial; | ||
| 454 | struct urb *urb; | 456 | struct urb *urb; |
| 455 | 457 | ||
| 456 | if (endpoint == -1) | 458 | if (endpoint == -1) |
| @@ -472,101 +474,75 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint, | |||
| 472 | return urb; | 474 | return urb; |
| 473 | } | 475 | } |
| 474 | 476 | ||
| 475 | /* Setup urbs */ | 477 | int usb_wwan_port_probe(struct usb_serial_port *port) |
| 476 | static void usb_wwan_setup_urbs(struct usb_serial *serial) | ||
| 477 | { | 478 | { |
| 478 | int i, j; | ||
| 479 | struct usb_serial_port *port; | ||
| 480 | struct usb_wwan_port_private *portdata; | 479 | struct usb_wwan_port_private *portdata; |
| 480 | struct urb *urb; | ||
| 481 | u8 *buffer; | ||
| 482 | int err; | ||
| 483 | int i; | ||
| 481 | 484 | ||
| 482 | for (i = 0; i < serial->num_ports; i++) { | 485 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); |
| 483 | port = serial->port[i]; | 486 | if (!portdata) |
| 484 | portdata = usb_get_serial_port_data(port); | 487 | return -ENOMEM; |
| 485 | 488 | ||
| 486 | /* Do indat endpoints first */ | 489 | init_usb_anchor(&portdata->delayed); |
| 487 | for (j = 0; j < N_IN_URB; ++j) { | ||
| 488 | portdata->in_urbs[j] = usb_wwan_setup_urb(serial, | ||
| 489 | port-> | ||
| 490 | bulk_in_endpointAddress, | ||
| 491 | USB_DIR_IN, | ||
| 492 | port, | ||
| 493 | portdata-> | ||
| 494 | in_buffer[j], | ||
| 495 | IN_BUFLEN, | ||
| 496 | usb_wwan_indat_callback); | ||
| 497 | } | ||
| 498 | 490 | ||
| 499 | /* outdat endpoints */ | 491 | for (i = 0; i < N_IN_URB; i++) { |
| 500 | for (j = 0; j < N_OUT_URB; ++j) { | 492 | buffer = (u8 *)__get_free_page(GFP_KERNEL); |
| 501 | portdata->out_urbs[j] = usb_wwan_setup_urb(serial, | 493 | if (!buffer) |
| 502 | port-> | 494 | goto bail_out_error; |
| 503 | bulk_out_endpointAddress, | 495 | portdata->in_buffer[i] = buffer; |
| 504 | USB_DIR_OUT, | 496 | |
| 505 | port, | 497 | urb = usb_wwan_setup_urb(port, port->bulk_in_endpointAddress, |
| 506 | portdata-> | 498 | USB_DIR_IN, port, |
| 507 | out_buffer | 499 | buffer, IN_BUFLEN, |
| 508 | [j], | 500 | usb_wwan_indat_callback); |
| 509 | OUT_BUFLEN, | 501 | portdata->in_urbs[i] = urb; |
| 510 | usb_wwan_outdat_callback); | ||
| 511 | } | ||
| 512 | } | 502 | } |
| 513 | } | ||
| 514 | |||
| 515 | int usb_wwan_startup(struct usb_serial *serial) | ||
| 516 | { | ||
| 517 | int i, j, err; | ||
| 518 | struct usb_serial_port *port; | ||
| 519 | struct usb_wwan_port_private *portdata; | ||
| 520 | u8 *buffer; | ||
| 521 | 503 | ||
| 522 | /* Now setup per port private data */ | 504 | for (i = 0; i < N_OUT_URB; i++) { |
| 523 | for (i = 0; i < serial->num_ports; i++) { | 505 | if (port->bulk_out_endpointAddress == -1) |
| 524 | port = serial->port[i]; | 506 | continue; |
| 525 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); | ||
| 526 | if (!portdata) { | ||
| 527 | dev_dbg(&port->dev, "%s: kmalloc for usb_wwan_port_private (%d) failed!.\n", | ||
| 528 | __func__, i); | ||
| 529 | return 1; | ||
| 530 | } | ||
| 531 | init_usb_anchor(&portdata->delayed); | ||
| 532 | 507 | ||
| 533 | for (j = 0; j < N_IN_URB; j++) { | 508 | buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL); |
| 534 | buffer = (u8 *) __get_free_page(GFP_KERNEL); | 509 | if (!buffer) |
| 535 | if (!buffer) | 510 | goto bail_out_error2; |
| 536 | goto bail_out_error; | 511 | portdata->out_buffer[i] = buffer; |
| 537 | portdata->in_buffer[j] = buffer; | ||
| 538 | } | ||
| 539 | 512 | ||
| 540 | for (j = 0; j < N_OUT_URB; j++) { | 513 | urb = usb_wwan_setup_urb(port, port->bulk_out_endpointAddress, |
| 541 | buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL); | 514 | USB_DIR_OUT, port, |
| 542 | if (!buffer) | 515 | buffer, OUT_BUFLEN, |
| 543 | goto bail_out_error2; | 516 | usb_wwan_outdat_callback); |
| 544 | portdata->out_buffer[j] = buffer; | 517 | portdata->out_urbs[i] = urb; |
| 545 | } | 518 | } |
| 546 | 519 | ||
| 547 | usb_set_serial_port_data(port, portdata); | 520 | usb_set_serial_port_data(port, portdata); |
| 548 | 521 | ||
| 549 | if (!port->interrupt_in_urb) | 522 | if (port->interrupt_in_urb) { |
| 550 | continue; | ||
| 551 | err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 523 | err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
| 552 | if (err) | 524 | if (err) |
| 553 | dev_dbg(&port->dev, "%s: submit irq_in urb failed %d\n", | 525 | dev_dbg(&port->dev, "%s: submit irq_in urb failed %d\n", |
| 554 | __func__, err); | 526 | __func__, err); |
| 555 | } | 527 | } |
| 556 | usb_wwan_setup_urbs(serial); | 528 | |
| 557 | return 0; | 529 | return 0; |
| 558 | 530 | ||
| 559 | bail_out_error2: | 531 | bail_out_error2: |
| 560 | for (j = 0; j < N_OUT_URB; j++) | 532 | for (i = 0; i < N_OUT_URB; i++) { |
| 561 | kfree(portdata->out_buffer[j]); | 533 | usb_free_urb(portdata->out_urbs[i]); |
| 534 | kfree(portdata->out_buffer[i]); | ||
| 535 | } | ||
| 562 | bail_out_error: | 536 | bail_out_error: |
| 563 | for (j = 0; j < N_IN_URB; j++) | 537 | for (i = 0; i < N_IN_URB; i++) { |
| 564 | if (portdata->in_buffer[j]) | 538 | usb_free_urb(portdata->in_urbs[i]); |
| 565 | free_page((unsigned long)portdata->in_buffer[j]); | 539 | free_page((unsigned long)portdata->in_buffer[i]); |
| 540 | } | ||
| 566 | kfree(portdata); | 541 | kfree(portdata); |
| 567 | return 1; | 542 | |
| 543 | return -ENOMEM; | ||
| 568 | } | 544 | } |
| 569 | EXPORT_SYMBOL(usb_wwan_startup); | 545 | EXPORT_SYMBOL_GPL(usb_wwan_port_probe); |
| 570 | 546 | ||
| 571 | int usb_wwan_port_remove(struct usb_serial_port *port) | 547 | int usb_wwan_port_remove(struct usb_serial_port *port) |
| 572 | { | 548 | { |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 346c7efc20b0..b9fca3586d74 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
| @@ -83,6 +83,8 @@ static int whiteheat_firmware_attach(struct usb_serial *serial); | |||
| 83 | /* function prototypes for the Connect Tech WhiteHEAT serial converter */ | 83 | /* function prototypes for the Connect Tech WhiteHEAT serial converter */ |
| 84 | static int whiteheat_attach(struct usb_serial *serial); | 84 | static int whiteheat_attach(struct usb_serial *serial); |
| 85 | static void whiteheat_release(struct usb_serial *serial); | 85 | static void whiteheat_release(struct usb_serial *serial); |
| 86 | static int whiteheat_port_probe(struct usb_serial_port *port); | ||
| 87 | static int whiteheat_port_remove(struct usb_serial_port *port); | ||
| 86 | static int whiteheat_open(struct tty_struct *tty, | 88 | static int whiteheat_open(struct tty_struct *tty, |
| 87 | struct usb_serial_port *port); | 89 | struct usb_serial_port *port); |
| 88 | static void whiteheat_close(struct usb_serial_port *port); | 90 | static void whiteheat_close(struct usb_serial_port *port); |
| @@ -117,6 +119,8 @@ static struct usb_serial_driver whiteheat_device = { | |||
| 117 | .num_ports = 4, | 119 | .num_ports = 4, |
| 118 | .attach = whiteheat_attach, | 120 | .attach = whiteheat_attach, |
| 119 | .release = whiteheat_release, | 121 | .release = whiteheat_release, |
| 122 | .port_probe = whiteheat_port_probe, | ||
| 123 | .port_remove = whiteheat_port_remove, | ||
| 120 | .open = whiteheat_open, | 124 | .open = whiteheat_open, |
| 121 | .close = whiteheat_close, | 125 | .close = whiteheat_close, |
| 122 | .ioctl = whiteheat_ioctl, | 126 | .ioctl = whiteheat_ioctl, |
| @@ -218,15 +222,12 @@ static int whiteheat_attach(struct usb_serial *serial) | |||
| 218 | { | 222 | { |
| 219 | struct usb_serial_port *command_port; | 223 | struct usb_serial_port *command_port; |
| 220 | struct whiteheat_command_private *command_info; | 224 | struct whiteheat_command_private *command_info; |
| 221 | struct usb_serial_port *port; | ||
| 222 | struct whiteheat_private *info; | ||
| 223 | struct whiteheat_hw_info *hw_info; | 225 | struct whiteheat_hw_info *hw_info; |
| 224 | int pipe; | 226 | int pipe; |
| 225 | int ret; | 227 | int ret; |
| 226 | int alen; | 228 | int alen; |
| 227 | __u8 *command; | 229 | __u8 *command; |
| 228 | __u8 *result; | 230 | __u8 *result; |
| 229 | int i; | ||
| 230 | 231 | ||
| 231 | command_port = serial->port[COMMAND_PORT]; | 232 | command_port = serial->port[COMMAND_PORT]; |
| 232 | 233 | ||
| @@ -285,22 +286,6 @@ static int whiteheat_attach(struct usb_serial *serial) | |||
| 285 | serial->type->description, | 286 | serial->type->description, |
| 286 | hw_info->sw_major_rev, hw_info->sw_minor_rev); | 287 | hw_info->sw_major_rev, hw_info->sw_minor_rev); |
| 287 | 288 | ||
| 288 | for (i = 0; i < serial->num_ports; i++) { | ||
| 289 | port = serial->port[i]; | ||
| 290 | |||
| 291 | info = kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL); | ||
| 292 | if (info == NULL) { | ||
| 293 | dev_err(&port->dev, | ||
| 294 | "%s: Out of memory for port structures\n", | ||
| 295 | serial->type->description); | ||
| 296 | goto no_private; | ||
| 297 | } | ||
| 298 | |||
| 299 | info->mcr = 0; | ||
| 300 | |||
| 301 | usb_set_serial_port_data(port, info); | ||
| 302 | } | ||
| 303 | |||
| 304 | command_info = kmalloc(sizeof(struct whiteheat_command_private), | 289 | command_info = kmalloc(sizeof(struct whiteheat_command_private), |
| 305 | GFP_KERNEL); | 290 | GFP_KERNEL); |
| 306 | if (command_info == NULL) { | 291 | if (command_info == NULL) { |
| @@ -333,16 +318,10 @@ no_firmware: | |||
| 333 | "%s: please contact support@connecttech.com\n", | 318 | "%s: please contact support@connecttech.com\n", |
| 334 | serial->type->description); | 319 | serial->type->description); |
| 335 | kfree(result); | 320 | kfree(result); |
| 321 | kfree(command); | ||
| 336 | return -ENODEV; | 322 | return -ENODEV; |
| 337 | 323 | ||
| 338 | no_command_private: | 324 | no_command_private: |
| 339 | for (i = serial->num_ports - 1; i >= 0; i--) { | ||
| 340 | port = serial->port[i]; | ||
| 341 | info = usb_get_serial_port_data(port); | ||
| 342 | kfree(info); | ||
| 343 | no_private: | ||
| 344 | ; | ||
| 345 | } | ||
| 346 | kfree(result); | 325 | kfree(result); |
| 347 | no_result_buffer: | 326 | no_result_buffer: |
| 348 | kfree(command); | 327 | kfree(command); |
| @@ -350,21 +329,36 @@ no_command_buffer: | |||
| 350 | return -ENOMEM; | 329 | return -ENOMEM; |
| 351 | } | 330 | } |
| 352 | 331 | ||
| 353 | |||
| 354 | static void whiteheat_release(struct usb_serial *serial) | 332 | static void whiteheat_release(struct usb_serial *serial) |
| 355 | { | 333 | { |
| 356 | struct usb_serial_port *command_port; | 334 | struct usb_serial_port *command_port; |
| 357 | struct whiteheat_private *info; | ||
| 358 | int i; | ||
| 359 | 335 | ||
| 360 | /* free up our private data for our command port */ | 336 | /* free up our private data for our command port */ |
| 361 | command_port = serial->port[COMMAND_PORT]; | 337 | command_port = serial->port[COMMAND_PORT]; |
| 362 | kfree(usb_get_serial_port_data(command_port)); | 338 | kfree(usb_get_serial_port_data(command_port)); |
| 339 | } | ||
| 363 | 340 | ||
| 364 | for (i = 0; i < serial->num_ports; i++) { | 341 | static int whiteheat_port_probe(struct usb_serial_port *port) |
| 365 | info = usb_get_serial_port_data(serial->port[i]); | 342 | { |
| 366 | kfree(info); | 343 | struct whiteheat_private *info; |
| 367 | } | 344 | |
| 345 | info = kzalloc(sizeof(*info), GFP_KERNEL); | ||
| 346 | if (!info) | ||
| 347 | return -ENOMEM; | ||
| 348 | |||
| 349 | usb_set_serial_port_data(port, info); | ||
| 350 | |||
| 351 | return 0; | ||
| 352 | } | ||
| 353 | |||
| 354 | static int whiteheat_port_remove(struct usb_serial_port *port) | ||
| 355 | { | ||
| 356 | struct whiteheat_private *info; | ||
| 357 | |||
| 358 | info = usb_get_serial_port_data(port); | ||
| 359 | kfree(info); | ||
| 360 | |||
| 361 | return 0; | ||
| 368 | } | 362 | } |
| 369 | 363 | ||
| 370 | static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port) | 364 | static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port) |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 779cd954abcb..d305a5aa3a5d 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
| @@ -1004,6 +1004,12 @@ UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9999, | |||
| 1004 | USB_SC_8070, USB_PR_CB, NULL, | 1004 | USB_SC_8070, USB_PR_CB, NULL, |
| 1005 | US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ), | 1005 | US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ), |
| 1006 | 1006 | ||
| 1007 | /* Submitted by Oleksandr Chumachenko <ledest@gmail.com> */ | ||
| 1008 | UNUSUAL_DEV( 0x07cf, 0x1167, 0x0100, 0x0100, | ||
| 1009 | "Casio", | ||
| 1010 | "EX-N1 DigitalCamera", | ||
| 1011 | USB_SC_8070, USB_PR_DEVICE, NULL, 0), | ||
| 1012 | |||
| 1007 | /* Submitted by Hartmut Wahl <hwahl@hwahl.de>*/ | 1013 | /* Submitted by Hartmut Wahl <hwahl@hwahl.de>*/ |
| 1008 | UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001, | 1014 | UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001, |
| 1009 | "Samsung", | 1015 | "Samsung", |
