aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx
diff options
context:
space:
mode:
authorOhad Ben-Cohen <ohad@wizery.com>2010-09-15 19:22:04 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-09-21 11:04:56 -0400
commit2cc78ff78c0af502b040d4527212e29e02d3231d (patch)
treef056210964e0d5799027f900dec47aa10572599a /drivers/net/wireless/wl12xx
parentc1f9a095600e07fefe64eb94eb711f410100824a (diff)
wl1271: propagate set_power's return value
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>
Diffstat (limited to 'drivers/net/wireless/wl12xx')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h2
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_io.h9
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c4
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_sdio.c15
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_spi.c4
5 files changed, 22 insertions, 12 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index dd3cee6ea5bb..faa5925efe30 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -313,7 +313,7 @@ struct wl1271_if_operations {
313 bool fixed); 313 bool fixed);
314 void (*reset)(struct wl1271 *wl); 314 void (*reset)(struct wl1271 *wl);
315 void (*init)(struct wl1271 *wl); 315 void (*init)(struct wl1271 *wl);
316 void (*power)(struct wl1271 *wl, bool enable); 316 int (*power)(struct wl1271 *wl, bool enable);
317 struct device* (*dev)(struct wl1271 *wl); 317 struct device* (*dev)(struct wl1271 *wl);
318 void (*enable_irq)(struct wl1271 *wl); 318 void (*enable_irq)(struct wl1271 *wl);
319 void (*disable_irq)(struct wl1271 *wl); 319 void (*disable_irq)(struct wl1271 *wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_io.h b/drivers/net/wireless/wl12xx/wl1271_io.h
index bc806c74c63a..c1f92e65ded0 100644
--- a/drivers/net/wireless/wl12xx/wl1271_io.h
+++ b/drivers/net/wireless/wl12xx/wl1271_io.h
@@ -144,10 +144,13 @@ static inline void wl1271_power_off(struct wl1271 *wl)
144 clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); 144 clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
145} 145}
146 146
147static inline void wl1271_power_on(struct wl1271 *wl) 147static inline int wl1271_power_on(struct wl1271 *wl)
148{ 148{
149 wl->if_ops->power(wl, true); 149 int ret = wl->if_ops->power(wl, true);
150 set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); 150 if (ret == 0)
151 set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
152
153 return ret;
151} 154}
152 155
153 156
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 8e55cf8d509d..af26150109e3 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -621,7 +621,9 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)
621 int ret = 0; 621 int ret = 0;
622 622
623 msleep(WL1271_PRE_POWER_ON_SLEEP); 623 msleep(WL1271_PRE_POWER_ON_SLEEP);
624 wl1271_power_on(wl); 624 ret = wl1271_power_on(wl);
625 if (ret < 0)
626 goto out;
625 msleep(WL1271_POWER_ON_SLEEP); 627 msleep(WL1271_POWER_ON_SLEEP);
626 wl1271_io_reset(wl); 628 wl1271_io_reset(wl);
627 wl1271_io_init(wl); 629 wl1271_io_init(wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index b5d9565f659f..1d5dc727167d 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -159,35 +159,38 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
159 wl1271_error("sdio write failed (%d)", ret); 159 wl1271_error("sdio write failed (%d)", ret);
160} 160}
161 161
162static void wl1271_sdio_power_on(struct wl1271 *wl) 162static int wl1271_sdio_power_on(struct wl1271 *wl)
163{ 163{
164 struct sdio_func *func = wl_to_func(wl); 164 struct sdio_func *func = wl_to_func(wl);
165 165
166 sdio_claim_host(func); 166 sdio_claim_host(func);
167 sdio_enable_func(func); 167 sdio_enable_func(func);
168 sdio_release_host(func); 168 sdio_release_host(func);
169
170 return 0;
169} 171}
170 172
171static void wl1271_sdio_power_off(struct wl1271 *wl) 173static int wl1271_sdio_power_off(struct wl1271 *wl)
172{ 174{
173 struct sdio_func *func = wl_to_func(wl); 175 struct sdio_func *func = wl_to_func(wl);
174 176
175 sdio_claim_host(func); 177 sdio_claim_host(func);
176 sdio_disable_func(func); 178 sdio_disable_func(func);
177 sdio_release_host(func); 179 sdio_release_host(func);
180
181 return 0;
178} 182}
179 183
180static void wl1271_sdio_set_power(struct wl1271 *wl, bool enable) 184static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
181{ 185{
182 /* Let the SDIO stack handle wlan_enable control, so we 186 /* Let the SDIO stack handle wlan_enable control, so we
183 * keep host claimed while wlan is in use to keep wl1271 187 * keep host claimed while wlan is in use to keep wl1271
184 * alive. 188 * alive.
185 */ 189 */
186 if (enable) 190 if (enable)
187 wl1271_sdio_power_on(wl); 191 return wl1271_sdio_power_on(wl);
188 else 192 else
189 wl1271_sdio_power_off(wl); 193 return wl1271_sdio_power_off(wl);
190
191} 194}
192 195
193static struct wl1271_if_operations sdio_ops = { 196static struct wl1271_if_operations sdio_ops = {
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index c3fdab75ad2a..de56d8d9ee66 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -312,10 +312,12 @@ static irqreturn_t wl1271_irq(int irq, void *cookie)
312 return IRQ_HANDLED; 312 return IRQ_HANDLED;
313} 313}
314 314
315static void wl1271_spi_set_power(struct wl1271 *wl, bool enable) 315static int wl1271_spi_set_power(struct wl1271 *wl, bool enable)
316{ 316{
317 if (wl->set_power) 317 if (wl->set_power)
318 wl->set_power(enable); 318 wl->set_power(enable);
319
320 return 0;
319} 321}
320 322
321static struct wl1271_if_operations spi_ops = { 323static struct wl1271_if_operations spi_ops = {