diff options
author | Seshendra Gadagottu <sgadagottu@nvidia.com> | 2011-12-26 13:12:12 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2012-01-30 13:21:41 -0800 |
commit | 133acfe3800e220048a9b568dd2bebcd5bd0b38b (patch) | |
tree | d06ce5d6c148242db927bd2f65547bdda1d558bd /drivers/usb/serial | |
parent | 787bd60eced8484cba1fbc29c7d10c784564f5b7 (diff) |
arm: tegra: comms: handle usb disconnection
Flushing pending urb requests on disconnection.
Blocks usb requests on usb device disconnection.
BUG 919270
Reviewed-on: http://git-master/r/72832
Change-Id: I9ae10685d9517e0626338cfd42b21479d7d480eb
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/77760
Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/baseband_usb_chr.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/usb/serial/baseband_usb_chr.c b/drivers/usb/serial/baseband_usb_chr.c index 18bffdfda223..6d691a40312d 100644 --- a/drivers/usb/serial/baseband_usb_chr.c +++ b/drivers/usb/serial/baseband_usb_chr.c @@ -51,6 +51,7 @@ module_param(baseband_usb_chr_intf, ulong, 0644); MODULE_PARM_DESC(baseband_usb_chr_intf, "baseband (usb chr) - USB interface"); static struct baseband_usb *baseband_usb_chr; +static bool usb_device_connection; static atomic_t g_rx_count = ATOMIC_INIT(0); @@ -621,6 +622,11 @@ static int baseband_usb_chr_rx_urb_submit(struct baseband_usb *usb) pr_debug("baseband_usb_chr_rx_urb_submit { usb %p\n", usb); + if (!usb_device_connection) { + pr_err("!!no usb device conenction!!!!!\n"); + return -1; + } + /* check input */ if (usb->usb.rx_urb) { pr_err("previous urb still active\n"); @@ -792,6 +798,7 @@ static int baseband_usb_driver_probe(struct usb_interface *intf, baseband_usb_chr->usb.pipe.interrupt.in); pr_debug("baseband_usb_chr->usb.pipe.interrupt.out %x\n", baseband_usb_chr->usb.pipe.interrupt.out); + usb_device_connection = true; /* start usb rx */ err = baseband_usb_chr_rx_urb_submit(baseband_usb_chr); @@ -806,8 +813,19 @@ static int baseband_usb_driver_probe(struct usb_interface *intf, static void baseband_usb_driver_disconnect(struct usb_interface *intf) { + struct usb_device *usb_dev = interface_to_usbdev(intf); pr_debug("%s(%d) { intf %p\n", __func__, __LINE__, intf); pr_debug("%s(%d) }\n", __func__, __LINE__); + if (baseband_usb_chr->usb.interface != intf) { + pr_info("%s(%d) -ENODEV\n", __func__, __LINE__); + return; + } + if (baseband_usb_chr->usb.device == usb_dev) { + pr_info("%s: Matching usb device: Flush workqueue\n", __func__); + flush_workqueue(baseband_usb_chr->ipc->workqueue); + usb_device_connection = false; + } + } static char baseband_usb_driver_name[32]; |