brcmfmac: reset suspend flag upon sdio suspend failure
authorArend van Spriel <arend@broadcom.com>
Tue, 25 Feb 2014 19:30:38 +0000 (20:30 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 28 Feb 2014 19:33:49 +0000 (14:33 -0500)
The suspend callback first sets the suspend flag used in the driver
but after that the actual suspend is done, which may fail. Reset the
flag upon suspend failure.

Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c

index 9eea7d4..4a6508e 100644 (file)
@@ -1101,9 +1101,7 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
        struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
        int ret = 0;
 
-       brcmf_dbg(SDIO, "\n");
-
-       atomic_set(&sdiodev->suspend, true);
+       brcmf_dbg(SDIO, "Enter\n");
 
        sdio_flags = sdio_get_host_pm_caps(sdiodev->func[1]);
        if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
@@ -1111,9 +1109,12 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
                return -EINVAL;
        }
 
+       atomic_set(&sdiodev->suspend, true);
+
        ret = sdio_set_host_pm_flags(sdiodev->func[1], MMC_PM_KEEP_POWER);
        if (ret) {
                brcmf_err("Failed to set pm_flags\n");
+               atomic_set(&sdiodev->suspend, false);
                return ret;
        }
 
@@ -1127,6 +1128,7 @@ static int brcmf_ops_sdio_resume(struct device *dev)
        struct brcmf_bus *bus_if = dev_get_drvdata(dev);
        struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
 
+       brcmf_dbg(SDIO, "Enter\n");
        brcmf_sdio_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS);
        atomic_set(&sdiodev->suspend, false);
        return 0;