Commit b19bbdc5 authored by Guido Kiener's avatar Guido Kiener Committed by Greg Kroah-Hartman

usb: usbtmc: Fix suspend/resume

Submitted urbs are not allowed when system is suspended.
Thus the submitted urb waiting at interrupt pipe is killed
during suspend callback and submitted again when system resumes.
Signed-off-by: default avatarGuido Kiener <guido.kiener@rohde-schwarz.com>
Reviewed-by: default avatarSteve Bayless <steve_bayless@keysight.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 987b8199
...@@ -2306,7 +2306,9 @@ static void usbtmc_free_int(struct usbtmc_device_data *data) ...@@ -2306,7 +2306,9 @@ static void usbtmc_free_int(struct usbtmc_device_data *data)
return; return;
usb_kill_urb(data->iin_urb); usb_kill_urb(data->iin_urb);
kfree(data->iin_buffer); kfree(data->iin_buffer);
data->iin_buffer = NULL;
usb_free_urb(data->iin_urb); usb_free_urb(data->iin_urb);
data->iin_urb = NULL;
kref_put(&data->kref, usbtmc_delete); kref_put(&data->kref, usbtmc_delete);
} }
...@@ -2488,13 +2490,25 @@ static int usbtmc_suspend(struct usb_interface *intf, pm_message_t message) ...@@ -2488,13 +2490,25 @@ static int usbtmc_suspend(struct usb_interface *intf, pm_message_t message)
file_elem); file_elem);
usbtmc_draw_down(file_data); usbtmc_draw_down(file_data);
} }
if (data->iin_ep_present && data->iin_urb)
usb_kill_urb(data->iin_urb);
mutex_unlock(&data->io_mutex); mutex_unlock(&data->io_mutex);
return 0; return 0;
} }
static int usbtmc_resume(struct usb_interface *intf) static int usbtmc_resume(struct usb_interface *intf)
{ {
return 0; struct usbtmc_device_data *data = usb_get_intfdata(intf);
int retcode = 0;
if (data->iin_ep_present && data->iin_urb)
retcode = usb_submit_urb(data->iin_urb, GFP_KERNEL);
if (retcode)
dev_err(&intf->dev, "Failed to submit iin_urb\n");
return retcode;
} }
static int usbtmc_pre_reset(struct usb_interface *intf) static int usbtmc_pre_reset(struct usb_interface *intf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment