aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2006-07-01 22:07:21 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-27 14:58:49 -0400
commit140d8f687457c40a66af362838fac0d7893e7df5 (patch)
tree976b40f316c65f93bd1f391e5a7bd6107a4985cc /drivers/usb
parent121e287cb554f3d3402c85a1950d852691b08f5c (diff)
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: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/hub.c38
-rw-r--r--drivers/usb/core/usb.c7
-rw-r--r--drivers/usb/core/usb.h4
3 files changed, 25 insertions, 24 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 26c8cb5f3e6..b00514d9a60 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1407,9 +1407,9 @@ int usb_new_device(struct usb_device *udev)
1407 * (Includes HNP test device.) 1407 * (Includes HNP test device.)
1408 */ 1408 */
1409 if (udev->bus->b_hnp_enable || udev->bus->is_b_host) { 1409 if (udev->bus->b_hnp_enable || udev->bus->is_b_host) {
1410 static int __usb_suspend_device(struct usb_device *, 1410 static int __usb_port_suspend(struct usb_device *,
1411 int port1); 1411 int port1);
1412 err = __usb_suspend_device(udev, udev->bus->otg_port); 1412 err = __usb_port_suspend(udev, udev->bus->otg_port);
1413 if (err < 0) 1413 if (err < 0)
1414 dev_dbg(&udev->dev, "HNP fail, %d\n", err); 1414 dev_dbg(&udev->dev, "HNP fail, %d\n", err);
1415 } 1415 }
@@ -1684,7 +1684,7 @@ static int hub_port_suspend(struct usb_hub *hub, int port1,
1684 * the root hub for their bus goes into global suspend ... so we don't 1684 * the root hub for their bus goes into global suspend ... so we don't
1685 * (falsely) update the device power state to say it suspended. 1685 * (falsely) update the device power state to say it suspended.
1686 */ 1686 */
1687static int __usb_suspend_device (struct usb_device *udev, int port1) 1687static int __usb_port_suspend (struct usb_device *udev, int port1)
1688{ 1688{
1689 int status = 0; 1689 int status = 0;
1690 1690
@@ -1712,8 +1712,8 @@ static int __usb_suspend_device (struct usb_device *udev, int port1)
1712 } 1712 }
1713 } 1713 }
1714 1714
1715 /* we only change a device's upstream USB link. 1715 /* we change the device's upstream USB link,
1716 * root hubs have no upstream USB link. 1716 * but root hubs have no upstream USB link.
1717 */ 1717 */
1718 if (udev->parent) 1718 if (udev->parent)
1719 status = hub_port_suspend(hdev_to_hub(udev->parent), port1, 1719 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#endif 1727#endif
1728 1728
1729/* 1729/*
1730 * usb_suspend_device - suspend a usb device 1730 * usb_port_suspend - suspend a usb device's upstream port
1731 * @udev: device that's no longer in active use 1731 * @udev: device that's no longer in active use
1732 * Context: must be able to sleep; device not locked; pm locks held 1732 * Context: must be able to sleep; device not locked; pm locks held
1733 * 1733 *
1734 * Suspends a USB device that isn't in active use, conserving power. 1734 * Suspends a USB device that isn't in active use, conserving power.
1735 * Devices may wake out of a suspend, if anything important happens, 1735 * Devices may wake out of a suspend, if anything important happens,
1736 * using the remote wakeup mechanism. They may also be taken out of 1736 * using the remote wakeup mechanism. They may also be taken out of
1737 * suspend by the host, using usb_resume_device(). It's also routine 1737 * suspend by the host, using usb_port_resume(). It's also routine
1738 * to disconnect devices while they are suspended. 1738 * to disconnect devices while they are suspended.
1739 * 1739 *
1740 * This only affects the USB hardware for a device; its interfaces 1740 * 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 * 1746 *
1747 * Returns 0 on success, else negative errno. 1747 * Returns 0 on success, else negative errno.
1748 */ 1748 */
1749int usb_suspend_device(struct usb_device *udev) 1749int usb_port_suspend(struct usb_device *udev)
1750{ 1750{
1751#ifdef CONFIG_USB_SUSPEND 1751#ifdef CONFIG_USB_SUSPEND
1752 if (udev->state == USB_STATE_NOTATTACHED) 1752 if (udev->state == USB_STATE_NOTATTACHED)
1753 return -ENODEV; 1753 return -ENODEV;
1754 return __usb_suspend_device(udev, udev->portnum); 1754 return __usb_port_suspend(udev, udev->portnum);
1755#else 1755#else
1756 /* NOTE: udev->state unchanged, it's not lying ... */ 1756 /* NOTE: udev->state unchanged, it's not lying ... */
1757 udev->dev.power.power_state = PMSG_SUSPEND; 1757 udev->dev.power.power_state = PMSG_SUSPEND;
@@ -1767,7 +1767,7 @@ int usb_suspend_device(struct usb_device *udev)
1767 * resume (by host) or remote wakeup (by device) ... now see what changed 1767 * resume (by host) or remote wakeup (by device) ... now see what changed
1768 * in the tree that's rooted at this device. 1768 * in the tree that's rooted at this device.
1769 */ 1769 */
1770static int finish_device_resume(struct usb_device *udev) 1770static int finish_port_resume(struct usb_device *udev)
1771{ 1771{
1772 int status; 1772 int status;
1773 u16 devstatus; 1773 u16 devstatus;
@@ -1891,7 +1891,7 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev)
1891 /* TRSMRCY = 10 msec */ 1891 /* TRSMRCY = 10 msec */
1892 msleep(10); 1892 msleep(10);
1893 if (udev) 1893 if (udev)
1894 status = finish_device_resume(udev); 1894 status = finish_port_resume(udev);
1895 } 1895 }
1896 } 1896 }
1897 if (status < 0) 1897 if (status < 0)
@@ -1903,7 +1903,7 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev)
1903#endif 1903#endif
1904 1904
1905/* 1905/*
1906 * usb_resume_device - re-activate a suspended usb device 1906 * usb_port_resume - re-activate a suspended usb device's upstream port
1907 * @udev: device to re-activate 1907 * @udev: device to re-activate
1908 * Context: must be able to sleep; device not locked; pm locks held 1908 * Context: must be able to sleep; device not locked; pm locks held
1909 * 1909 *
@@ -1915,14 +1915,16 @@ hub_port_resume(struct usb_hub *hub, int port1, struct usb_device *udev)
1915 * 1915 *
1916 * Returns 0 on success, else negative errno. 1916 * Returns 0 on success, else negative errno.
1917 */ 1917 */
1918int usb_resume_device(struct usb_device *udev) 1918int usb_port_resume(struct usb_device *udev)
1919{ 1919{
1920 int status; 1920 int status;
1921 1921
1922 if (udev->state == USB_STATE_NOTATTACHED) 1922 if (udev->state == USB_STATE_NOTATTACHED)
1923 return -ENODEV; 1923 return -ENODEV;
1924 1924
1925 /* selective resume of one downstream hub-to-device port */ 1925 /* we change the device's upstream USB link,
1926 * but root hubs have no upstream USB link.
1927 */
1926 if (udev->parent) { 1928 if (udev->parent) {
1927#ifdef CONFIG_USB_SUSPEND 1929#ifdef CONFIG_USB_SUSPEND
1928 if (udev->state == USB_STATE_SUSPENDED) { 1930 if (udev->state == USB_STATE_SUSPENDED) {
@@ -1934,7 +1936,7 @@ int usb_resume_device(struct usb_device *udev)
1934#endif 1936#endif
1935 status = 0; 1937 status = 0;
1936 } else 1938 } else
1937 status = finish_device_resume(udev); 1939 status = finish_port_resume(udev);
1938 if (status < 0) 1940 if (status < 0)
1939 dev_dbg(&udev->dev, "can't resume, status %d\n", 1941 dev_dbg(&udev->dev, "can't resume, status %d\n",
1940 status); 1942 status);
@@ -1962,7 +1964,7 @@ static int remote_wakeup(struct usb_device *udev)
1962 dev_dbg(&udev->dev, "RESUME (wakeup)\n"); 1964 dev_dbg(&udev->dev, "RESUME (wakeup)\n");
1963 /* TRSMRCY = 10 msec */ 1965 /* TRSMRCY = 10 msec */
1964 msleep(10); 1966 msleep(10);
1965 status = finish_device_resume(udev); 1967 status = finish_port_resume(udev);
1966 } 1968 }
1967 usb_unlock_device(udev); 1969 usb_unlock_device(udev);
1968#endif 1970#endif
@@ -2069,7 +2071,7 @@ static int hub_resume(struct usb_interface *intf)
2069 if (portstat & USB_PORT_STAT_SUSPEND) 2071 if (portstat & USB_PORT_STAT_SUSPEND)
2070 status = hub_port_resume(hub, port1, udev); 2072 status = hub_port_resume(hub, port1, udev);
2071 else { 2073 else {
2072 status = finish_device_resume(udev); 2074 status = finish_port_resume(udev);
2073 if (status < 0) { 2075 if (status < 0) {
2074 dev_dbg(&intf->dev, "resume port %d --> %d\n", 2076 dev_dbg(&intf->dev, "resume port %d --> %d\n",
2075 port1, status); 2077 port1, status);
@@ -3128,6 +3130,7 @@ re_enumerate:
3128 hub_port_logical_disconnect(parent_hub, port1); 3130 hub_port_logical_disconnect(parent_hub, port1);
3129 return -ENODEV; 3131 return -ENODEV;
3130} 3132}
3133EXPORT_SYMBOL(usb_reset_device);
3131 3134
3132/** 3135/**
3133 * usb_reset_composite_device - warn interface drivers and perform a USB port reset 3136 * 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 3209
3207 return ret; 3210 return ret;
3208} 3211}
3212EXPORT_SYMBOL(usb_reset_composite_device);
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index ab766e0fe4e..b28a31b2030 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1014,7 +1014,7 @@ static int usb_generic_suspend(struct device *dev, pm_message_t message)
1014 status = device_for_each_child(dev, NULL, verify_suspended); 1014 status = device_for_each_child(dev, NULL, verify_suspended);
1015 if (status) 1015 if (status)
1016 return status; 1016 return status;
1017 return usb_suspend_device (to_usb_device(dev)); 1017 return usb_port_suspend(to_usb_device(dev));
1018 } 1018 }
1019 1019
1020 if ((dev->driver == NULL) || 1020 if ((dev->driver == NULL) ||
@@ -1061,7 +1061,7 @@ static int usb_generic_resume(struct device *dev)
1061 udev = to_usb_device(dev); 1061 udev = to_usb_device(dev);
1062 if (udev->state == USB_STATE_NOTATTACHED) 1062 if (udev->state == USB_STATE_NOTATTACHED)
1063 return 0; 1063 return 0;
1064 return usb_resume_device (to_usb_device(dev)); 1064 return usb_port_resume(udev);
1065 } 1065 }
1066 1066
1067 if ((dev->driver == NULL) || 1067 if ((dev->driver == NULL) ||
@@ -1209,9 +1209,6 @@ EXPORT_SYMBOL(usb_find_interface);
1209EXPORT_SYMBOL(usb_ifnum_to_if); 1209EXPORT_SYMBOL(usb_ifnum_to_if);
1210EXPORT_SYMBOL(usb_altnum_to_altsetting); 1210EXPORT_SYMBOL(usb_altnum_to_altsetting);
1211 1211
1212EXPORT_SYMBOL(usb_reset_device);
1213EXPORT_SYMBOL(usb_reset_composite_device);
1214
1215EXPORT_SYMBOL(__usb_get_extra_descriptor); 1212EXPORT_SYMBOL(__usb_get_extra_descriptor);
1216 1213
1217EXPORT_SYMBOL(usb_find_device); 1214EXPORT_SYMBOL(usb_find_device);
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 1217fbbe582..5a4eff5eec8 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -30,8 +30,8 @@ extern void usb_major_cleanup(void);
30extern int usb_host_init(void); 30extern int usb_host_init(void);
31extern void usb_host_cleanup(void); 31extern void usb_host_cleanup(void);
32 32
33extern int usb_suspend_device(struct usb_device *dev); 33extern int usb_port_suspend(struct usb_device *dev);
34extern int usb_resume_device(struct usb_device *dev); 34extern int usb_port_resume(struct usb_device *dev);
35 35
36extern struct device_driver usb_generic_driver; 36extern struct device_driver usb_generic_driver;
37extern int usb_generic_driver_data; 37extern int usb_generic_driver_data;