Staging: mei: fix suspend failure
authorTomas Winkler <tomas.winkler@intel.com>
Mon, 13 Jun 2011 13:39:31 +0000 (16:39 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 27 Jun 2011 21:19:21 +0000 (14:19 -0700)
wait_event_interruptible_timeout return value was wrongly used.
The remaining timeout was used as the error code.
This fix translated wait_event_interruptible_timeout return value
into error code that can be propagated.

[10291.674121] pci_pm_suspend(): mei_pci_suspend+0x0/0x8b [mei] returns 2500
It's thinkpad t400 with
00:03.0 Communication controller [0780]: Intel Corporation Mobile 4 Series Chipset MEI Controller [8086:2a44] (rev 07)

Reported-by: Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/mei/init.c
drivers/staging/mei/wd.c

index d1ffa32cd141105b1f9fe4f064ef8b06a53b01e1..685fcf63964494cefb8cf93bd472478c5b8f301a 100644 (file)
@@ -189,7 +189,7 @@ int mei_hw_init(struct mei_device *dev)
                mutex_lock(&dev->device_lock);
        }
 
-       if (!err && !dev->recvd_msg) {
+       if (err <= 0 && !dev->recvd_msg) {
                dev->mei_state = MEI_DISABLED;
                dev_dbg(&dev->pdev->dev,
                        "wait_event_interruptible_timeout failed"
index 2564b038636ad6e79ad1e52d3b8a83749e8ce1ca..fff53d0b5c6efed99aba827b0f68979092f5bb44 100644 (file)
@@ -169,10 +169,15 @@ int mei_wd_stop(struct mei_device *dev, bool preserve)
        ret = wait_event_interruptible_timeout(dev->wait_stop_wd,
                                        dev->wd_stopped, 10 * HZ);
        mutex_lock(&dev->device_lock);
-       if (!dev->wd_stopped)
-               dev_dbg(&dev->pdev->dev, "stop wd failed to complete.\n");
-       else
-               dev_dbg(&dev->pdev->dev, "stop wd complete.\n");
+       if (dev->wd_stopped) {
+               dev_dbg(&dev->pdev->dev, "stop wd complete ret=%d.\n", ret);
+               ret = 0;
+       } else {
+               if (!ret)
+                       ret = -ETIMEDOUT;
+               dev_warn(&dev->pdev->dev,
+                       "stop wd failed to complete ret=%d.\n", ret);
+       }
 
        if (preserve)
                dev->wd_timeout = wd_timeout;