Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79161
b: refs/heads/master
c: a8bdcd7
h: refs/heads/master
i:
  79159: a472d37
v: v3
  • Loading branch information
Dan Williams authored and David S. Miller committed Jan 28, 2008
1 parent db896d4 commit ddbb706
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 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: 7ad994dec7d36c319cb35cbf3a920d3bda96e6b0
refs/heads/master: a8bdcd71fd33e4a919f9f0cb32207c644b70853f
29 changes: 28 additions & 1 deletion trunk/drivers/net/wireless/libertas/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,34 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode)
}


/**
* @brief Simple callback that copies response back into command
*
* @param priv A pointer to struct lbs_private structure
* @param extra A pointer to the original command structure for which
* 'resp' is a response
* @param resp A pointer to the command response
*
* @return 0 on success, error on failure
*/
int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
struct cmd_header *resp)
{
struct cmd_header *buf = (void *)extra;
uint16_t copy_len;

lbs_deb_enter(LBS_DEB_CMD);

copy_len = min(le16_to_cpu(buf->size), le16_to_cpu(resp->size));
lbs_deb_cmd("Copying back %u bytes; command response was %u bytes, "
"copy back buffer was %u bytes", copy_len, resp->size,
buf->size);
memcpy(buf, resp, copy_len);

lbs_deb_leave(LBS_DEB_CMD);
return 0;
}

/**
* @brief Simple way to call firmware functions
*
Expand All @@ -1987,7 +2015,6 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv, u16 psmode)
* @return -1 in case of a higher level error, otherwise
* the result code from the firmware
*/

int __lbs_cmd(struct lbs_private *priv, uint16_t command,
struct cmd_header *in_cmd, int in_cmd_size,
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/net/wireless/libertas/cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@
__lbs_cmd(priv, cmdnr, (struct cmd_header *) &cmd, sizeof(cmd), \
callback, callback_arg)

#define lbs_cmd_with_response(priv, cmdnr, cmd) \
__lbs_cmd(priv, cmdnr, (struct cmd_header *) &cmd, sizeof(cmd), \
lbs_cmd_copyback, (unsigned long) &cmd)

int __lbs_cmd(struct lbs_private *priv, uint16_t command,
struct cmd_header *in_cmd, int in_cmd_size,
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
unsigned long callback_arg);

int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
struct cmd_header *resp);

#endif /* _LBS_CMD_H */

0 comments on commit ddbb706

Please sign in to comment.