Commit 65605ae8 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

USB: Add udev argument to interface suspend/resume functions

This patch (as1127) makes a minor change to the prototypes of the
usb_suspend_interface() and usb_resume_interface() routines.  Now the
usb_device structure is passed as an argument, instead of being
computed on-the-fly from the usb_interface argument.

It makes the code look simpler, even if it really isn't much different
from before.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 74573ee7
...@@ -926,14 +926,14 @@ static int usb_resume_device(struct usb_device *udev) ...@@ -926,14 +926,14 @@ static int usb_resume_device(struct usb_device *udev)
} }
/* Caller has locked intf's usb_device's pm mutex */ /* Caller has locked intf's usb_device's pm mutex */
static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) static int usb_suspend_interface(struct usb_device *udev,
struct usb_interface *intf, pm_message_t msg)
{ {
struct usb_driver *driver; struct usb_driver *driver;
int status = 0; int status = 0;
/* with no hardware, USB interfaces only use FREEZE and ON states */ /* with no hardware, USB interfaces only use FREEZE and ON states */
if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || if (udev->state == USB_STATE_NOTATTACHED || !is_active(intf))
!is_active(intf))
goto done; goto done;
if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */ if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */
...@@ -944,7 +944,7 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) ...@@ -944,7 +944,7 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg)
status = driver->suspend(intf, msg); status = driver->suspend(intf, msg);
if (status == 0) if (status == 0)
mark_quiesced(intf); mark_quiesced(intf);
else if (!interface_to_usbdev(intf)->auto_pm) else if (!udev->auto_pm)
dev_err(&intf->dev, "%s error %d\n", dev_err(&intf->dev, "%s error %d\n",
"suspend", status); "suspend", status);
} else { } else {
...@@ -961,13 +961,13 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) ...@@ -961,13 +961,13 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg)
} }
/* Caller has locked intf's usb_device's pm_mutex */ /* Caller has locked intf's usb_device's pm_mutex */
static int usb_resume_interface(struct usb_interface *intf, int reset_resume) static int usb_resume_interface(struct usb_device *udev,
struct usb_interface *intf, int reset_resume)
{ {
struct usb_driver *driver; struct usb_driver *driver;
int status = 0; int status = 0;
if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || if (udev->state == USB_STATE_NOTATTACHED || is_active(intf))
is_active(intf))
goto done; goto done;
/* Don't let autoresume interfere with unbinding */ /* Don't let autoresume interfere with unbinding */
...@@ -1151,7 +1151,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) ...@@ -1151,7 +1151,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
if (udev->actconfig) { if (udev->actconfig) {
for (; i < udev->actconfig->desc.bNumInterfaces; i++) { for (; i < udev->actconfig->desc.bNumInterfaces; i++) {
intf = udev->actconfig->interface[i]; intf = udev->actconfig->interface[i];
status = usb_suspend_interface(intf, msg); status = usb_suspend_interface(udev, intf, msg);
if (status != 0) if (status != 0)
break; break;
} }
...@@ -1163,7 +1163,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) ...@@ -1163,7 +1163,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
if (status != 0) { if (status != 0) {
while (--i >= 0) { while (--i >= 0) {
intf = udev->actconfig->interface[i]; intf = udev->actconfig->interface[i];
usb_resume_interface(intf, 0); usb_resume_interface(udev, intf, 0);
} }
/* Try another autosuspend when the interfaces aren't busy */ /* Try another autosuspend when the interfaces aren't busy */
...@@ -1276,7 +1276,7 @@ static int usb_resume_both(struct usb_device *udev) ...@@ -1276,7 +1276,7 @@ static int usb_resume_both(struct usb_device *udev)
if (status == 0 && udev->actconfig) { if (status == 0 && udev->actconfig) {
for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
intf = udev->actconfig->interface[i]; intf = udev->actconfig->interface[i];
usb_resume_interface(intf, udev->reset_resume); usb_resume_interface(udev, intf, udev->reset_resume);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment