aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-03-06 17:00:58 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-25 00:16:41 -0400
commit70a1c9e086c2e267fbc4533cb870f34999b531d6 (patch)
treef599883bdc2f04d4ca4760dfdb1f1131fa6b7060 /drivers
parente1879b19b0abdb387e4aeb0b935a486cc75042fb (diff)
USB: remove dev->power.power_state
power.power_state is scheduled for removal. This patch (as1053) removes all uses of that field from drivers/usb. Almost all of them were write-only, the most significant exceptions being sl811-hcd.c and u132-hcd.c. Part of this patch was written by Pavel Machek. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: David Brownell <david-b@pacbell.net> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/driver.c12
-rw-r--r--drivers/usb/core/hcd-pci.c5
-rw-r--r--drivers/usb/core/usb.h2
-rw-r--r--drivers/usb/gadget/dummy_hcd.c2
-rw-r--r--drivers/usb/gadget/omap_udc.c4
-rw-r--r--drivers/usb/host/ehci-dbg.c2
-rw-r--r--drivers/usb/host/ehci-ps3.c1
-rw-r--r--drivers/usb/host/isp116x-hcd.c12
-rw-r--r--drivers/usb/host/ohci-dbg.c2
-rw-r--r--drivers/usb/host/ohci-ep93xx.c2
-rw-r--r--drivers/usb/host/ohci-omap.c2
-rw-r--r--drivers/usb/host/ohci-ps3.c1
-rw-r--r--drivers/usb/host/ohci-pxa27x.c2
-rw-r--r--drivers/usb/host/ohci-sm501.c2
-rw-r--r--drivers/usb/host/r8a66597-hcd.c2
-rw-r--r--drivers/usb/host/sl811-hcd.c8
-rw-r--r--drivers/usb/host/u132-hcd.c7
-rw-r--r--drivers/usb/misc/usbtest.c3
18 files changed, 11 insertions, 60 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index ebccdefcc6f2..2ea333a43d65 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -794,8 +794,6 @@ static int usb_suspend_device(struct usb_device *udev, pm_message_t msg)
794 794
795 done: 795 done:
796 dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status); 796 dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status);
797 if (status == 0)
798 udev->dev.power.power_state.event = msg.event;
799 return status; 797 return status;
800} 798}
801 799
@@ -824,10 +822,8 @@ static int usb_resume_device(struct usb_device *udev)
824 822
825 done: 823 done:
826 dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status); 824 dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status);
827 if (status == 0) { 825 if (status == 0)
828 udev->autoresume_disabled = 0; 826 udev->autoresume_disabled = 0;
829 udev->dev.power.power_state.event = PM_EVENT_ON;
830 }
831 return status; 827 return status;
832} 828}
833 829
@@ -1180,8 +1176,7 @@ static int usb_resume_both(struct usb_device *udev)
1180 } 1176 }
1181 } else { 1177 } else {
1182 1178
1183 /* Needed for setting udev->dev.power.power_state.event, 1179 /* Needed for reset-resume */
1184 * for possible debugging message, and for reset_resume. */
1185 status = usb_resume_device(udev); 1180 status = usb_resume_device(udev);
1186 } 1181 }
1187 1182
@@ -1194,7 +1189,8 @@ static int usb_resume_both(struct usb_device *udev)
1194 1189
1195 done: 1190 done:
1196 dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status); 1191 dev_vdbg(&udev->dev, "%s: status %d\n", __FUNCTION__, status);
1197 udev->reset_resume = 0; 1192 if (!status)
1193 udev->reset_resume = 0;
1198 return status; 1194 return status;
1199} 1195}
1200 1196
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 84760ddbc332..739407bb8492 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -73,7 +73,6 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
73 if (pci_enable_device(dev) < 0) 73 if (pci_enable_device(dev) < 0)
74 return -ENODEV; 74 return -ENODEV;
75 dev->current_state = PCI_D0; 75 dev->current_state = PCI_D0;
76 dev->dev.power.power_state = PMSG_ON;
77 76
78 if (!dev->irq) { 77 if (!dev->irq) {
79 dev_err(&dev->dev, 78 dev_err(&dev->dev,
@@ -302,8 +301,6 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
302 301
303done: 302done:
304 if (retval == 0) { 303 if (retval == 0) {
305 dev->dev.power.power_state = PMSG_SUSPEND;
306
307#ifdef CONFIG_PPC_PMAC 304#ifdef CONFIG_PPC_PMAC
308 /* Disable ASIC clocks for USB */ 305 /* Disable ASIC clocks for USB */
309 if (machine_is(powermac)) { 306 if (machine_is(powermac)) {
@@ -406,8 +403,6 @@ int usb_hcd_pci_resume(struct pci_dev *dev)
406 pci_set_master(dev); 403 pci_set_master(dev);
407 pci_restore_state(dev); 404 pci_restore_state(dev);
408 405
409 dev->dev.power.power_state = PMSG_ON;
410
411 clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags); 406 clear_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
412 407
413 if (hcd->driver->resume) { 408 if (hcd->driver->resume) {
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index 2375194a9d43..1bf8ccb9c58d 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -114,13 +114,11 @@ static inline int is_usb_device_driver(struct device_driver *drv)
114static inline void mark_active(struct usb_interface *f) 114static inline void mark_active(struct usb_interface *f)
115{ 115{
116 f->is_active = 1; 116 f->is_active = 1;
117 f->dev.power.power_state.event = PM_EVENT_ON;
118} 117}
119 118
120static inline void mark_quiesced(struct usb_interface *f) 119static inline void mark_quiesced(struct usb_interface *f)
121{ 120{
122 f->is_active = 0; 121 f->is_active = 0;
123 f->dev.power.power_state.event = PM_EVENT_SUSPEND;
124} 122}
125 123
126static inline int is_active(const struct usb_interface *f) 124static inline int is_active(const struct usb_interface *f)
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index cbe44535c0f0..e454775c2ff2 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -900,7 +900,6 @@ static int dummy_udc_suspend (struct platform_device *pdev, pm_message_t state)
900 set_link_state (dum); 900 set_link_state (dum);
901 spin_unlock_irq (&dum->lock); 901 spin_unlock_irq (&dum->lock);
902 902
903 pdev->dev.power.power_state = state;
904 usb_hcd_poll_rh_status (dummy_to_hcd (dum)); 903 usb_hcd_poll_rh_status (dummy_to_hcd (dum));
905 return 0; 904 return 0;
906} 905}
@@ -915,7 +914,6 @@ static int dummy_udc_resume (struct platform_device *pdev)
915 set_link_state (dum); 914 set_link_state (dum);
916 spin_unlock_irq (&dum->lock); 915 spin_unlock_irq (&dum->lock);
917 916
918 pdev->dev.power.power_state = PMSG_ON;
919 usb_hcd_poll_rh_status (dummy_to_hcd (dum)); 917 usb_hcd_poll_rh_status (dummy_to_hcd (dum));
920 return 0; 918 return 0;
921} 919}
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index ee1e9a314cd1..56277d24f041 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -1265,8 +1265,6 @@ static int can_pullup(struct omap_udc *udc)
1265 1265
1266static void pullup_enable(struct omap_udc *udc) 1266static void pullup_enable(struct omap_udc *udc)
1267{ 1267{
1268 udc->gadget.dev.parent->power.power_state = PMSG_ON;
1269 udc->gadget.dev.power.power_state = PMSG_ON;
1270 UDC_SYSCON1_REG |= UDC_PULLUP_EN; 1268 UDC_SYSCON1_REG |= UDC_PULLUP_EN;
1271 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) 1269 if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx())
1272 OTG_CTRL_REG |= OTG_BSESSVLD; 1270 OTG_CTRL_REG |= OTG_BSESSVLD;
@@ -3061,8 +3059,6 @@ static int omap_udc_suspend(struct platform_device *dev, pm_message_t message)
3061 omap_pullup(&udc->gadget, 0); 3059 omap_pullup(&udc->gadget, 0);
3062 } 3060 }
3063 3061
3064 udc->gadget.dev.power.power_state = PMSG_SUSPEND;
3065 udc->gadget.dev.parent->power.power_state = PMSG_SUSPEND;
3066 return 0; 3062 return 0;
3067} 3063}
3068 3064
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 38eb92e5dc42..4af90df8e7de 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -670,7 +670,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
670 670
671 spin_lock_irqsave (&ehci->lock, flags); 671 spin_lock_irqsave (&ehci->lock, flags);
672 672
673 if (buf->bus->controller->power.power_state.event) { 673 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
674 size = scnprintf (next, size, 674 size = scnprintf (next, size,
675 "bus %s, device %s (driver " DRIVER_VERSION ")\n" 675 "bus %s, device %s (driver " DRIVER_VERSION ")\n"
676 "%s\n" 676 "%s\n"
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c
index bbda58eb8813..69782221bcf3 100644
--- a/drivers/usb/host/ehci-ps3.c
+++ b/drivers/usb/host/ehci-ps3.c
@@ -125,7 +125,6 @@ static int ps3_ehci_probe(struct ps3_system_bus_device *dev)
125 goto fail_irq; 125 goto fail_irq;
126 } 126 }
127 127
128 dev->core.power.power_state = PMSG_ON;
129 dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */ 128 dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */
130 129
131 hcd = usb_create_hcd(&ps3_ehci_hc_driver, &dev->core, dev->core.bus_id); 130 hcd = usb_create_hcd(&ps3_ehci_hc_driver, &dev->core, dev->core.bus_id);
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 203a3359a648..66d773c726f6 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1442,11 +1442,6 @@ static int isp116x_bus_resume(struct usb_hcd *hcd)
1442 break; 1442 break;
1443 case HCCONTROL_USB_OPER: 1443 case HCCONTROL_USB_OPER:
1444 spin_unlock_irq(&isp116x->lock); 1444 spin_unlock_irq(&isp116x->lock);
1445 /* Without setting power_state here the
1446 SUSPENDED state won't be removed from
1447 sysfs/usbN/power.state as a response to remote
1448 wakeup. Maybe in the future. */
1449 hcd->self.root_hub->dev.power.power_state = PMSG_ON;
1450 return 0; 1445 return 0;
1451 default: 1446 default:
1452 /* HCCONTROL_USB_RESET: this may happen, when during 1447 /* HCCONTROL_USB_RESET: this may happen, when during
@@ -1460,7 +1455,6 @@ static int isp116x_bus_resume(struct usb_hcd *hcd)
1460 if ((isp116x->rhdesca & RH_A_NDP) == 2) 1455 if ((isp116x->rhdesca & RH_A_NDP) == 2)
1461 isp116x_hub_control(hcd, SetPortFeature, 1456 isp116x_hub_control(hcd, SetPortFeature,
1462 USB_PORT_FEAT_POWER, 2, NULL, 0); 1457 USB_PORT_FEAT_POWER, 2, NULL, 0);
1463 hcd->self.root_hub->dev.power.power_state = PMSG_ON;
1464 return 0; 1458 return 0;
1465 } 1459 }
1466 1460
@@ -1486,8 +1480,6 @@ static int isp116x_bus_resume(struct usb_hcd *hcd)
1486 isp116x_write_reg32(isp116x, HCCONTROL, 1480 isp116x_write_reg32(isp116x, HCCONTROL,
1487 (val & ~HCCONTROL_HCFS) | HCCONTROL_USB_OPER); 1481 (val & ~HCCONTROL_HCFS) | HCCONTROL_USB_OPER);
1488 spin_unlock_irq(&isp116x->lock); 1482 spin_unlock_irq(&isp116x->lock);
1489 /* see analogous comment above */
1490 hcd->self.root_hub->dev.power.power_state = PMSG_ON;
1491 hcd->state = HC_STATE_RUNNING; 1483 hcd->state = HC_STATE_RUNNING;
1492 1484
1493 return 0; 1485 return 0;
@@ -1663,7 +1655,6 @@ static int __devinit isp116x_probe(struct platform_device *pdev)
1663static int isp116x_suspend(struct platform_device *dev, pm_message_t state) 1655static int isp116x_suspend(struct platform_device *dev, pm_message_t state)
1664{ 1656{
1665 VDBG("%s: state %x\n", __func__, state.event); 1657 VDBG("%s: state %x\n", __func__, state.event);
1666 dev->dev.power.power_state = state;
1667 return 0; 1658 return 0;
1668} 1659}
1669 1660
@@ -1672,8 +1663,7 @@ static int isp116x_suspend(struct platform_device *dev, pm_message_t state)
1672*/ 1663*/
1673static int isp116x_resume(struct platform_device *dev) 1664static int isp116x_resume(struct platform_device *dev)
1674{ 1665{
1675 VDBG("%s: state %x\n", __func__, dev->power.power_state.event); 1666 VDBG("%s\n", __func__);
1676 dev->dev.power.power_state = PMSG_ON;
1677 return 0; 1667 return 0;
1678} 1668}
1679 1669
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index a22c30aa745d..e06bfaebec54 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -655,7 +655,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
655 hcd->product_desc, 655 hcd->product_desc,
656 hcd_name); 656 hcd_name);
657 657
658 if (bus->controller->power.power_state.event) { 658 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
659 size -= scnprintf (next, size, 659 size -= scnprintf (next, size,
660 "SUSPENDED (no register access)\n"); 660 "SUSPENDED (no register access)\n");
661 goto done; 661 goto done;
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index 156e93a9d0df..40c683f8987d 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -177,7 +177,6 @@ static int ohci_hcd_ep93xx_drv_suspend(struct platform_device *pdev, pm_message_
177 177
178 ep93xx_stop_hc(&pdev->dev); 178 ep93xx_stop_hc(&pdev->dev);
179 hcd->state = HC_STATE_SUSPENDED; 179 hcd->state = HC_STATE_SUSPENDED;
180 pdev->dev.power.power_state = PMSG_SUSPEND;
181 180
182 return 0; 181 return 0;
183} 182}
@@ -193,7 +192,6 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
193 ohci->next_statechange = jiffies; 192 ohci->next_statechange = jiffies;
194 193
195 ep93xx_start_hc(&pdev->dev); 194 ep93xx_start_hc(&pdev->dev);
196 pdev->dev.power.power_state = PMSG_ON;
197 usb_hcd_resume_root_hub(hcd); 195 usb_hcd_resume_root_hub(hcd);
198 196
199 return 0; 197 return 0;
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 7bfca1ed1b58..2aafa7b6c81f 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -505,7 +505,6 @@ static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message)
505 505
506 omap_ohci_clock_power(0); 506 omap_ohci_clock_power(0);
507 ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; 507 ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED;
508 dev->dev.power.power_state = PMSG_SUSPEND;
509 return 0; 508 return 0;
510} 509}
511 510
@@ -518,7 +517,6 @@ static int ohci_omap_resume(struct platform_device *dev)
518 ohci->next_statechange = jiffies; 517 ohci->next_statechange = jiffies;
519 518
520 omap_ohci_clock_power(1); 519 omap_ohci_clock_power(1);
521 dev->dev.power.power_state = PMSG_ON;
522 usb_hcd_resume_root_hub(platform_get_drvdata(dev)); 520 usb_hcd_resume_root_hub(platform_get_drvdata(dev));
523 return 0; 521 return 0;
524} 522}
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
index 01a0caeaa6bc..c1935ae537f8 100644
--- a/drivers/usb/host/ohci-ps3.c
+++ b/drivers/usb/host/ohci-ps3.c
@@ -127,7 +127,6 @@ static int ps3_ohci_probe(struct ps3_system_bus_device *dev)
127 goto fail_irq; 127 goto fail_irq;
128 } 128 }
129 129
130 dev->core.power.power_state = PMSG_ON;
131 dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */ 130 dev->core.dma_mask = &dummy_mask; /* FIXME: for improper usb code */
132 131
133 hcd = usb_create_hcd(&ps3_ohci_hc_driver, &dev->core, dev->core.bus_id); 132 hcd = usb_create_hcd(&ps3_ohci_hc_driver, &dev->core, dev->core.bus_id);
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 8ad9b3b604b5..5d470263eed8 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -339,7 +339,6 @@ static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_
339 339
340 pxa27x_stop_hc(&pdev->dev); 340 pxa27x_stop_hc(&pdev->dev);
341 hcd->state = HC_STATE_SUSPENDED; 341 hcd->state = HC_STATE_SUSPENDED;
342 pdev->dev.power.power_state = PMSG_SUSPEND;
343 342
344 return 0; 343 return 0;
345} 344}
@@ -357,7 +356,6 @@ static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev)
357 if ((status = pxa27x_start_hc(&pdev->dev)) < 0) 356 if ((status = pxa27x_start_hc(&pdev->dev)) < 0)
358 return status; 357 return status;
359 358
360 pdev->dev.power.power_state = PMSG_ON;
361 usb_hcd_resume_root_hub(hcd); 359 usb_hcd_resume_root_hub(hcd);
362 360
363 return 0; 361 return 0;
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index 8ffcd3e5f56b..ab1e366d7790 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -224,7 +224,6 @@ static int ohci_sm501_suspend(struct platform_device *pdev, pm_message_t msg)
224 224
225 sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0); 225 sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 0);
226 ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED; 226 ohci_to_hcd(ohci)->state = HC_STATE_SUSPENDED;
227 dev->power.power_state = PMSG_SUSPEND;
228 return 0; 227 return 0;
229} 228}
230 229
@@ -238,7 +237,6 @@ static int ohci_sm501_resume(struct platform_device *pdev)
238 ohci->next_statechange = jiffies; 237 ohci->next_statechange = jiffies;
239 238
240 sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 1); 239 sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 1);
241 dev->power.power_state = PMSG_ON;
242 usb_hcd_resume_root_hub(platform_get_drvdata(pdev)); 240 usb_hcd_resume_root_hub(platform_get_drvdata(pdev));
243 return 0; 241 return 0;
244} 242}
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index afd4fbe7713c..b46ff9a80b66 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -2107,13 +2107,11 @@ static struct hc_driver r8a66597_hc_driver = {
2107#if defined(CONFIG_PM) 2107#if defined(CONFIG_PM)
2108static int r8a66597_suspend(struct platform_device *pdev, pm_message_t state) 2108static int r8a66597_suspend(struct platform_device *pdev, pm_message_t state)
2109{ 2109{
2110 pdev->dev.power.power_state = state;
2111 return 0; 2110 return 0;
2112} 2111}
2113 2112
2114static int r8a66597_resume(struct platform_device *pdev) 2113static int r8a66597_resume(struct platform_device *pdev)
2115{ 2114{
2116 pdev->dev.power.power_state = PMSG_ON;
2117 return 0; 2115 return 0;
2118} 2116}
2119#else /* if defined(CONFIG_PM) */ 2117#else /* if defined(CONFIG_PM) */
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 629bca0ebe8f..df256d61e2c6 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -94,12 +94,10 @@ static void port_power(struct sl811 *sl811, int is_on)
94 94
95 sl811->port1 = (1 << USB_PORT_FEAT_POWER); 95 sl811->port1 = (1 << USB_PORT_FEAT_POWER);
96 sl811->irq_enable = SL11H_INTMASK_INSRMV; 96 sl811->irq_enable = SL11H_INTMASK_INSRMV;
97 hcd->self.controller->power.power_state = PMSG_ON;
98 } else { 97 } else {
99 sl811->port1 = 0; 98 sl811->port1 = 0;
100 sl811->irq_enable = 0; 99 sl811->irq_enable = 0;
101 hcd->state = HC_STATE_HALT; 100 hcd->state = HC_STATE_HALT;
102 hcd->self.controller->power.power_state = PMSG_SUSPEND;
103 } 101 }
104 sl811->ctrl1 = 0; 102 sl811->ctrl1 = 0;
105 sl811_write(sl811, SL11H_IRQ_ENABLE, 0); 103 sl811_write(sl811, SL11H_IRQ_ENABLE, 0);
@@ -1772,8 +1770,6 @@ sl811h_suspend(struct platform_device *dev, pm_message_t state)
1772 port_power(sl811, 0); 1770 port_power(sl811, 0);
1773 break; 1771 break;
1774 } 1772 }
1775 if (retval == 0)
1776 dev->dev.power.power_state = state;
1777 return retval; 1773 return retval;
1778} 1774}
1779 1775
@@ -1786,15 +1782,13 @@ sl811h_resume(struct platform_device *dev)
1786 /* with no "check to see if VBUS is still powered" board hook, 1782 /* with no "check to see if VBUS is still powered" board hook,
1787 * let's assume it'd only be powered to enable remote wakeup. 1783 * let's assume it'd only be powered to enable remote wakeup.
1788 */ 1784 */
1789 if (dev->dev.power.power_state.event == PM_EVENT_SUSPEND 1785 if (!sl811->port1 || !device_can_wakeup(&hcd->self.root_hub->dev)) {
1790 || !device_can_wakeup(&hcd->self.root_hub->dev)) {
1791 sl811->port1 = 0; 1786 sl811->port1 = 0;
1792 port_power(sl811, 1); 1787 port_power(sl811, 1);
1793 usb_root_hub_lost_power(hcd->self.root_hub); 1788 usb_root_hub_lost_power(hcd->self.root_hub);
1794 return 0; 1789 return 0;
1795 } 1790 }
1796 1791
1797 dev->dev.power.power_state = PMSG_ON;
1798 return sl811h_bus_resume(hcd); 1792 return sl811h_bus_resume(hcd);
1799} 1793}
1800 1794
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 8e117a795e93..6e9b7edff528 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -1534,11 +1534,9 @@ static void u132_power(struct u132 *u132, int is_on)
1534 if (u132->power) 1534 if (u132->power)
1535 return; 1535 return;
1536 u132->power = 1; 1536 u132->power = 1;
1537 hcd->self.controller->power.power_state = PMSG_ON;
1538 } else { 1537 } else {
1539 u132->power = 0; 1538 u132->power = 0;
1540 hcd->state = HC_STATE_HALT; 1539 hcd->state = HC_STATE_HALT;
1541 hcd->self.controller->power.power_state = PMSG_SUSPEND;
1542 } 1540 }
1543} 1541}
1544 1542
@@ -3227,8 +3225,6 @@ static int u132_suspend(struct platform_device *pdev, pm_message_t state)
3227 } 3225 }
3228 break; 3226 break;
3229 } 3227 }
3230 if (retval == 0)
3231 pdev->dev.power.power_state = state;
3232 return retval; 3228 return retval;
3233 } 3229 }
3234} 3230}
@@ -3246,14 +3242,13 @@ static int u132_resume(struct platform_device *pdev)
3246 return -ESHUTDOWN; 3242 return -ESHUTDOWN;
3247 } else { 3243 } else {
3248 int retval = 0; 3244 int retval = 0;
3249 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) { 3245 if (!u132->port[0].power) {
3250 int ports = MAX_U132_PORTS; 3246 int ports = MAX_U132_PORTS;
3251 while (ports-- > 0) { 3247 while (ports-- > 0) {
3252 port_power(u132, ports, 1); 3248 port_power(u132, ports, 1);
3253 } 3249 }
3254 retval = 0; 3250 retval = 0;
3255 } else { 3251 } else {
3256 pdev->dev.power.power_state = PMSG_ON;
3257 retval = u132_bus_resume(hcd); 3252 retval = u132_bus_resume(hcd);
3258 } 3253 }
3259 return retval; 3254 return retval;
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 17100471e461..2c4fd4d6df95 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -1564,7 +1564,8 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
1564 if (mutex_lock_interruptible(&dev->lock)) 1564 if (mutex_lock_interruptible(&dev->lock))
1565 return -ERESTARTSYS; 1565 return -ERESTARTSYS;
1566 1566
1567 if (intf->dev.power.power_state.event != PM_EVENT_ON) { 1567 /* FIXME: What if a system sleep starts while a test is running? */
1568 if (!intf->is_active) {
1568 mutex_unlock(&dev->lock); 1569 mutex_unlock(&dev->lock);
1569 return -EHOSTUNREACH; 1570 return -EHOSTUNREACH;
1570 } 1571 }