diff options
author | Tony Luck <tony.luck@intel.com> | 2006-01-05 08:52:11 -0800 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2006-01-05 08:52:11 -0800 |
commit | 5c3eee79128c372a81a83665be2332a000944280 (patch) | |
tree | e44331d36d63adc971003cc32540d0cb0c019525 /drivers/usb/storage/onetouch.c | |
parent | 408045afbdb46e109a1a44e67af688e9ddf7ad66 (diff) | |
parent | db9edfd7e339ca4113153d887e782dd05be5a9eb (diff) | |
download | blackbird-op-linux-5c3eee79128c372a81a83665be2332a000944280.tar.gz blackbird-op-linux-5c3eee79128c372a81a83665be2332a000944280.zip |
Auto-update from upstream
Diffstat (limited to 'drivers/usb/storage/onetouch.c')
-rw-r--r-- | drivers/usb/storage/onetouch.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c index 89401a59f952..55ee2d36d585 100644 --- a/drivers/usb/storage/onetouch.c +++ b/drivers/usb/storage/onetouch.c @@ -52,6 +52,7 @@ struct usb_onetouch { struct urb *irq; /* urb for interrupt in report */ unsigned char *data; /* input data */ dma_addr_t data_dma; + unsigned int is_open:1; }; static void usb_onetouch_irq(struct urb *urb, struct pt_regs *regs) @@ -89,6 +90,7 @@ static int usb_onetouch_open(struct input_dev *dev) { struct usb_onetouch *onetouch = dev->private; + onetouch->is_open = 1; onetouch->irq->dev = onetouch->udev; if (usb_submit_urb(onetouch->irq, GFP_KERNEL)) { err("usb_submit_urb failed"); @@ -103,8 +105,30 @@ static void usb_onetouch_close(struct input_dev *dev) struct usb_onetouch *onetouch = dev->private; usb_kill_urb(onetouch->irq); + onetouch->is_open = 0; } +#ifdef CONFIG_PM +static void usb_onetouch_pm_hook(struct us_data *us, int action) +{ + struct usb_onetouch *onetouch = (struct usb_onetouch *) us->extra; + + if (onetouch->is_open) { + switch (action) { + case US_SUSPEND: + usb_kill_urb(onetouch->irq); + break; + case US_RESUME: + if (usb_submit_urb(onetouch->irq, GFP_KERNEL) != 0) + err("usb_submit_urb failed"); + break; + default: + break; + } + } +} +#endif /* CONFIG_PM */ + int onetouch_connect_input(struct us_data *ss) { struct usb_device *udev = ss->pusb_dev; @@ -185,6 +209,9 @@ int onetouch_connect_input(struct us_data *ss) ss->extra_destructor = onetouch_release_input; ss->extra = onetouch; +#ifdef CONFIG_PM + ss->suspend_resume_hook = usb_onetouch_pm_hook; +#endif input_register_device(onetouch->dev); |