aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAri Kauppi <Ext-Ari.Kauppi@nokia.com>2009-06-12 07:16:13 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:46 -0400
commit6021b2895891b161f73ede9938c101234c63218e (patch)
treea7661342a3f4dd099331949af503b775d63ab69b
parentc518a73e537a2c7b83e490335ddedb6465fa5f73 (diff)
wl12xx: Fix CMD_TEST regression via netlink.
CMD_TEST via netlink API has been broken since e29c3f59cfbc38c3b481a2694b08962da19c4664: cmd and acx interface rework. The user of the interface sends the request in a buffer without the wl12xx_command header but expects the response to have the wl12xx_command header (with id and status). This patch reverts the e29c3f5 commit for cmd.c:wl12xx_cmd_test and implements the needed wrapper functionality in netlink.c. Now the API of wl12xx_cmd_test and rest of wl12xx_cmd_* commands in cmd.c are similar. Signed-off-by: Ari Kauppi <Ext-Ari.Kauppi@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/wl12xx/cmd.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
index d98941a1089..04e8401fcbe 100644
--- a/drivers/net/wireless/wl12xx/cmd.c
+++ b/drivers/net/wireless/wl12xx/cmd.c
@@ -66,38 +66,26 @@ out:
66 * send test command to firmware 66 * send test command to firmware
67 * 67 *
68 * @wl: wl struct 68 * @wl: wl struct
69 * @buf: buffer containing the command, without headers, no dma requirements 69 * @buf: buffer containing the command, with all headers, must work with dma
70 * @len: length of the buffer 70 * @len: length of the buffer
71 * @answer: is answer needed 71 * @answer: is answer needed
72 *
73 * FIXME: cmd_test users need to be converted to the new interface
74 */ 72 */
75int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer) 73int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer)
76{ 74{
77 struct wl12xx_command *cmd;
78 size_t cmd_len;
79 int ret; 75 int ret;
80 76
81 wl12xx_debug(DEBUG_CMD, "cmd test"); 77 wl12xx_debug(DEBUG_CMD, "cmd test");
82 78
83 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 79 ret = wl12xx_cmd_send(wl, CMD_TEST, buf, buf_len);
84 if (!cmd) {
85 ret = -ENOMEM;
86 goto out;
87 }
88
89 memcpy(cmd->parameters, buf, buf_len);
90
91 /* FIXME: ugly */
92 cmd_len = sizeof(struct wl12xx_cmd_header) + buf_len;
93 80
94 ret = wl12xx_cmd_send(wl, CMD_TEST, cmd, cmd_len);
95 if (ret < 0) { 81 if (ret < 0) {
96 wl12xx_warning("TEST command failed"); 82 wl12xx_warning("TEST command failed");
97 goto out; 83 return ret;
98 } 84 }
99 85
100 if (answer) { 86 if (answer) {
87 struct wl12xx_command *cmd_answer;
88
101 /* 89 /*
102 * The test command got in, we can read the answer. 90 * The test command got in, we can read the answer.
103 * The answer would be a wl12xx_command, where the 91 * The answer would be a wl12xx_command, where the
@@ -106,19 +94,18 @@ int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer)
106 94
107 wl12xx_ps_elp_wakeup(wl); 95 wl12xx_ps_elp_wakeup(wl);
108 96
109 wl12xx_spi_mem_read(wl, wl->cmd_box_addr, cmd, cmd_len); 97 wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len);
110 98
111 wl12xx_ps_elp_sleep(wl); 99 wl12xx_ps_elp_sleep(wl);
112 100
113 if (cmd->header.status != CMD_STATUS_SUCCESS) 101 cmd_answer = buf;
102
103 if (cmd_answer->header.status != CMD_STATUS_SUCCESS)
114 wl12xx_error("TEST command answer error: %d", 104 wl12xx_error("TEST command answer error: %d",
115 cmd->header.status); 105 cmd_answer->header.status);
116 memcpy(buf, cmd->parameters, buf_len);
117 } 106 }
118 107
119out: 108 return 0;
120 kfree(cmd);
121 return ret;
122} 109}
123 110
124/** 111/**