Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158805
b: refs/heads/master
c: 6021b28
h: refs/heads/master
i:
  158803: 4b9bdcd
v: v3
  • Loading branch information
Ari Kauppi authored and John W. Linville committed Jul 10, 2009
1 parent feb0422 commit fb2b885
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c518a73e537a2c7b83e490335ddedb6465fa5f73
refs/heads/master: 6021b2895891b161f73ede9938c101234c63218e
35 changes: 11 additions & 24 deletions trunk/drivers/net/wireless/wl12xx/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,38 +66,26 @@ int wl12xx_cmd_send(struct wl12xx *wl, u16 id, void *buf, size_t len)
* send test command to firmware
*
* @wl: wl struct
* @buf: buffer containing the command, without headers, no dma requirements
* @buf: buffer containing the command, with all headers, must work with dma
* @len: length of the buffer
* @answer: is answer needed
*
* FIXME: cmd_test users need to be converted to the new interface
*/
int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer)
{
struct wl12xx_command *cmd;
size_t cmd_len;
int ret;

wl12xx_debug(DEBUG_CMD, "cmd test");

cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd) {
ret = -ENOMEM;
goto out;
}

memcpy(cmd->parameters, buf, buf_len);

/* FIXME: ugly */
cmd_len = sizeof(struct wl12xx_cmd_header) + buf_len;
ret = wl12xx_cmd_send(wl, CMD_TEST, buf, buf_len);

ret = wl12xx_cmd_send(wl, CMD_TEST, cmd, cmd_len);
if (ret < 0) {
wl12xx_warning("TEST command failed");
goto out;
return ret;
}

if (answer) {
struct wl12xx_command *cmd_answer;

/*
* The test command got in, we can read the answer.
* The answer would be a wl12xx_command, where the
Expand All @@ -106,19 +94,18 @@ int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer)

wl12xx_ps_elp_wakeup(wl);

wl12xx_spi_mem_read(wl, wl->cmd_box_addr, cmd, cmd_len);
wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len);

wl12xx_ps_elp_sleep(wl);

if (cmd->header.status != CMD_STATUS_SUCCESS)
cmd_answer = buf;

if (cmd_answer->header.status != CMD_STATUS_SUCCESS)
wl12xx_error("TEST command answer error: %d",
cmd->header.status);
memcpy(buf, cmd->parameters, buf_len);
cmd_answer->header.status);
}

out:
kfree(cmd);
return ret;
return 0;
}

/**
Expand Down

0 comments on commit fb2b885

Please sign in to comment.