Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
65605ae8 74573ee7

+10 -10
+10 -10
drivers/usb/core/driver.c
··· 926 926 } 927 927 928 928 /* Caller has locked intf's usb_device's pm mutex */ 929 - static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) 929 + static int usb_suspend_interface(struct usb_device *udev, 930 + struct usb_interface *intf, pm_message_t msg) 930 931 { 931 932 struct usb_driver *driver; 932 933 int status = 0; 933 934 934 935 /* with no hardware, USB interfaces only use FREEZE and ON states */ 935 - if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || 936 - !is_active(intf)) 936 + if (udev->state == USB_STATE_NOTATTACHED || !is_active(intf)) 937 937 goto done; 938 938 939 939 if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */ ··· 944 944 status = driver->suspend(intf, msg); 945 945 if (status == 0) 946 946 mark_quiesced(intf); 947 - else if (!interface_to_usbdev(intf)->auto_pm) 947 + else if (!udev->auto_pm) 948 948 dev_err(&intf->dev, "%s error %d\n", 949 949 "suspend", status); 950 950 } else { ··· 961 961 } 962 962 963 963 /* Caller has locked intf's usb_device's pm_mutex */ 964 - static int usb_resume_interface(struct usb_interface *intf, int reset_resume) 964 + static int usb_resume_interface(struct usb_device *udev, 965 + struct usb_interface *intf, int reset_resume) 965 966 { 966 967 struct usb_driver *driver; 967 968 int status = 0; 968 969 969 - if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || 970 - is_active(intf)) 970 + if (udev->state == USB_STATE_NOTATTACHED || is_active(intf)) 971 971 goto done; 972 972 973 973 /* Don't let autoresume interfere with unbinding */ ··· 1151 1151 if (udev->actconfig) { 1152 1152 for (; i < udev->actconfig->desc.bNumInterfaces; i++) { 1153 1153 intf = udev->actconfig->interface[i]; 1154 - status = usb_suspend_interface(intf, msg); 1154 + status = usb_suspend_interface(udev, intf, msg); 1155 1155 if (status != 0) 1156 1156 break; 1157 1157 } ··· 1163 1163 if (status != 0) { 1164 1164 while (--i >= 0) { 1165 1165 intf = udev->actconfig->interface[i]; 1166 - usb_resume_interface(intf, 0); 1166 + usb_resume_interface(udev, intf, 0); 1167 1167 } 1168 1168 1169 1169 /* Try another autosuspend when the interfaces aren't busy */ ··· 1276 1276 if (status == 0 && udev->actconfig) { 1277 1277 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { 1278 1278 intf = udev->actconfig->interface[i]; 1279 - usb_resume_interface(intf, udev->reset_resume); 1279 + usb_resume_interface(udev, intf, udev->reset_resume); 1280 1280 } 1281 1281 } 1282 1282