All of lore.kernel.org
 help / color / mirror / Atom feed
* [v4,07/22] usb: usbtmc: Fix suspend/resume
@ 2018-07-30  8:04 Guido Kiener
  0 siblings, 0 replies; only message in thread
From: Guido Kiener @ 2018-07-30  8:04 UTC (permalink / raw)
  To: gregkh, linux-usb, guido.kiener, pankaj.adhikari, steve_bayless,
	dpenkler
  Cc: Guido Kiener

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: Guido Kiener <guido.kiener@rohde-schwarz.com>
Reviewed-by: Steve Bayless <steve_bayless@keysight.com>
---
 drivers/usb/class/usbtmc.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index b8a4140bd161..9953b62b7db4 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -2314,7 +2314,9 @@ static void usbtmc_free_int(struct usbtmc_device_data *data)
 		return;
 	usb_kill_urb(data->iin_urb);
 	kfree(data->iin_buffer);
+	data->iin_buffer = NULL;
 	usb_free_urb(data->iin_urb);
+	data->iin_urb = NULL;
 	kref_put(&data->kref, usbtmc_delete);
 }
 
@@ -2496,13 +2498,25 @@ static int usbtmc_suspend(struct usb_interface *intf, pm_message_t message)
 				       file_elem);
 		usbtmc_draw_down(file_data);
 	}
+
+	if (data->iin_ep_present && data->iin_urb)
+		usb_kill_urb(data->iin_urb);
+
 	mutex_unlock(&data->io_mutex);
 	return 0;
 }
 
 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)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-30  8:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-30  8:04 [v4,07/22] usb: usbtmc: Fix suspend/resume Guido Kiener

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.