]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
wl1271: propagate set_power's return value
authorOhad Ben-Cohen <ohad@wizery.com>
Wed, 15 Sep 2010 23:22:04 +0000 (01:22 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 21 Sep 2010 15:04:56 +0000 (11:04 -0400)
Make it possible for the set power method to indicate a
success/failure return value. This is needed to support
more complex power on/off operations such as SDIO
power manipulations.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Acked-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/wl12xx/wl1271.h
drivers/net/wireless/wl12xx/wl1271_io.h
drivers/net/wireless/wl12xx/wl1271_main.c
drivers/net/wireless/wl12xx/wl1271_sdio.c
drivers/net/wireless/wl12xx/wl1271_spi.c

index dd3cee6ea5bb6d486b27973d95f9fa5a35e842f1..faa5925efe306cbb9ab153e38a629d39c909e152 100644 (file)
@@ -313,7 +313,7 @@ struct wl1271_if_operations {
                     bool fixed);
        void (*reset)(struct wl1271 *wl);
        void (*init)(struct wl1271 *wl);
-       void (*power)(struct wl1271 *wl, bool enable);
+       int (*power)(struct wl1271 *wl, bool enable);
        struct device* (*dev)(struct wl1271 *wl);
        void (*enable_irq)(struct wl1271 *wl);
        void (*disable_irq)(struct wl1271 *wl);
index bc806c74c63ab4214d70008bb58fa95a22546395..c1f92e65ded0b8c2895cce3b634562bb2b329b97 100644 (file)
@@ -144,10 +144,13 @@ static inline void wl1271_power_off(struct wl1271 *wl)
        clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
 }
 
-static inline void wl1271_power_on(struct wl1271 *wl)
+static inline int wl1271_power_on(struct wl1271 *wl)
 {
-       wl->if_ops->power(wl, true);
-       set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
+       int ret = wl->if_ops->power(wl, true);
+       if (ret == 0)
+               set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
+
+       return ret;
 }
 
 
index 8e55cf8d509d8e4faa0802e3dc2d018aab97bbdf..af26150109e311ed58f338760b59377d6cf265f3 100644 (file)
@@ -621,7 +621,9 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)
        int ret = 0;
 
        msleep(WL1271_PRE_POWER_ON_SLEEP);
-       wl1271_power_on(wl);
+       ret = wl1271_power_on(wl);
+       if (ret < 0)
+               goto out;
        msleep(WL1271_POWER_ON_SLEEP);
        wl1271_io_reset(wl);
        wl1271_io_init(wl);
index b5d9565f659fec4e2f4f39d7e7e54c8393ab3b20..1d5dc727167db411353e5d0b69c911684df7d665 100644 (file)
@@ -159,35 +159,38 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
                wl1271_error("sdio write failed (%d)", ret);
 }
 
-static void wl1271_sdio_power_on(struct wl1271 *wl)
+static int wl1271_sdio_power_on(struct wl1271 *wl)
 {
        struct sdio_func *func = wl_to_func(wl);
 
        sdio_claim_host(func);
        sdio_enable_func(func);
        sdio_release_host(func);
+
+       return 0;
 }
 
-static void wl1271_sdio_power_off(struct wl1271 *wl)
+static int wl1271_sdio_power_off(struct wl1271 *wl)
 {
        struct sdio_func *func = wl_to_func(wl);
 
        sdio_claim_host(func);
        sdio_disable_func(func);
        sdio_release_host(func);
+
+       return 0;
 }
 
-static void wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
+static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
 {
        /* Let the SDIO stack handle wlan_enable control, so we
         * keep host claimed while wlan is in use to keep wl1271
         * alive.
         */
        if (enable)
-               wl1271_sdio_power_on(wl);
+               return wl1271_sdio_power_on(wl);
        else
-               wl1271_sdio_power_off(wl);
-
+               return wl1271_sdio_power_off(wl);
 }
 
 static struct wl1271_if_operations sdio_ops = {
index c3fdab75ad2a21451a7eee561f4dfa8187b453fa..de56d8d9ee6674a39c5763760cedbd04d31be5e9 100644 (file)
@@ -312,10 +312,12 @@ static irqreturn_t wl1271_irq(int irq, void *cookie)
        return IRQ_HANDLED;
 }
 
-static void wl1271_spi_set_power(struct wl1271 *wl, bool enable)
+static int wl1271_spi_set_power(struct wl1271 *wl, bool enable)
 {
        if (wl->set_power)
                wl->set_power(enable);
+
+       return 0;
 }
 
 static struct wl1271_if_operations spi_ops = {