aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2005-10-28 12:52:56 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 12:52:56 -0400
commit9480e307cd88ef09ec9294c7d97ebec18e6d2221 (patch)
tree967e26d3a23c24dd52b114d672312c207714308c /drivers/usb
parenta3a3395e487abc4c1371fe319a8ecbb3913a70a4 (diff)
[PATCH] DRIVER MODEL: Get rid of the obsolete tri-level suspend/resume callbacks
In PM v1, all devices were called at SUSPEND_DISABLE level. Then all devices were called at SUSPEND_SAVE_STATE level, and finally SUSPEND_POWER_DOWN level. However, with PM v2, to maintain compatibility for platform devices, I arranged for the PM v2 suspend/resume callbacks to call the old PM v1 suspend/resume callbacks three times with each level in order so that existing drivers continued to work. Since this is obsolete infrastructure which is no longer necessary, we can remove it. Here's an (untested) patch to do exactly that. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c22
-rw-r--r--drivers/usb/gadget/omap_udc.c9
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c17
-rw-r--r--drivers/usb/host/isp116x-hcd.c14
-rw-r--r--drivers/usb/host/ohci-omap.c10
-rw-r--r--drivers/usb/host/ohci-pxa27x.c4
-rw-r--r--drivers/usb/host/sl811-hcd.c10
7 files changed, 24 insertions, 62 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 583db7c38cf1..f2bdf4e1eb80 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -935,14 +935,10 @@ static int dummy_udc_remove (struct device *dev)
935 return 0; 935 return 0;
936} 936}
937 937
938static int dummy_udc_suspend (struct device *dev, pm_message_t state, 938static int dummy_udc_suspend (struct device *dev, pm_message_t state)
939 u32 level)
940{ 939{
941 struct dummy *dum = dev_get_drvdata(dev); 940 struct dummy *dum = dev_get_drvdata(dev);
942 941
943 if (level != SUSPEND_DISABLE)
944 return 0;
945
946 dev_dbg (dev, "%s\n", __FUNCTION__); 942 dev_dbg (dev, "%s\n", __FUNCTION__);
947 spin_lock_irq (&dum->lock); 943 spin_lock_irq (&dum->lock);
948 dum->udc_suspended = 1; 944 dum->udc_suspended = 1;
@@ -954,13 +950,10 @@ static int dummy_udc_suspend (struct device *dev, pm_message_t state,
954 return 0; 950 return 0;
955} 951}
956 952
957static int dummy_udc_resume (struct device *dev, u32 level) 953static int dummy_udc_resume (struct device *dev)
958{ 954{
959 struct dummy *dum = dev_get_drvdata(dev); 955 struct dummy *dum = dev_get_drvdata(dev);
960 956
961 if (level != RESUME_ENABLE)
962 return 0;
963
964 dev_dbg (dev, "%s\n", __FUNCTION__); 957 dev_dbg (dev, "%s\n", __FUNCTION__);
965 spin_lock_irq (&dum->lock); 958 spin_lock_irq (&dum->lock);
966 dum->udc_suspended = 0; 959 dum->udc_suspended = 0;
@@ -1936,14 +1929,10 @@ static int dummy_hcd_remove (struct device *dev)
1936 return 0; 1929 return 0;
1937} 1930}
1938 1931
1939static int dummy_hcd_suspend (struct device *dev, pm_message_t state, 1932static int dummy_hcd_suspend (struct device *dev, pm_message_t state)
1940 u32 level)
1941{ 1933{
1942 struct usb_hcd *hcd; 1934 struct usb_hcd *hcd;
1943 1935
1944 if (level != SUSPEND_DISABLE)
1945 return 0;
1946
1947 dev_dbg (dev, "%s\n", __FUNCTION__); 1936 dev_dbg (dev, "%s\n", __FUNCTION__);
1948 hcd = dev_get_drvdata (dev); 1937 hcd = dev_get_drvdata (dev);
1949 1938
@@ -1958,13 +1947,10 @@ static int dummy_hcd_suspend (struct device *dev, pm_message_t state,
1958 return 0; 1947 return 0;
1959} 1948}
1960 1949
1961static int dummy_hcd_resume (struct device *dev, u32 level) 1950static int dummy_hcd_resume (struct device *dev)
1962{ 1951{
1963 struct usb_hcd *hcd; 1952 struct usb_hcd *hcd;
1964 1953
1965 if (level != RESUME_ENABLE)
1966 return 0;
1967
1968 dev_dbg (dev, "%s\n", __FUNCTION__); 1954 dev_dbg (dev, "%s\n", __FUNCTION__);
1969 hcd = dev_get_drvdata (dev); 1955 hcd = dev_get_drvdata (dev);
1970 hcd->state = HC_STATE_RUNNING; 1956 hcd->state = HC_STATE_RUNNING;
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index ff5533e69560..58b3ec97fb9a 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2909,12 +2909,10 @@ static int __exit omap_udc_remove(struct device *dev)
2909 * may involve talking to an external transceiver (e.g. isp1301). 2909 * may involve talking to an external transceiver (e.g. isp1301).
2910 */ 2910 */
2911 2911
2912static int omap_udc_suspend(struct device *dev, pm_message_t message, u32 level) 2912static int omap_udc_suspend(struct device *dev, pm_message_t message)
2913{ 2913{
2914 u32 devstat; 2914 u32 devstat;
2915 2915
2916 if (level != SUSPEND_POWER_DOWN)
2917 return 0;
2918 devstat = UDC_DEVSTAT_REG; 2916 devstat = UDC_DEVSTAT_REG;
2919 2917
2920 /* we're requesting 48 MHz clock if the pullup is enabled 2918 /* we're requesting 48 MHz clock if the pullup is enabled
@@ -2931,11 +2929,8 @@ static int omap_udc_suspend(struct device *dev, pm_message_t message, u32 level)
2931 return 0; 2929 return 0;
2932} 2930}
2933 2931
2934static int omap_udc_resume(struct device *dev, u32 level) 2932static int omap_udc_resume(struct device *dev)
2935{ 2933{
2936 if (level != RESUME_POWER_ON)
2937 return 0;
2938
2939 DBG("resume + wakeup/SRP\n"); 2934 DBG("resume + wakeup/SRP\n");
2940 omap_pullup(&udc->gadget, 1); 2935 omap_pullup(&udc->gadget, 1);
2941 2936
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index 73f8c9404156..00dfe42d7a86 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -2602,24 +2602,23 @@ static int __exit pxa2xx_udc_remove(struct device *_dev)
2602 * VBUS IRQs should probably be ignored so that the PXA device just acts 2602 * VBUS IRQs should probably be ignored so that the PXA device just acts
2603 * "dead" to USB hosts until system resume. 2603 * "dead" to USB hosts until system resume.
2604 */ 2604 */
2605static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state, u32 level) 2605static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state)
2606{ 2606{
2607 struct pxa2xx_udc *udc = dev_get_drvdata(dev); 2607 struct pxa2xx_udc *udc = dev_get_drvdata(dev);
2608 2608
2609 if (level == SUSPEND_POWER_DOWN) { 2609 if (!udc->mach->udc_command)
2610 if (!udc->mach->udc_command) 2610 WARN("USB host won't detect disconnect!\n");
2611 WARN("USB host won't detect disconnect!\n"); 2611 pullup(udc, 0);
2612 pullup(udc, 0); 2612
2613 }
2614 return 0; 2613 return 0;
2615} 2614}
2616 2615
2617static int pxa2xx_udc_resume(struct device *dev, u32 level) 2616static int pxa2xx_udc_resume(struct device *dev)
2618{ 2617{
2619 struct pxa2xx_udc *udc = dev_get_drvdata(dev); 2618 struct pxa2xx_udc *udc = dev_get_drvdata(dev);
2620 2619
2621 if (level == RESUME_POWER_ON) 2620 pullup(udc, 1);
2622 pullup(udc, 1); 2621
2623 return 0; 2622 return 0;
2624} 2623}
2625 2624
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index e142056b0d2c..0f6183a829c4 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1774,15 +1774,12 @@ static int __init isp116x_probe(struct device *dev)
1774/* 1774/*
1775 Suspend of platform device 1775 Suspend of platform device
1776*/ 1776*/
1777static int isp116x_suspend(struct device *dev, pm_message_t state, u32 phase) 1777static int isp116x_suspend(struct device *dev, pm_message_t state)
1778{ 1778{
1779 int ret = 0; 1779 int ret = 0;
1780 struct usb_hcd *hcd = dev_get_drvdata(dev); 1780 struct usb_hcd *hcd = dev_get_drvdata(dev);
1781 1781
1782 VDBG("%s: state %x, phase %x\n", __func__, state, phase); 1782 VDBG("%s: state %x\n", __func__, state);
1783
1784 if (phase != SUSPEND_DISABLE && phase != SUSPEND_POWER_DOWN)
1785 return 0;
1786 1783
1787 ret = usb_suspend_device(hcd->self.root_hub, state); 1784 ret = usb_suspend_device(hcd->self.root_hub, state);
1788 if (!ret) { 1785 if (!ret) {
@@ -1797,15 +1794,12 @@ static int isp116x_suspend(struct device *dev, pm_message_t state, u32 phase)
1797/* 1794/*
1798 Resume platform device 1795 Resume platform device
1799*/ 1796*/
1800static int isp116x_resume(struct device *dev, u32 phase) 1797static int isp116x_resume(struct device *dev)
1801{ 1798{
1802 int ret = 0; 1799 int ret = 0;
1803 struct usb_hcd *hcd = dev_get_drvdata(dev); 1800 struct usb_hcd *hcd = dev_get_drvdata(dev);
1804 1801
1805 VDBG("%s: state %x, phase %x\n", __func__, dev->power.power_state, 1802 VDBG("%s: state %x\n", __func__, dev->power.power_state);
1806 phase);
1807 if (phase != RESUME_POWER_ON)
1808 return 0;
1809 1803
1810 ret = usb_resume_device(hcd->self.root_hub); 1804 ret = usb_resume_device(hcd->self.root_hub);
1811 if (!ret) { 1805 if (!ret) {
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index d8f3ba7ad52e..a574216625a0 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -455,14 +455,11 @@ static int ohci_hcd_omap_drv_remove(struct device *dev)
455 455
456#ifdef CONFIG_PM 456#ifdef CONFIG_PM
457 457
458static int ohci_omap_suspend(struct device *dev, pm_message_t message, u32 level) 458static int ohci_omap_suspend(struct device *dev, pm_message_t message)
459{ 459{
460 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); 460 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
461 int status = -EINVAL; 461 int status = -EINVAL;
462 462
463 if (level != SUSPEND_POWER_DOWN)
464 return 0;
465
466 down(&ohci_to_hcd(ohci)->self.root_hub->serialize); 463 down(&ohci_to_hcd(ohci)->self.root_hub->serialize);
467 status = ohci_hub_suspend(ohci_to_hcd(ohci)); 464 status = ohci_hub_suspend(ohci_to_hcd(ohci));
468 if (status == 0) { 465 if (status == 0) {
@@ -476,14 +473,11 @@ static int ohci_omap_suspend(struct device *dev, pm_message_t message, u32 level
476 return status; 473 return status;
477} 474}
478 475
479static int ohci_omap_resume(struct device *dev, u32 level) 476static int ohci_omap_resume(struct device *dev)
480{ 477{
481 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); 478 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
482 int status = 0; 479 int status = 0;
483 480
484 if (level != RESUME_POWER_ON)
485 return 0;
486
487 if (time_before(jiffies, ohci->next_statechange)) 481 if (time_before(jiffies, ohci->next_statechange))
488 msleep(5); 482 msleep(5);
489 ohci->next_statechange = jiffies; 483 ohci->next_statechange = jiffies;
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 2fdb262d4726..f042261ecb8e 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -309,7 +309,7 @@ static int ohci_hcd_pxa27x_drv_remove(struct device *dev)
309 return 0; 309 return 0;
310} 310}
311 311
312static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state, u32 level) 312static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state)
313{ 313{
314// struct platform_device *pdev = to_platform_device(dev); 314// struct platform_device *pdev = to_platform_device(dev);
315// struct usb_hcd *hcd = dev_get_drvdata(dev); 315// struct usb_hcd *hcd = dev_get_drvdata(dev);
@@ -318,7 +318,7 @@ static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state, u
318 return 0; 318 return 0;
319} 319}
320 320
321static int ohci_hcd_pxa27x_drv_resume(struct device *dev, u32 level) 321static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
322{ 322{
323// struct platform_device *pdev = to_platform_device(dev); 323// struct platform_device *pdev = to_platform_device(dev);
324// struct usb_hcd *hcd = dev_get_drvdata(dev); 324// struct usb_hcd *hcd = dev_get_drvdata(dev);
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index d42a15d10a46..03cf6accfe64 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1784,15 +1784,12 @@ sl811h_probe(struct device *dev)
1784 */ 1784 */
1785 1785
1786static int 1786static int
1787sl811h_suspend(struct device *dev, pm_message_t state, u32 phase) 1787sl811h_suspend(struct device *dev, pm_message_t state)
1788{ 1788{
1789 struct usb_hcd *hcd = dev_get_drvdata(dev); 1789 struct usb_hcd *hcd = dev_get_drvdata(dev);
1790 struct sl811 *sl811 = hcd_to_sl811(hcd); 1790 struct sl811 *sl811 = hcd_to_sl811(hcd);
1791 int retval = 0; 1791 int retval = 0;
1792 1792
1793 if (phase != SUSPEND_POWER_DOWN)
1794 return retval;
1795
1796 if (state.event == PM_EVENT_FREEZE) 1793 if (state.event == PM_EVENT_FREEZE)
1797 retval = sl811h_hub_suspend(hcd); 1794 retval = sl811h_hub_suspend(hcd);
1798 else if (state.event == PM_EVENT_SUSPEND) 1795 else if (state.event == PM_EVENT_SUSPEND)
@@ -1803,14 +1800,11 @@ sl811h_suspend(struct device *dev, pm_message_t state, u32 phase)
1803} 1800}
1804 1801
1805static int 1802static int
1806sl811h_resume(struct device *dev, u32 phase) 1803sl811h_resume(struct device *dev)
1807{ 1804{
1808 struct usb_hcd *hcd = dev_get_drvdata(dev); 1805 struct usb_hcd *hcd = dev_get_drvdata(dev);
1809 struct sl811 *sl811 = hcd_to_sl811(hcd); 1806 struct sl811 *sl811 = hcd_to_sl811(hcd);
1810 1807
1811 if (phase != RESUME_POWER_ON)
1812 return 0;
1813
1814 /* with no "check to see if VBUS is still powered" board hook, 1808 /* with no "check to see if VBUS is still powered" board hook,
1815 * let's assume it'd only be powered to enable remote wakeup. 1809 * let's assume it'd only be powered to enable remote wakeup.
1816 */ 1810 */