提交 690142e9 编写于 作者: M Mircea Gherzan 提交者: Luciano Coelho

wl12xx: fix DMA-API-related warnings

On the PandaBoard (omap_hsmmc + wl12xx_sdio) with DMA_API_DEBUG:

 WARNING: at lib/dma-debug.c:930 check_for_stack.part.8+0x7c/0xe0()
 omap_hsmmc omap_hsmmc.4: DMA-API: device driver maps memory fromstack
Signed-off-by: NMircea Gherzan <mgherzan@gmail.com>
Signed-off-by: NLuciano Coelho <coelho@ti.com>
上级 c56dbd57
...@@ -83,14 +83,22 @@ static void wl1271_parse_fw_ver(struct wl1271 *wl) ...@@ -83,14 +83,22 @@ static void wl1271_parse_fw_ver(struct wl1271 *wl)
static void wl1271_boot_fw_version(struct wl1271 *wl) static void wl1271_boot_fw_version(struct wl1271 *wl)
{ {
struct wl1271_static_data static_data; struct wl1271_static_data *static_data;
wl1271_read(wl, wl->cmd_box_addr, &static_data, sizeof(static_data), static_data = kmalloc(sizeof(*static_data), GFP_DMA);
if (!static_data) {
__WARN();
return;
}
wl1271_read(wl, wl->cmd_box_addr, static_data, sizeof(*static_data),
false); false);
strncpy(wl->chip.fw_ver_str, static_data.fw_version, strncpy(wl->chip.fw_ver_str, static_data->fw_version,
sizeof(wl->chip.fw_ver_str)); sizeof(wl->chip.fw_ver_str));
kfree(static_data);
/* make sure the string is NULL-terminated */ /* make sure the string is NULL-terminated */
wl->chip.fw_ver_str[sizeof(wl->chip.fw_ver_str) - 1] = '\0'; wl->chip.fw_ver_str[sizeof(wl->chip.fw_ver_str) - 1] = '\0';
......
...@@ -342,8 +342,12 @@ int wl1271_cmd_ext_radio_parms(struct wl1271 *wl) ...@@ -342,8 +342,12 @@ int wl1271_cmd_ext_radio_parms(struct wl1271 *wl)
*/ */
static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl, u32 mask) static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl, u32 mask)
{ {
u32 events_vector, event; u32 *events_vector;
u32 event;
unsigned long timeout; unsigned long timeout;
int ret = 0;
events_vector = kmalloc(sizeof(*events_vector), GFP_DMA);
timeout = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT); timeout = jiffies + msecs_to_jiffies(WL1271_EVENT_TIMEOUT);
...@@ -351,21 +355,24 @@ static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl, u32 mask) ...@@ -351,21 +355,24 @@ static int wl1271_cmd_wait_for_event_or_timeout(struct wl1271 *wl, u32 mask)
if (time_after(jiffies, timeout)) { if (time_after(jiffies, timeout)) {
wl1271_debug(DEBUG_CMD, "timeout waiting for event %d", wl1271_debug(DEBUG_CMD, "timeout waiting for event %d",
(int)mask); (int)mask);
return -ETIMEDOUT; ret = -ETIMEDOUT;
goto out;
} }
msleep(1); msleep(1);
/* read from both event fields */ /* read from both event fields */
wl1271_read(wl, wl->mbox_ptr[0], &events_vector, wl1271_read(wl, wl->mbox_ptr[0], events_vector,
sizeof(events_vector), false); sizeof(*events_vector), false);
event = events_vector & mask; event = *events_vector & mask;
wl1271_read(wl, wl->mbox_ptr[1], &events_vector, wl1271_read(wl, wl->mbox_ptr[1], events_vector,
sizeof(events_vector), false); sizeof(*events_vector), false);
event |= events_vector & mask; event |= *events_vector & mask;
} while (!event); } while (!event);
return 0; out:
kfree(events_vector);
return ret;
} }
static int wl1271_cmd_wait_for_event(struct wl1271 *wl, u32 mask) static int wl1271_cmd_wait_for_event(struct wl1271 *wl, u32 mask)
......
...@@ -98,8 +98,9 @@ static void wl1271_event_mbox_dump(struct event_mailbox *mbox) ...@@ -98,8 +98,9 @@ static void wl1271_event_mbox_dump(struct event_mailbox *mbox)
wl1271_debug(DEBUG_EVENT, "\tmask: 0x%x", mbox->events_mask); wl1271_debug(DEBUG_EVENT, "\tmask: 0x%x", mbox->events_mask);
} }
static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox) static int wl1271_event_process(struct wl1271 *wl)
{ {
struct event_mailbox *mbox = wl->mbox;
struct ieee80211_vif *vif; struct ieee80211_vif *vif;
struct wl12xx_vif *wlvif; struct wl12xx_vif *wlvif;
u32 vector; u32 vector;
...@@ -289,7 +290,6 @@ void wl1271_event_mbox_config(struct wl1271 *wl) ...@@ -289,7 +290,6 @@ void wl1271_event_mbox_config(struct wl1271 *wl)
int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num) int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num)
{ {
struct event_mailbox mbox;
int ret; int ret;
wl1271_debug(DEBUG_EVENT, "EVENT on mbox %d", mbox_num); wl1271_debug(DEBUG_EVENT, "EVENT on mbox %d", mbox_num);
...@@ -298,11 +298,11 @@ int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num) ...@@ -298,11 +298,11 @@ int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num)
return -EINVAL; return -EINVAL;
/* first we read the mbox descriptor */ /* first we read the mbox descriptor */
wl1271_read(wl, wl->mbox_ptr[mbox_num], &mbox, wl1271_read(wl, wl->mbox_ptr[mbox_num], wl->mbox,
sizeof(struct event_mailbox), false); sizeof(*wl->mbox), false);
/* process the descriptor */ /* process the descriptor */
ret = wl1271_event_process(wl, &mbox); ret = wl1271_event_process(wl);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -132,6 +132,8 @@ struct event_mailbox { ...@@ -132,6 +132,8 @@ struct event_mailbox {
u8 reserved_8[9]; u8 reserved_8[9];
} __packed; } __packed;
struct wl1271;
int wl1271_event_unmask(struct wl1271 *wl); int wl1271_event_unmask(struct wl1271 *wl);
void wl1271_event_mbox_config(struct wl1271 *wl); void wl1271_event_mbox_config(struct wl1271 *wl);
int wl1271_event_handle(struct wl1271 *wl, u8 mbox); int wl1271_event_handle(struct wl1271 *wl, u8 mbox);
......
...@@ -5375,8 +5375,17 @@ static struct ieee80211_hw *wl1271_alloc_hw(void) ...@@ -5375,8 +5375,17 @@ static struct ieee80211_hw *wl1271_alloc_hw(void)
goto err_dummy_packet; goto err_dummy_packet;
} }
wl->mbox = kmalloc(sizeof(*wl->mbox), GFP_DMA);
if (!wl->mbox) {
ret = -ENOMEM;
goto err_fwlog;
}
return hw; return hw;
err_fwlog:
free_page((unsigned long)wl->fwlog);
err_dummy_packet: err_dummy_packet:
dev_kfree_skb(wl->dummy_packet); dev_kfree_skb(wl->dummy_packet);
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "conf.h" #include "conf.h"
#include "ini.h" #include "ini.h"
#include "event.h"
#define WL127X_FW_NAME_MULTI "ti-connectivity/wl127x-fw-4-mr.bin" #define WL127X_FW_NAME_MULTI "ti-connectivity/wl127x-fw-4-mr.bin"
#define WL127X_FW_NAME_SINGLE "ti-connectivity/wl127x-fw-4-sr.bin" #define WL127X_FW_NAME_SINGLE "ti-connectivity/wl127x-fw-4-sr.bin"
...@@ -416,6 +417,8 @@ struct wl1271 { ...@@ -416,6 +417,8 @@ struct wl1271 {
/* Hardware recovery work */ /* Hardware recovery work */
struct work_struct recovery_work; struct work_struct recovery_work;
struct event_mailbox *mbox;
/* The mbox event mask */ /* The mbox event mask */
u32 event_mask; u32 event_mask;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册