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>
This commit is contained in:
Inaky Perez-Gonzalez
2009-09-17 15:20:45 -07:00
parent 2869da8587
commit 3725d8c974
3 changed files with 116 additions and 0 deletions

View File

@@ -637,6 +637,37 @@ int i2400mu_reset_resume(struct usb_interface *iface)
}
/*
* Another driver or user space is triggering a reset on the device
* which contains the interface passed as an argument. Cease IO and
* save any device state you need to restore.
*
* If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if
* you are in atomic context.
*/
static
int i2400mu_pre_reset(struct usb_interface *iface)
{
struct i2400mu *i2400mu = usb_get_intfdata(iface);
return i2400m_pre_reset(&i2400mu->i2400m);
}
/*
* The reset has completed. Restore any saved device state and begin
* using the device again.
*
* If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if
* you are in atomic context.
*/
static
int i2400mu_post_reset(struct usb_interface *iface)
{
struct i2400mu *i2400mu = usb_get_intfdata(iface);
return i2400m_post_reset(&i2400mu->i2400m);
}
static
struct usb_device_id i2400mu_id_table[] = {
{ USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) },
@@ -660,6 +691,8 @@ struct usb_driver i2400mu_driver = {
.reset_resume = i2400mu_reset_resume,
.probe = i2400mu_probe,
.disconnect = i2400mu_disconnect,
.pre_reset = i2400mu_pre_reset,
.post_reset = i2400mu_post_reset,
.id_table = i2400mu_id_table,
.supports_autosuspend = 1,
};