summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2020-05-05 14:14:52 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-13 13:51:12 +0200
commit08e1b4274c7b446137b5b222c5cc0b46688cb372 (patch)
tree51b8f18e7433d80e12fd77f0f66fa50cee0edd7b /drivers/staging
parent4fdc18d3ce77bc30cc9c819ae55070c8f5ec4e18 (diff)
staging: most: usb: add PM functions
This patch adds the implementation of the PM functions resume and suspend. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Link: https://lore.kernel.org/r/1588680892-9413-1-git-send-email-christian.gromm@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/most/usb/usb.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index b31a49c37f7f..daa5e4bd977f 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -1221,11 +1221,39 @@ static void hdm_disconnect(struct usb_interface *interface)
put_device(&mdev->dev);
}
+static int hdm_suspend(struct usb_interface *interface, pm_message_t message)
+{
+ struct most_dev *mdev = usb_get_intfdata(interface);
+ int i;
+
+ mutex_lock(&mdev->io_mutex);
+ for (i = 0; i < mdev->iface.num_channels; i++) {
+ most_stop_enqueue(&mdev->iface, i);
+ usb_kill_anchored_urbs(&mdev->busy_urbs[i]);
+ }
+ mutex_unlock(&mdev->io_mutex);
+ return 0;
+}
+
+static int hdm_resume(struct usb_interface *interface)
+{
+ struct most_dev *mdev = usb_get_intfdata(interface);
+ int i;
+
+ mutex_lock(&mdev->io_mutex);
+ for (i = 0; i < mdev->iface.num_channels; i++)
+ most_resume_enqueue(&mdev->iface, i);
+ mutex_unlock(&mdev->io_mutex);
+ return 0;
+}
+
static struct usb_driver hdm_usb = {
.name = "hdm_usb",
.id_table = usbid,
.probe = hdm_probe,
.disconnect = hdm_disconnect,
+ .resume = hdm_resume,
+ .suspend = hdm_suspend,
};
module_usb_driver(hdm_usb);