Skip to content

Commit

Permalink
USB: Add udev argument to interface suspend/resume functions
Browse files Browse the repository at this point in the history
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: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Aug 21, 2008
1 parent 74573ee commit 65605ae
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -926,14 +926,14 @@ static int usb_resume_device(struct usb_device *udev)
}

/* 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;
int status = 0;

/* with no hardware, USB interfaces only use FREEZE and ON states */
if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED ||
!is_active(intf))
if (udev->state == USB_STATE_NOTATTACHED || !is_active(intf))
goto done;

if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */
Expand All @@ -944,7 +944,7 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg)
status = driver->suspend(intf, msg);
if (status == 0)
mark_quiesced(intf);
else if (!interface_to_usbdev(intf)->auto_pm)
else if (!udev->auto_pm)
dev_err(&intf->dev, "%s error %d\n",
"suspend", status);
} else {
Expand All @@ -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 */
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;
int status = 0;

if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED ||
is_active(intf))
if (udev->state == USB_STATE_NOTATTACHED || is_active(intf))
goto done;

/* Don't let autoresume interfere with unbinding */
Expand Down Expand Up @@ -1151,7 +1151,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
if (udev->actconfig) {
for (; i < udev->actconfig->desc.bNumInterfaces; i++) {
intf = udev->actconfig->interface[i];
status = usb_suspend_interface(intf, msg);
status = usb_suspend_interface(udev, intf, msg);
if (status != 0)
break;
}
Expand All @@ -1163,7 +1163,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
if (status != 0) {
while (--i >= 0) {
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 */
Expand Down Expand Up @@ -1276,7 +1276,7 @@ static int usb_resume_both(struct usb_device *udev)
if (status == 0 && udev->actconfig) {
for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
intf = udev->actconfig->interface[i];
usb_resume_interface(intf, udev->reset_resume);
usb_resume_interface(udev, intf, udev->reset_resume);
}
}

Expand Down

0 comments on commit 65605ae

Please sign in to comment.