diff options
author | David Brownell <david-b@pacbell.net> | 2005-09-23 01:32:11 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 19:47:40 -0400 |
commit | 9293677af3dace2645dec0d0808efa02d36bf47b (patch) | |
tree | 1300a91bd6d6b20a69e35f67e7ff71b5a5d776e6 | |
parent | 7ff71d6adf81a43505b7cbaa034e4063d3439182 (diff) |
[PATCH] all HCDs provide root hub suspend/resume methods
This cleans up a small recent FIXME, ensuring that all the HCDs provide
root hub suspend/resume methods. It also wraps the calls to those root
suspend routines just like on the PCI "USB_SUSPEND not defined" cases,
so non-PCI bus glue won't be as tempted to behave very differently.
Several of the SOC based OHCI drivers forgot to list those methods;
the patch also adds those missing declarations.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hcd.c | 42 +++++++++++++++++++++++++---------------
drivers/usb/host/ohci-au1xxx.c | 5 ++++
drivers/usb/host/ohci-lh7a404.c | 5 ++++
drivers/usb/host/ohci-pxa27x.c | 1
drivers/usb/host/ohci-s3c2410.c | 1
drivers/usb/host/ohci-sa1111.c | 1
6 files changed, 40 insertions(+), 15 deletions(-)
-rw-r--r-- | drivers/usb/core/hcd.c | 42 | ||||
-rw-r--r-- | drivers/usb/host/ohci-au1xxx.c | 5 | ||||
-rw-r--r-- | drivers/usb/host/ohci-lh7a404.c | 5 | ||||
-rw-r--r-- | drivers/usb/host/ohci-pxa27x.c | 1 | ||||
-rw-r--r-- | drivers/usb/host/ohci-s3c2410.c | 1 | ||||
-rw-r--r-- | drivers/usb/host/ohci-sa1111.c | 1 |
6 files changed, 40 insertions, 15 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 5e8ade07d7f9..375382f9d671 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1431,28 +1431,44 @@ rescan: | |||
1431 | 1431 | ||
1432 | /*-------------------------------------------------------------------------*/ | 1432 | /*-------------------------------------------------------------------------*/ |
1433 | 1433 | ||
1434 | /* FIXME make this #ifdef CONFIG_PM ... update root hubs, retest */ | 1434 | #ifdef CONFIG_PM |
1435 | |||
1436 | #ifdef CONFIG_USB_SUSPEND | ||
1437 | 1435 | ||
1438 | static int hcd_hub_suspend (struct usb_bus *bus) | 1436 | static int hcd_hub_suspend (struct usb_bus *bus) |
1439 | { | 1437 | { |
1440 | struct usb_hcd *hcd; | 1438 | struct usb_hcd *hcd; |
1439 | int status; | ||
1441 | 1440 | ||
1442 | hcd = container_of (bus, struct usb_hcd, self); | 1441 | hcd = container_of (bus, struct usb_hcd, self); |
1443 | if (hcd->driver->hub_suspend) | 1442 | if (!hcd->driver->hub_suspend) |
1444 | return hcd->driver->hub_suspend (hcd); | 1443 | return -ENOENT; |
1445 | return 0; | 1444 | hcd->state = HC_STATE_QUIESCING; |
1445 | status = hcd->driver->hub_suspend (hcd); | ||
1446 | if (status == 0) | ||
1447 | hcd->state = HC_STATE_SUSPENDED; | ||
1448 | else | ||
1449 | dev_dbg(&bus->root_hub->dev, "%s fail, err %d\n", | ||
1450 | "suspend", status); | ||
1451 | return status; | ||
1446 | } | 1452 | } |
1447 | 1453 | ||
1448 | static int hcd_hub_resume (struct usb_bus *bus) | 1454 | static int hcd_hub_resume (struct usb_bus *bus) |
1449 | { | 1455 | { |
1450 | struct usb_hcd *hcd; | 1456 | struct usb_hcd *hcd; |
1457 | int status; | ||
1451 | 1458 | ||
1452 | hcd = container_of (bus, struct usb_hcd, self); | 1459 | hcd = container_of (bus, struct usb_hcd, self); |
1453 | if (hcd->driver->hub_resume) | 1460 | if (!hcd->driver->hub_resume) |
1454 | return hcd->driver->hub_resume (hcd); | 1461 | return -ENOENT; |
1455 | return 0; | 1462 | hcd->state = HC_STATE_RESUMING; |
1463 | status = hcd->driver->hub_resume (hcd); | ||
1464 | if (status == 0) | ||
1465 | hcd->state = HC_STATE_RUNNING; | ||
1466 | else { | ||
1467 | dev_dbg(&bus->root_hub->dev, "%s fail, err %d\n", | ||
1468 | "resume", status); | ||
1469 | usb_hc_died(hcd); | ||
1470 | } | ||
1471 | return status; | ||
1456 | } | 1472 | } |
1457 | 1473 | ||
1458 | /** | 1474 | /** |
@@ -1473,13 +1489,9 @@ void usb_hcd_resume_root_hub (struct usb_hcd *hcd) | |||
1473 | usb_resume_root_hub (hcd->self.root_hub); | 1489 | usb_resume_root_hub (hcd->self.root_hub); |
1474 | spin_unlock_irqrestore (&hcd_root_hub_lock, flags); | 1490 | spin_unlock_irqrestore (&hcd_root_hub_lock, flags); |
1475 | } | 1491 | } |
1492 | EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub); | ||
1476 | 1493 | ||
1477 | #else | ||
1478 | void usb_hcd_resume_root_hub (struct usb_hcd *hcd) | ||
1479 | { | ||
1480 | } | ||
1481 | #endif | 1494 | #endif |
1482 | EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub); | ||
1483 | 1495 | ||
1484 | /*-------------------------------------------------------------------------*/ | 1496 | /*-------------------------------------------------------------------------*/ |
1485 | 1497 | ||
@@ -1532,7 +1544,7 @@ static struct usb_operations usb_hcd_operations = { | |||
1532 | .buffer_alloc = hcd_buffer_alloc, | 1544 | .buffer_alloc = hcd_buffer_alloc, |
1533 | .buffer_free = hcd_buffer_free, | 1545 | .buffer_free = hcd_buffer_free, |
1534 | .disable = hcd_endpoint_disable, | 1546 | .disable = hcd_endpoint_disable, |
1535 | #ifdef CONFIG_USB_SUSPEND | 1547 | #ifdef CONFIG_PM |
1536 | .hub_suspend = hcd_hub_suspend, | 1548 | .hub_suspend = hcd_hub_suspend, |
1537 | .hub_resume = hcd_hub_resume, | 1549 | .hub_resume = hcd_hub_resume, |
1538 | #endif | 1550 | #endif |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 3981bf15c8c7..550d67a554f6 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -214,6 +214,11 @@ static const struct hc_driver ohci_au1xxx_hc_driver = { | |||
214 | */ | 214 | */ |
215 | .hub_status_data = ohci_hub_status_data, | 215 | .hub_status_data = ohci_hub_status_data, |
216 | .hub_control = ohci_hub_control, | 216 | .hub_control = ohci_hub_control, |
217 | #ifdef CONFIG_PM | ||
218 | .hub_suspend = ohci_hub_suspend, | ||
219 | .hub_resume = ohci_hub_resume, | ||
220 | #endif | ||
221 | .start_port_reset = ohci_start_port_reset, | ||
217 | }; | 222 | }; |
218 | 223 | ||
219 | /*-------------------------------------------------------------------------*/ | 224 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index 859aca7be753..71d975ae78bd 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c | |||
@@ -193,6 +193,11 @@ static const struct hc_driver ohci_lh7a404_hc_driver = { | |||
193 | */ | 193 | */ |
194 | .hub_status_data = ohci_hub_status_data, | 194 | .hub_status_data = ohci_hub_status_data, |
195 | .hub_control = ohci_hub_control, | 195 | .hub_control = ohci_hub_control, |
196 | #ifdef CONFIG_PM | ||
197 | .hub_suspend = ohci_hub_suspend, | ||
198 | .hub_resume = ohci_hub_resume, | ||
199 | #endif | ||
200 | .start_port_reset = ohci_start_port_reset, | ||
196 | }; | 201 | }; |
197 | 202 | ||
198 | /*-------------------------------------------------------------------------*/ | 203 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 986c4f656e22..2e7b48502a3d 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -282,6 +282,7 @@ static const struct hc_driver ohci_pxa27x_hc_driver = { | |||
282 | .hub_suspend = ohci_hub_suspend, | 282 | .hub_suspend = ohci_hub_suspend, |
283 | .hub_resume = ohci_hub_resume, | 283 | .hub_resume = ohci_hub_resume, |
284 | #endif | 284 | #endif |
285 | .start_port_reset = ohci_start_port_reset, | ||
285 | }; | 286 | }; |
286 | 287 | ||
287 | /*-------------------------------------------------------------------------*/ | 288 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 8cf12b2be2a3..922e2a6f46ef 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -452,6 +452,7 @@ static const struct hc_driver ohci_s3c2410_hc_driver = { | |||
452 | .hub_suspend = ohci_hub_suspend, | 452 | .hub_suspend = ohci_hub_suspend, |
453 | .hub_resume = ohci_hub_resume, | 453 | .hub_resume = ohci_hub_resume, |
454 | #endif | 454 | #endif |
455 | .start_port_reset = ohci_start_port_reset, | ||
455 | }; | 456 | }; |
456 | 457 | ||
457 | /* device driver */ | 458 | /* device driver */ |
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c index 7dd1f410b7f1..13324b7f9c59 100644 --- a/drivers/usb/host/ohci-sa1111.c +++ b/drivers/usb/host/ohci-sa1111.c | |||
@@ -239,6 +239,7 @@ static const struct hc_driver ohci_sa1111_hc_driver = { | |||
239 | .hub_suspend = ohci_hub_suspend, | 239 | .hub_suspend = ohci_hub_suspend, |
240 | .hub_resume = ohci_hub_resume, | 240 | .hub_resume = ohci_hub_resume, |
241 | #endif | 241 | #endif |
242 | .start_port_reset = ohci_start_port_reset, | ||
242 | }; | 243 | }; |
243 | 244 | ||
244 | /*-------------------------------------------------------------------------*/ | 245 | /*-------------------------------------------------------------------------*/ |