* [PATCH] wl1271: sdio: claim host only when doing IO
@ 2010-09-07 1:24 Ohad Ben-Cohen
2010-09-08 18:00 ` Luciano Coelho
2010-09-14 20:30 ` John W. Linville
0 siblings, 2 replies; 6+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-07 1:24 UTC (permalink / raw)
To: linux-wireless; +Cc: Luciano Coelho, Ohad Ben-Cohen
Do not maintain a persistent sdio_claim_host state. Instead,
claim host before doing IO and release host soon after.
This fixes several mmc deadlock scenarios, e.g. during
suspend/resume.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
drivers/net/wireless/wl12xx/wl1271_sdio.c | 43 +++++++++++++++++++++++-----
1 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index 7059b5c..b3c3158 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -107,6 +107,8 @@ static void wl1271_sdio_raw_read(struct wl1271 *wl, int addr, void *buf,
int ret;
struct sdio_func *func = wl_to_func(wl);
+ sdio_claim_host(func);
+
if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
((u8 *)buf)[0] = sdio_f0_readb(func, addr, &ret);
wl1271_debug(DEBUG_SDIO, "sdio read 52 addr 0x%x, byte 0x%02x",
@@ -122,9 +124,10 @@ static void wl1271_sdio_raw_read(struct wl1271 *wl, int addr, void *buf,
wl1271_dump_ascii(DEBUG_SDIO, "data: ", buf, len);
}
+ sdio_release_host(func);
+
if (ret)
wl1271_error("sdio read failed (%d)", ret);
-
}
static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
@@ -133,6 +136,8 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
int ret;
struct sdio_func *func = wl_to_func(wl);
+ sdio_claim_host(func);
+
if (unlikely(addr == HW_ACCESS_ELP_CTRL_REG_ADDR)) {
sdio_f0_writeb(func, ((u8 *)buf)[0], addr, &ret);
wl1271_debug(DEBUG_SDIO, "sdio write 52 addr 0x%x, byte 0x%02x",
@@ -147,9 +152,33 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
else
ret = sdio_memcpy_toio(func, addr, buf, len);
}
+
+ sdio_release_host(func);
+
if (ret)
wl1271_error("sdio write failed (%d)", ret);
+}
+
+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 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)
@@ -160,13 +189,11 @@ static void wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
* keep host claimed while wlan is in use to keep wl1271
* alive.
*/
- if (enable) {
- sdio_claim_host(func);
- sdio_enable_func(func);
- } else {
- sdio_disable_func(func);
- sdio_release_host(func);
- }
+ if (enable)
+ return wl1271_sdio_power_on(wl);
+ else
+ return wl1271_sdio_power_off(wl);
+
}
static struct wl1271_if_operations sdio_ops = {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] wl1271: sdio: claim host only when doing IO
2010-09-07 1:24 [PATCH] wl1271: sdio: claim host only when doing IO Ohad Ben-Cohen
@ 2010-09-08 18:00 ` Luciano Coelho
2010-09-14 20:30 ` John W. Linville
1 sibling, 0 replies; 6+ messages in thread
From: Luciano Coelho @ 2010-09-08 18:00 UTC (permalink / raw)
To: ext Ohad Ben-Cohen; +Cc: linux-wireless
On Tue, 2010-09-07 at 03:24 +0200, ext Ohad Ben-Cohen wrote:
> Do not maintain a persistent sdio_claim_host state. Instead,
> claim host before doing IO and release host soon after.
>
> This fixes several mmc deadlock scenarios, e.g. during
> suspend/resume.
>
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
> ---
Looks reasonable. Thanks!
Acked-by: Luciano Coelho <luciano.coelho@nokia.com>
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wl1271: sdio: claim host only when doing IO
2010-09-07 1:24 [PATCH] wl1271: sdio: claim host only when doing IO Ohad Ben-Cohen
2010-09-08 18:00 ` Luciano Coelho
@ 2010-09-14 20:30 ` John W. Linville
2010-09-14 20:30 ` [PATCH] wl1271: remove warnings in wl1271_sdio_set_power John W. Linville
2010-09-14 21:30 ` [PATCH] wl1271: sdio: claim host only when doing IO Ohad Ben-Cohen
1 sibling, 2 replies; 6+ messages in thread
From: John W. Linville @ 2010-09-14 20:30 UTC (permalink / raw)
To: Ohad Ben-Cohen; +Cc: linux-wireless, Luciano Coelho
On Tue, Sep 07, 2010 at 04:24:21AM +0300, Ohad Ben-Cohen wrote:
> Do not maintain a persistent sdio_claim_host state. Instead,
> claim host before doing IO and release host soon after.
>
> This fixes several mmc deadlock scenarios, e.g. during
> suspend/resume.
>
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
<snip>
> @@ -160,13 +189,11 @@ static void wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
> * keep host claimed while wlan is in use to keep wl1271
> * alive.
> */
> - if (enable) {
> - sdio_claim_host(func);
> - sdio_enable_func(func);
> - } else {
> - sdio_disable_func(func);
> - sdio_release_host(func);
> - }
> + if (enable)
> + return wl1271_sdio_power_on(wl);
> + else
> + return wl1271_sdio_power_off(wl);
> +
> }
Please don't add new warnings...
drivers/net/wireless/wl12xx/wl1271_sdio.c: In function ‘wl1271_sdio_set_power’:
drivers/net/wireless/wl12xx/wl1271_sdio.c:193: warning: ‘return’ with a value, in function returning void
drivers/net/wireless/wl12xx/wl1271_sdio.c:195: warning: ‘return’ with a value, in function returning void
drivers/net/wireless/wl12xx/wl1271_sdio.c:186: warning: unused variable ‘func’
I'll fix these in a separate patch.
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] wl1271: remove warnings in wl1271_sdio_set_power
2010-09-14 20:30 ` John W. Linville
@ 2010-09-14 20:30 ` John W. Linville
2010-09-14 21:30 ` [PATCH] wl1271: sdio: claim host only when doing IO Ohad Ben-Cohen
1 sibling, 0 replies; 6+ messages in thread
From: John W. Linville @ 2010-09-14 20:30 UTC (permalink / raw)
To: linux-wireless; +Cc: Ohad Ben-Cohen, Luciano Coelho, John W. Linville
These were introduced in "wl1271: sdio: claim host only when doing IO"
drivers/net/wireless/wl12xx/wl1271_sdio.c: In function ‘wl1271_sdio_set_power’:
drivers/net/wireless/wl12xx/wl1271_sdio.c:193: warning: ‘return’ with a value, in function returning void
drivers/net/wireless/wl12xx/wl1271_sdio.c:195: warning: ‘return’ with a value, in function returning void
drivers/net/wireless/wl12xx/wl1271_sdio.c:186: warning: unused variable ‘func’
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
drivers/net/wireless/wl12xx/wl1271_sdio.c | 14 ++++----------
1 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index b3c3158..b5d9565 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -159,40 +159,34 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
wl1271_error("sdio write failed (%d)", ret);
}
-static int wl1271_sdio_power_on(struct wl1271 *wl)
+static void 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 int wl1271_sdio_power_off(struct wl1271 *wl)
+static void 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)
{
- struct sdio_func *func = wl_to_func(wl);
-
/* Let the SDIO stack handle wlan_enable control, so we
* keep host claimed while wlan is in use to keep wl1271
* alive.
*/
if (enable)
- return wl1271_sdio_power_on(wl);
+ wl1271_sdio_power_on(wl);
else
- return wl1271_sdio_power_off(wl);
+ wl1271_sdio_power_off(wl);
}
--
1.7.2.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] wl1271: sdio: claim host only when doing IO
2010-09-14 20:30 ` John W. Linville
2010-09-14 20:30 ` [PATCH] wl1271: remove warnings in wl1271_sdio_set_power John W. Linville
@ 2010-09-14 21:30 ` Ohad Ben-Cohen
2010-09-15 1:18 ` John W. Linville
1 sibling, 1 reply; 6+ messages in thread
From: Ohad Ben-Cohen @ 2010-09-14 21:30 UTC (permalink / raw)
To: John W. Linville; +Cc: linux-wireless, Luciano Coelho
On Tue, Sep 14, 2010 at 10:30 PM, John W. Linville
<linville@tuxdriver.com> wrote:
> drivers/net/wireless/wl12xx/wl1271_sdio.c: In function ‘wl1271_sdio_set_power’:
> drivers/net/wireless/wl12xx/wl1271_sdio.c:193: warning: ‘return’ with a value, in function returning void
> drivers/net/wireless/wl12xx/wl1271_sdio.c:195: warning: ‘return’ with a value, in function returning void
> drivers/net/wireless/wl12xx/wl1271_sdio.c:186: warning: unused variable ‘func’
Sorry, I wrote the original patch on my branch which already
propagates the error code from set_power.
> I'll fix these in a separate patch.
If you prefer I can submit a new one.
Thanks,
Ohad.
>
> John
> --
> John W. Linville Someday the world will need a hero, and you
> linville@tuxdriver.com might be all we have. Be ready.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wl1271: sdio: claim host only when doing IO
2010-09-14 21:30 ` [PATCH] wl1271: sdio: claim host only when doing IO Ohad Ben-Cohen
@ 2010-09-15 1:18 ` John W. Linville
0 siblings, 0 replies; 6+ messages in thread
From: John W. Linville @ 2010-09-15 1:18 UTC (permalink / raw)
To: Ohad Ben-Cohen; +Cc: linux-wireless, Luciano Coelho
On Tue, Sep 14, 2010 at 11:30:30PM +0200, Ohad Ben-Cohen wrote:
> On Tue, Sep 14, 2010 at 10:30 PM, John W. Linville
> <linville@tuxdriver.com> wrote:
> > drivers/net/wireless/wl12xx/wl1271_sdio.c: In function ‘wl1271_sdio_set_power’:
> > drivers/net/wireless/wl12xx/wl1271_sdio.c:193: warning: ‘return’ with a value, in function returning void
> > drivers/net/wireless/wl12xx/wl1271_sdio.c:195: warning: ‘return’ with a value, in function returning void
> > drivers/net/wireless/wl12xx/wl1271_sdio.c:186: warning: unused variable ‘func’
>
> Sorry, I wrote the original patch on my branch which already
> propagates the error code from set_power.
>
> > I'll fix these in a separate patch.
>
> If you prefer I can submit a new one.
It's already in fixed now. Feel free to undo it with a later patch
that needs the error code.
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-09-15 1:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-07 1:24 [PATCH] wl1271: sdio: claim host only when doing IO Ohad Ben-Cohen
2010-09-08 18:00 ` Luciano Coelho
2010-09-14 20:30 ` John W. Linville
2010-09-14 20:30 ` [PATCH] wl1271: remove warnings in wl1271_sdio_set_power John W. Linville
2010-09-14 21:30 ` [PATCH] wl1271: sdio: claim host only when doing IO Ohad Ben-Cohen
2010-09-15 1:18 ` John W. Linville
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.