mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 15:20:41 +00:00
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>
This commit is contained in:
parent
4fdc18d3ce
commit
08e1b4274c
1 changed files with 28 additions and 0 deletions
|
@ -1221,11 +1221,39 @@ static void hdm_disconnect(struct usb_interface *interface)
|
||||||
put_device(&mdev->dev);
|
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 = {
|
static struct usb_driver hdm_usb = {
|
||||||
.name = "hdm_usb",
|
.name = "hdm_usb",
|
||||||
.id_table = usbid,
|
.id_table = usbid,
|
||||||
.probe = hdm_probe,
|
.probe = hdm_probe,
|
||||||
.disconnect = hdm_disconnect,
|
.disconnect = hdm_disconnect,
|
||||||
|
.resume = hdm_resume,
|
||||||
|
.suspend = hdm_suspend,
|
||||||
};
|
};
|
||||||
|
|
||||||
module_usb_driver(hdm_usb);
|
module_usb_driver(hdm_usb);
|
||||||
|
|
Loading…
Reference in a new issue