提交 140d8f68 编写于 作者: A Alan Stern 提交者: Greg Kroah-Hartman

usbcore: rename usb_suspend_device to usb_port_suspend

This revised patch (as715b) renames usb_suspend_device to
usb_port_suspend, usb_resume_device to usb_port_resume, and
finish_device_resume to finish_port_resume.  There was no objection to
the original version of the patch so this should be okay to apply.

The revision was needed only because I have re-arranged the order of the
earlier patches.
Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 121e287c
...@@ -1407,9 +1407,9 @@ int usb_new_device(struct usb_device *udev) ...@@ -1407,9 +1407,9 @@ int usb_new_device(struct usb_device *udev)
* (Includes HNP test device.) * (Includes HNP test device.)
*/ */
if (udev->bus->b_hnp_enable || udev->bus->is_b_host) { if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
static int __usb_suspend_device(struct usb_device *, static int __usb_port_suspend(struct usb_device *,
int port1); int port1);
err = __usb_suspend_device(udev, udev->bus->otg_port); err = __usb_port_suspend(udev, udev->bus->otg_port);
if (err < 0) if (err < 0)
dev_dbg(&udev->dev, "HNP fail, %d\n", err); dev_dbg(&udev->dev, "HNP fail, %d\n", err);
} }
...@@ -1684,7 +1684,7 @@ static int hub_port_suspend(struct usb_hub *hub, int port1, ...@@ -1684,7 +1684,7 @@ static int hub_port_suspend(struct usb_hub *hub, int port1,
* the root hub for their bus goes into global suspend ... so we don't * the root hub for their bus goes into global suspend ... so we don't
* (falsely) update the device power state to say it suspended. * (falsely) update the device power state to say it suspended.
*/ */
static int __usb_suspend_device (struct usb_device *udev, int port1) static int __usb_port_suspend (struct usb_device *udev, int port1)
{ {
int status = 0; int status = 0;
...@@ -1712,8 +1712,8 @@ static int __usb_suspend_device (struct usb_device *udev, int port1) ...@@ -1712,8 +1712,8 @@ static int __usb_suspend_device (struct usb_device *udev, int port1)
} }
} }
/* we only change a device's upstream USB link. /* we change the device's upstream USB link,
* root hubs have no upstream USB link. * but root hubs have no upstream USB link.
*/ */
if (udev->parent) if (udev->parent)
status = hub_port_suspend(hdev_to_hub(udev->parent), port1, status = hub_port_suspend(hdev_to_hub(udev->parent), port1,
...@@ -1727,14 +1727,14 @@ static int __usb_suspend_device (struct usb_device *udev, int port1) ...@@ -1727,14 +1727,14 @@ static int __usb_suspend_device (struct usb_device *udev, int port1)
#endif #endif
/* /*
* usb_suspend_device - suspend a usb device * usb_port_suspend - suspend a usb device's upstream port
* @udev: device that's no longer in active use * @udev: device that's no longer in active use
* Context: must be able to sleep; device not locked; pm locks held * Context: must be able to sleep; device not locked; pm locks held
* *
* Suspends a USB device that isn't in active use, conserving power. * Suspends a USB device that isn't in active use, conserving power.
* Devices may wake out of a suspend, if anything important happens, * Devices may wake out of a suspend, if anything important happens,
* using the remote wakeup mechanism. They may also be taken out of * using the remote wakeup mechanism. They may also be taken out of
* suspend by the host, using usb_resume_device(). It's also routine * suspend by the host, using usb_port_resume(). It's also routine
* to disconnect devices while they are suspended. * to disconnect devices while they are suspended.
* *
* This only affects the USB hardware for a device; its interfaces * This only affects the USB hardware for a device; its interfaces
...@@ -1746,12 +1746,12 @@ static int __usb_suspend_device (struct usb_device *udev, int port1) ...@@ -1746,12 +1746,12 @@ static int __usb_suspend_device (struct usb_device *udev, int port1)
* *
* Returns 0 on success, else negative errno. * Returns 0 on success, else negative errno.
*/ */
int usb_suspend_device(struct usb_device *udev) int usb_port_suspend(struct usb_device *udev)
{ {
#ifdef CONFIG_USB_SUSPEND #ifdef CONFIG_USB_SUSPEND
if (udev->state == USB_STATE_NOTATTACHED) if (udev->state == USB_STATE_NOTATTACHED)
return -ENODEV; return -ENODEV;
return __usb_suspend_device(udev, udev->portnum); return __usb_port_suspend(udev, udev->portnum);
#else #else
/* NOTE: udev->state unchanged, it's not lying ... */ /* NOTE: udev->state unchanged, it's not lying ... */
udev->dev.power.power_state = PMSG_SUSPEND; udev->dev.power.power_state = PMSG_SUSPEND;
...@@ -1767,7 +1767,7 @@ int usb_suspend_device(struct usb_device *udev) ...@@ -1767,7 +1767,7 @@ int usb_suspend_device(struct usb_device *udev)
* resume (by host) or remote wakeup (by device) ... now see what changed * resume (by host) or remote wakeup (by device) ... now see what changed
* in the tree that's rooted at this device. * in the tree that's rooted at this device.
*/ */
static int finish_device_resume(struct usb_device *udev) static int finish_port_resume(struct usb_device *udev)
{ {
int status; int status;
u16 devstatus; u16 devstatus;
...@@ -1891,7 +1891,7 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev) ...@@ -1891,7 +1891,7 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev)
/* TRSMRCY = 10 msec */ /* TRSMRCY = 10 msec */
msleep(10); msleep(10);
if (udev) if (udev)
status = finish_device_resume(udev); status = finish_port_resume(udev);
} }
} }
if (status < 0) if (status < 0)
...@@ -1903,7 +1903,7 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev) ...@@ -1903,7 +1903,7 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev)
#endif #endif
/* /*
* usb_resume_device - re-activate a suspended usb device * usb_port_resume - re-activate a suspended usb device's upstream port
* @udev: device to re-activate * @udev: device to re-activate
* Context: must be able to sleep; device not locked; pm locks held * Context: must be able to sleep; device not locked; pm locks held
* *
...@@ -1915,14 +1915,16 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev) ...@@ -1915,14 +1915,16 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev)
* *
* Returns 0 on success, else negative errno. * Returns 0 on success, else negative errno.
*/ */
int usb_resume_device(struct usb_device *udev) int usb_port_resume(struct usb_device *udev)
{ {
int status; int status;
if (udev->state == USB_STATE_NOTATTACHED) if (udev->state == USB_STATE_NOTATTACHED)
return -ENODEV; return -ENODEV;
/* selective resume of one downstream hub-to-device port */ /* we change the device's upstream USB link,
* but root hubs have no upstream USB link.
*/
if (udev->parent) { if (udev->parent) {
#ifdef CONFIG_USB_SUSPEND #ifdef CONFIG_USB_SUSPEND
if (udev->state == USB_STATE_SUSPENDED) { if (udev->state == USB_STATE_SUSPENDED) {
...@@ -1934,7 +1936,7 @@ int usb_resume_device(struct usb_device *udev) ...@@ -1934,7 +1936,7 @@ int usb_resume_device(struct usb_device *udev)
#endif #endif
status = 0; status = 0;
} else } else
status = finish_device_resume(udev); status = finish_port_resume(udev);
if (status < 0) if (status < 0)
dev_dbg(&udev->dev, "can't resume, status %d\n", dev_dbg(&udev->dev, "can't resume, status %d\n",
status); status);
...@@ -1962,7 +1964,7 @@ static int remote_wakeup(struct usb_device *udev) ...@@ -1962,7 +1964,7 @@ static int remote_wakeup(struct usb_device *udev)
dev_dbg(&udev->dev, "RESUME (wakeup)\n"); dev_dbg(&udev->dev, "RESUME (wakeup)\n");
/* TRSMRCY = 10 msec */ /* TRSMRCY = 10 msec */
msleep(10); msleep(10);
status = finish_device_resume(udev); status = finish_port_resume(udev);
} }
usb_unlock_device(udev); usb_unlock_device(udev);
#endif #endif
...@@ -2069,7 +2071,7 @@ static int hub_resume(struct usb_interface *intf) ...@@ -2069,7 +2071,7 @@ static int hub_resume(struct usb_interface *intf)
if (portstat & USB_PORT_STAT_SUSPEND) if (portstat & USB_PORT_STAT_SUSPEND)
status = hub_port_resume(hub, port1, udev); status = hub_port_resume(hub, port1, udev);
else { else {
status = finish_device_resume(udev); status = finish_port_resume(udev);
if (status < 0) { if (status < 0) {
dev_dbg(&intf->dev, "resume port %d --> %d\n", dev_dbg(&intf->dev, "resume port %d --> %d\n",
port1, status); port1, status);
...@@ -3128,6 +3130,7 @@ int usb_reset_device(struct usb_device *udev) ...@@ -3128,6 +3130,7 @@ int usb_reset_device(struct usb_device *udev)
hub_port_logical_disconnect(parent_hub, port1); hub_port_logical_disconnect(parent_hub, port1);
return -ENODEV; return -ENODEV;
} }
EXPORT_SYMBOL(usb_reset_device);
/** /**
* usb_reset_composite_device - warn interface drivers and perform a USB port reset * usb_reset_composite_device - warn interface drivers and perform a USB port reset
...@@ -3206,3 +3209,4 @@ int usb_reset_composite_device(struct usb_device *udev, ...@@ -3206,3 +3209,4 @@ int usb_reset_composite_device(struct usb_device *udev,
return ret; return ret;
} }
EXPORT_SYMBOL(usb_reset_composite_device);
...@@ -1014,7 +1014,7 @@ static int usb_generic_suspend(struct device *dev, pm_message_t message) ...@@ -1014,7 +1014,7 @@ static int usb_generic_suspend(struct device *dev, pm_message_t message)
status = device_for_each_child(dev, NULL, verify_suspended); status = device_for_each_child(dev, NULL, verify_suspended);
if (status) if (status)
return status; return status;
return usb_suspend_device (to_usb_device(dev)); return usb_port_suspend(to_usb_device(dev));
} }
if ((dev->driver == NULL) || if ((dev->driver == NULL) ||
...@@ -1061,7 +1061,7 @@ static int usb_generic_resume(struct device *dev) ...@@ -1061,7 +1061,7 @@ static int usb_generic_resume(struct device *dev)
udev = to_usb_device(dev); udev = to_usb_device(dev);
if (udev->state == USB_STATE_NOTATTACHED) if (udev->state == USB_STATE_NOTATTACHED)
return 0; return 0;
return usb_resume_device (to_usb_device(dev)); return usb_port_resume(udev);
} }
if ((dev->driver == NULL) || if ((dev->driver == NULL) ||
...@@ -1209,9 +1209,6 @@ EXPORT_SYMBOL(usb_find_interface); ...@@ -1209,9 +1209,6 @@ EXPORT_SYMBOL(usb_find_interface);
EXPORT_SYMBOL(usb_ifnum_to_if); EXPORT_SYMBOL(usb_ifnum_to_if);
EXPORT_SYMBOL(usb_altnum_to_altsetting); EXPORT_SYMBOL(usb_altnum_to_altsetting);
EXPORT_SYMBOL(usb_reset_device);
EXPORT_SYMBOL(usb_reset_composite_device);
EXPORT_SYMBOL(__usb_get_extra_descriptor); EXPORT_SYMBOL(__usb_get_extra_descriptor);
EXPORT_SYMBOL(usb_find_device); EXPORT_SYMBOL(usb_find_device);
......
...@@ -30,8 +30,8 @@ extern void usb_major_cleanup(void); ...@@ -30,8 +30,8 @@ extern void usb_major_cleanup(void);
extern int usb_host_init(void); extern int usb_host_init(void);
extern void usb_host_cleanup(void); extern void usb_host_cleanup(void);
extern int usb_suspend_device(struct usb_device *dev); extern int usb_port_suspend(struct usb_device *dev);
extern int usb_resume_device(struct usb_device *dev); extern int usb_port_resume(struct usb_device *dev);
extern struct device_driver usb_generic_driver; extern struct device_driver usb_generic_driver;
extern int usb_generic_driver_data; extern int usb_generic_driver_data;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册