aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 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
98static void idmouse_disconnect(struct usb_interface *interface); 98static void idmouse_disconnect(struct usb_interface *interface);
99static int idmouse_suspend(struct usb_interface *intf, pm_message_t message);
100static int idmouse_resume(struct usb_interface *intf);
99 101
100/* file operation pointers */ 102/* file operation pointers */
101static const struct file_operations idmouse_fops = { 103static 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
123static int idmouse_create_image(struct usb_idmouse *dev) 129static 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() */
207static int idmouse_suspend(struct usb_interface *intf, pm_message_t message)
208{
209 return 0;
210}
211
212static int idmouse_resume(struct usb_interface *intf)
213{
214 return 0;
215}
216
200static inline void idmouse_delete(struct usb_idmouse *dev) 217static 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;