aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2005-04-18 20:39:22 -0400
committerGreg K-H <gregkh@suse.de>2005-04-18 20:39:22 -0400
commit27d72e8572336d9f4e17a12ac924cb5223a5758d (patch)
tree791a046b5d860233f652973d0627752b67a3c600 /drivers
parentc6053ecffb895f6c0e0ec9c1d298e35cffc1f7a6 (diff)
[PATCH] usb suspend updates (interface suspend)
This is the first of a few installments of PM API updates to match the recent switch to "pm_message_t". This installment primarily affects USB device drivers (for USB interfaces), and it changes the handful of drivers which currently implement suspend methods: - <linux/usb.h> and usbcore, signature change - Some drivers only changed the signature, net effect this just shuts up "sparse -Wbitwise": * hid-core * stir4200 - Two network drivers did that, and also grew slightly more featureful suspend code ... they now properly shut down their activities. (As should stir4200...) * pegasus * usbnet Note that the Wake-On-Lan (WOL) support in pegasus doesn't yet work; looks to me like it's missing a request to turn it on, vs just configuring it. The ASIX code in usbnet also has WOL hooks that are ready to use; untested. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Index: gregkh-2.6/drivers/net/irda/stir4200.c ===================================================================
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/irda/stir4200.c4
-rw-r--r--drivers/usb/core/hub.c4
-rw-r--r--drivers/usb/core/usb.c6
-rw-r--r--drivers/usb/input/hid-core.c6
-rw-r--r--drivers/usb/net/pegasus.c22
-rw-r--r--drivers/usb/net/usbnet.c10
6 files changed, 40 insertions, 12 deletions
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index 83c605e8824c..66f488c13717 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -1128,8 +1128,8 @@ static void stir_disconnect(struct usb_interface *intf)
1128} 1128}
1129 1129
1130#ifdef CONFIG_PM 1130#ifdef CONFIG_PM
1131/* Power management suspend, so power off the transmitter/receiver */ 1131/* USB suspend, so power off the transmitter/receiver */
1132static int stir_suspend(struct usb_interface *intf, u32 state) 1132static int stir_suspend(struct usb_interface *intf, pm_message_t message)
1133{ 1133{
1134 struct stir_cb *stir = usb_get_intfdata(intf); 1134 struct stir_cb *stir = usb_get_intfdata(intf);
1135 1135
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index fa0dc4f6de47..94f7d2d1faf6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1731,7 +1731,7 @@ static int finish_port_resume(struct usb_device *udev)
1731 struct usb_driver *driver; 1731 struct usb_driver *driver;
1732 1732
1733 intf = udev->actconfig->interface[i]; 1733 intf = udev->actconfig->interface[i];
1734 if (intf->dev.power.power_state == PM_SUSPEND_ON) 1734 if (intf->dev.power.power_state == PMSG_SUSPEND)
1735 continue; 1735 continue;
1736 if (!intf->dev.driver) { 1736 if (!intf->dev.driver) {
1737 /* FIXME maybe force to alt 0 */ 1737 /* FIXME maybe force to alt 0 */
@@ -1745,7 +1745,7 @@ static int finish_port_resume(struct usb_device *udev)
1745 1745
1746 /* can we do better than just logging errors? */ 1746 /* can we do better than just logging errors? */
1747 status = driver->resume(intf); 1747 status = driver->resume(intf);
1748 if (intf->dev.power.power_state != PM_SUSPEND_ON 1748 if (intf->dev.power.power_state != PMSG_ON
1749 || status) 1749 || status)
1750 dev_dbg(&intf->dev, 1750 dev_dbg(&intf->dev,
1751 "resume fail, state %d code %d\n", 1751 "resume fail, state %d code %d\n",
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index f0534ee06490..5e45996b5a44 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1382,13 +1382,13 @@ void usb_buffer_unmap_sg (struct usb_device *dev, unsigned pipe,
1382 usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); 1382 usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
1383} 1383}
1384 1384
1385static int usb_generic_suspend(struct device *dev, u32 state) 1385static int usb_generic_suspend(struct device *dev, pm_message_t message)
1386{ 1386{
1387 struct usb_interface *intf; 1387 struct usb_interface *intf;
1388 struct usb_driver *driver; 1388 struct usb_driver *driver;
1389 1389
1390 if (dev->driver == &usb_generic_driver) 1390 if (dev->driver == &usb_generic_driver)
1391 return usb_suspend_device (to_usb_device(dev), state); 1391 return usb_suspend_device (to_usb_device(dev), message);
1392 1392
1393 if ((dev->driver == NULL) || 1393 if ((dev->driver == NULL) ||
1394 (dev->driver_data == &usb_generic_driver_data)) 1394 (dev->driver_data == &usb_generic_driver_data))
@@ -1402,7 +1402,7 @@ static int usb_generic_suspend(struct device *dev, u32 state)
1402 return 0; 1402 return 0;
1403 1403
1404 if (driver->suspend) 1404 if (driver->suspend)
1405 return driver->suspend(intf, state); 1405 return driver->suspend(intf, message);
1406 return 0; 1406 return 0;
1407} 1407}
1408 1408
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 7662cf4e2621..e625997694df 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -1790,12 +1790,12 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
1790 return 0; 1790 return 0;
1791} 1791}
1792 1792
1793static int hid_suspend(struct usb_interface *intf, u32 state) 1793static int hid_suspend(struct usb_interface *intf, pm_message_t message)
1794{ 1794{
1795 struct hid_device *hid = usb_get_intfdata (intf); 1795 struct hid_device *hid = usb_get_intfdata (intf);
1796 1796
1797 usb_kill_urb(hid->urbin); 1797 usb_kill_urb(hid->urbin);
1798 intf->dev.power.power_state = state; 1798 intf->dev.power.power_state = PMSG_SUSPEND;
1799 dev_dbg(&intf->dev, "suspend\n"); 1799 dev_dbg(&intf->dev, "suspend\n");
1800 return 0; 1800 return 0;
1801} 1801}
@@ -1805,7 +1805,7 @@ static int hid_resume(struct usb_interface *intf)
1805 struct hid_device *hid = usb_get_intfdata (intf); 1805 struct hid_device *hid = usb_get_intfdata (intf);
1806 int status; 1806 int status;
1807 1807
1808 intf->dev.power.power_state = PM_SUSPEND_ON; 1808 intf->dev.power.power_state = PMSG_ON;
1809 if (hid->open) 1809 if (hid->open)
1810 status = usb_submit_urb(hid->urbin, GFP_NOIO); 1810 status = usb_submit_urb(hid->urbin, GFP_NOIO);
1811 else 1811 else
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
index f6c19d73b7da..a02be795d63e 100644
--- a/drivers/usb/net/pegasus.c
+++ b/drivers/usb/net/pegasus.c
@@ -1364,11 +1364,18 @@ static void pegasus_disconnect(struct usb_interface *intf)
1364 free_netdev(pegasus->net); 1364 free_netdev(pegasus->net);
1365} 1365}
1366 1366
1367static int pegasus_suspend (struct usb_interface *intf, pm_message_t state) 1367static int pegasus_suspend (struct usb_interface *intf, pm_message_t message)
1368{ 1368{
1369 struct pegasus *pegasus = usb_get_intfdata(intf); 1369 struct pegasus *pegasus = usb_get_intfdata(intf);
1370 1370
1371 netif_device_detach (pegasus->net); 1371 netif_device_detach (pegasus->net);
1372 if (netif_running(pegasus->net)) {
1373 cancel_delayed_work(&pegasus->carrier_check);
1374
1375 usb_kill_urb(pegasus->rx_urb);
1376 usb_kill_urb(pegasus->intr_urb);
1377 }
1378 intf->dev.power.power_state = PMSG_SUSPEND;
1372 return 0; 1379 return 0;
1373} 1380}
1374 1381
@@ -1376,7 +1383,20 @@ static int pegasus_resume (struct usb_interface *intf)
1376{ 1383{
1377 struct pegasus *pegasus = usb_get_intfdata(intf); 1384 struct pegasus *pegasus = usb_get_intfdata(intf);
1378 1385
1386 intf->dev.power.power_state = PMSG_ON;
1379 netif_device_attach (pegasus->net); 1387 netif_device_attach (pegasus->net);
1388 if (netif_running(pegasus->net)) {
1389 pegasus->rx_urb->status = 0;
1390 pegasus->rx_urb->actual_length = 0;
1391 read_bulk_callback(pegasus->rx_urb, 0);
1392
1393 pegasus->intr_urb->status = 0;
1394 pegasus->intr_urb->actual_length = 0;
1395 intr_callback(pegasus->intr_urb, 0);
1396
1397 queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
1398 CARRIER_CHECK_DELAY);
1399 }
1380 return 0; 1400 return 0;
1381} 1401}
1382 1402
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
index dd8b4456ea35..3e341b1ffdb1 100644
--- a/drivers/usb/net/usbnet.c
+++ b/drivers/usb/net/usbnet.c
@@ -3732,11 +3732,17 @@ out:
3732 3732
3733#ifdef CONFIG_PM 3733#ifdef CONFIG_PM
3734 3734
3735static int usbnet_suspend (struct usb_interface *intf, u32 state) 3735static int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
3736{ 3736{
3737 struct usbnet *dev = usb_get_intfdata(intf); 3737 struct usbnet *dev = usb_get_intfdata(intf);
3738 3738
3739 /* accelerate emptying of the rx and queues, to avoid
3740 * having everything error out.
3741 */
3739 netif_device_detach (dev->net); 3742 netif_device_detach (dev->net);
3743 (void) unlink_urbs (dev, &dev->rxq);
3744 (void) unlink_urbs (dev, &dev->txq);
3745 intf->dev.power.power_state = PMSG_SUSPEND;
3740 return 0; 3746 return 0;
3741} 3747}
3742 3748
@@ -3744,7 +3750,9 @@ static int usbnet_resume (struct usb_interface *intf)
3744{ 3750{
3745 struct usbnet *dev = usb_get_intfdata(intf); 3751 struct usbnet *dev = usb_get_intfdata(intf);
3746 3752
3753 intf->dev.power.power_state = PMSG_ON;
3747 netif_device_attach (dev->net); 3754 netif_device_attach (dev->net);
3755 tasklet_schedule (&dev->bh);
3748 return 0; 3756 return 0;
3749} 3757}
3750 3758