summaryrefslogtreecommitdiff
path: root/drivers/usb/misc
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2009-07-12 23:58:23 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 06:46:28 -0700
commitd9bfbd167b4dac51fed4edde7f6cfc378c9aea98 (patch)
tree88786a288193cc84f8659eef9bd5484f0df7da00 /drivers/usb/misc
parentb7800218bccb52dbcb1613bb51425b21441b81f9 (diff)
downloadlinux-3.10-d9bfbd167b4dac51fed4edde7f6cfc378c9aea98.tar.gz
linux-3.10-d9bfbd167b4dac51fed4edde7f6cfc378c9aea98.tar.bz2
linux-3.10-d9bfbd167b4dac51fed4edde7f6cfc378c9aea98.zip
USB: full power management support for the idmouse driver
usb: full runtime PM support for idmouse driver - add suspend/resume support - add reset_resume support - add support for autosuspend Signed-off-by: Oliver Neukum <oliver@neukum.org> Tested-by: Andreas Deresch <aderesch@fs.tum.de>
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r--drivers/usb/misc/idmouse.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index 6da8887538c..1337a9ce80b 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -96,6 +96,8 @@ static int idmouse_probe(struct usb_interface *interface,
const struct usb_device_id *id);
static void idmouse_disconnect(struct usb_interface *interface);
+static int idmouse_suspend(struct usb_interface *intf, pm_message_t message);
+static int idmouse_resume(struct usb_interface *intf);
/* file operation pointers */
static const struct file_operations idmouse_fops = {
@@ -117,7 +119,11 @@ static struct usb_driver idmouse_driver = {
.name = DRIVER_SHORT,
.probe = idmouse_probe,
.disconnect = idmouse_disconnect,
+ .suspend = idmouse_suspend,
+ .resume = idmouse_resume,
+ .reset_resume = idmouse_resume,
.id_table = idmouse_table,
+ .supports_autosuspend = 1,
};
static int idmouse_create_image(struct usb_idmouse *dev)
@@ -197,6 +203,17 @@ reset:
return result;
}
+/* PM operations are nops as this driver does IO only during open() */
+static int idmouse_suspend(struct usb_interface *intf, pm_message_t message)
+{
+ return 0;
+}
+
+static int idmouse_resume(struct usb_interface *intf)
+{
+ return 0;
+}
+
static inline void idmouse_delete(struct usb_idmouse *dev)
{
kfree(dev->bulk_in_buffer);
@@ -235,9 +252,13 @@ static int idmouse_open(struct inode *inode, struct file *file)
} else {
/* create a new image and check for success */
+ result = usb_autopm_get_interface(interface);
+ if (result)
+ goto error;
result = idmouse_create_image (dev);
if (result)
goto error;
+ usb_autopm_put_interface(interface);
/* increment our usage count for the driver */
++dev->open;