Preparing for having another driver owning the interface. Signed-off-by: Bjørn Mork <bjorn@xxxxxxx> --- drivers/usb/class/cdc-wdm.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 1e28100..684e89b 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -115,6 +115,12 @@ struct wdm_device { static struct usb_driver wdm_driver; +static struct wdm_device *wdm_get_device(struct usb_interface *intf) +{ + struct wdm_device *desc = usb_get_intfdata(intf); + return desc; +} + /* --- callbacks --- */ static void wdm_out_callback(struct urb *urb) { @@ -522,7 +528,7 @@ static int wdm_open(struct inode *inode, struct file *file) if (!intf) goto out; - desc = usb_get_intfdata(intf); + desc = wdm_get_device(intf); if (test_bit(WDM_DISCONNECTING, &desc->flags)) goto out; file->private_data = desc; @@ -809,14 +815,14 @@ static void wdm_destroy(struct wdm_device *desc) static void wdm_disconnect(struct usb_interface *intf) { - struct wdm_device *desc = usb_get_intfdata(intf); + struct wdm_device *desc = wdm_get_device(intf); wdm_destroy(desc); } #ifdef CONFIG_PM static int wdm_suspend(struct usb_interface *intf, pm_message_t message) { - struct wdm_device *desc = usb_get_intfdata(intf); + struct wdm_device *desc = wdm_get_device(intf); int rv = 0; dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); @@ -866,7 +872,7 @@ static int recover_from_urb_loss(struct wdm_device *desc) #ifdef CONFIG_PM static int wdm_resume(struct usb_interface *intf) { - struct wdm_device *desc = usb_get_intfdata(intf); + struct wdm_device *desc = wdm_get_device(intf); int rv; dev_dbg(&desc->intf->dev, "wdm%d_resume\n", intf->minor); @@ -880,7 +886,7 @@ static int wdm_resume(struct usb_interface *intf) static int wdm_pre_reset(struct usb_interface *intf) { - struct wdm_device *desc = usb_get_intfdata(intf); + struct wdm_device *desc = wdm_get_device(intf); mutex_lock(&desc->rlock); mutex_lock(&desc->wlock); @@ -901,7 +907,7 @@ static int wdm_pre_reset(struct usb_interface *intf) static int wdm_post_reset(struct usb_interface *intf) { - struct wdm_device *desc = usb_get_intfdata(intf); + struct wdm_device *desc = wdm_get_device(intf); int rv; rv = recover_from_urb_loss(desc); -- 1.7.8.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html