diff options
author | Oliver Neukum <oliver@neukum.org> | 2009-07-12 17:58:23 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-23 09:46:28 -0400 |
commit | d9bfbd167b4dac51fed4edde7f6cfc378c9aea98 (patch) | |
tree | 88786a288193cc84f8659eef9bd5484f0df7da00 /drivers/usb/misc | |
parent | b7800218bccb52dbcb1613bb51425b21441b81f9 (diff) |
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.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c index 6da8887538c7..1337a9ce80b9 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, | |||
96 | const struct usb_device_id *id); | 96 | const struct usb_device_id *id); |
97 | 97 | ||
98 | static void idmouse_disconnect(struct usb_interface *interface); | 98 | static void idmouse_disconnect(struct usb_interface *interface); |
99 | static int idmouse_suspend(struct usb_interface *intf, pm_message_t message); | ||
100 | static int idmouse_resume(struct usb_interface *intf); | ||
99 | 101 | ||
100 | /* file operation pointers */ | 102 | /* file operation pointers */ |
101 | static const struct file_operations idmouse_fops = { | 103 | static const struct file_operations idmouse_fops = { |
@@ -117,7 +119,11 @@ static struct usb_driver idmouse_driver = { | |||
117 | .name = DRIVER_SHORT, | 119 | .name = DRIVER_SHORT, |
118 | .probe = idmouse_probe, | 120 | .probe = idmouse_probe, |
119 | .disconnect = idmouse_disconnect, | 121 | .disconnect = idmouse_disconnect, |
122 | .suspend = idmouse_suspend, | ||
123 | .resume = idmouse_resume, | ||
124 | .reset_resume = idmouse_resume, | ||
120 | .id_table = idmouse_table, | 125 | .id_table = idmouse_table, |
126 | .supports_autosuspend = 1, | ||
121 | }; | 127 | }; |
122 | 128 | ||
123 | static int idmouse_create_image(struct usb_idmouse *dev) | 129 | static int idmouse_create_image(struct usb_idmouse *dev) |
@@ -197,6 +203,17 @@ reset: | |||
197 | return result; | 203 | return result; |
198 | } | 204 | } |
199 | 205 | ||
206 | /* PM operations are nops as this driver does IO only during open() */ | ||
207 | static int idmouse_suspend(struct usb_interface *intf, pm_message_t message) | ||
208 | { | ||
209 | return 0; | ||
210 | } | ||
211 | |||
212 | static int idmouse_resume(struct usb_interface *intf) | ||
213 | { | ||
214 | return 0; | ||
215 | } | ||
216 | |||
200 | static inline void idmouse_delete(struct usb_idmouse *dev) | 217 | static inline void idmouse_delete(struct usb_idmouse *dev) |
201 | { | 218 | { |
202 | kfree(dev->bulk_in_buffer); | 219 | kfree(dev->bulk_in_buffer); |
@@ -235,9 +252,13 @@ static int idmouse_open(struct inode *inode, struct file *file) | |||
235 | } else { | 252 | } else { |
236 | 253 | ||
237 | /* create a new image and check for success */ | 254 | /* create a new image and check for success */ |
255 | result = usb_autopm_get_interface(interface); | ||
256 | if (result) | ||
257 | goto error; | ||
238 | result = idmouse_create_image (dev); | 258 | result = idmouse_create_image (dev); |
239 | if (result) | 259 | if (result) |
240 | goto error; | 260 | goto error; |
261 | usb_autopm_put_interface(interface); | ||
241 | 262 | ||
242 | /* increment our usage count for the driver */ | 263 | /* increment our usage count for the driver */ |
243 | ++dev->open; | 264 | ++dev->open; |