aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wimax/i2400m/usb.c
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2009-09-17 18:20:45 -0400
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2009-10-19 02:56:10 -0400
commit3725d8c97436aeaa03eeb0c25361a7ec0f3f5bd2 (patch)
treec773759b4757473172ff6ba3ec26c134f5fc3d42 /drivers/net/wimax/i2400m/usb.c
parent2869da8587604e3fea5f85aeade486a08e8313bf (diff)
wimax/i2400m: Implement pre/post reset support in the USB driver
The USB stack can callback a driver is about to be reset by an external entity and right after it, so the driver can save state and then restore it. This commit implements said support; it is implemented actually in the core, bus-generic driver [i2400m_{pre,post}_reset()] and used by the bus-specific drivers. This way the SDIO driver can also use it once said support is brought to the SDIO stack. Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Diffstat (limited to 'drivers/net/wimax/i2400m/usb.c')
-rw-r--r--drivers/net/wimax/i2400m/usb.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c
index 77567970fe9a..8b246cc498b1 100644
--- a/drivers/net/wimax/i2400m/usb.c
+++ b/drivers/net/wimax/i2400m/usb.c
@@ -637,6 +637,37 @@ int i2400mu_reset_resume(struct usb_interface *iface)
637} 637}
638 638
639 639
640/*
641 * Another driver or user space is triggering a reset on the device
642 * which contains the interface passed as an argument. Cease IO and
643 * save any device state you need to restore.
644 *
645 * If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if
646 * you are in atomic context.
647 */
648static
649int i2400mu_pre_reset(struct usb_interface *iface)
650{
651 struct i2400mu *i2400mu = usb_get_intfdata(iface);
652 return i2400m_pre_reset(&i2400mu->i2400m);
653}
654
655
656/*
657 * The reset has completed. Restore any saved device state and begin
658 * using the device again.
659 *
660 * If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if
661 * you are in atomic context.
662 */
663static
664int i2400mu_post_reset(struct usb_interface *iface)
665{
666 struct i2400mu *i2400mu = usb_get_intfdata(iface);
667 return i2400m_post_reset(&i2400mu->i2400m);
668}
669
670
640static 671static
641struct usb_device_id i2400mu_id_table[] = { 672struct usb_device_id i2400mu_id_table[] = {
642 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) }, 673 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) },
@@ -660,6 +691,8 @@ struct usb_driver i2400mu_driver = {
660 .reset_resume = i2400mu_reset_resume, 691 .reset_resume = i2400mu_reset_resume,
661 .probe = i2400mu_probe, 692 .probe = i2400mu_probe,
662 .disconnect = i2400mu_disconnect, 693 .disconnect = i2400mu_disconnect,
694 .pre_reset = i2400mu_pre_reset,
695 .post_reset = i2400mu_post_reset,
663 .id_table = i2400mu_id_table, 696 .id_table = i2400mu_id_table,
664 .supports_autosuspend = 1, 697 .supports_autosuspend = 1,
665}; 698};