From bf2b593550b7d6c7dc8b0920af937c51fefd9c08 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 19 Dec 2007 13:03:19 +0000 Subject: [PATCH] --- yaml --- r: 79255 b: refs/heads/master c: f15ebb63b36eca5fa68fabd04ab2f7840bc67205 h: refs/heads/master i: 79253: 7e9220a3e90f2b3aff16f13c6a829c0bfc372741 79251: e6032eb6a980ee903eabcd07b0592303c68afa2d 79247: 2f4ab4e34f2586a1a2583145814fa6f56a7d1530 v: v3 --- [refs] | 2 +- trunk/drivers/net/wireless/libertas/cmd.h | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index baa99e4d66ac..f9eb83547d50 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4f59abf190b15350167bec5382dda205030ac9d0 +refs/heads/master: f15ebb63b36eca5fa68fabd04ab2f7840bc67205 diff --git a/trunk/drivers/net/wireless/libertas/cmd.h b/trunk/drivers/net/wireless/libertas/cmd.h index 6efb81ec597e..b9ab85cc7913 100644 --- a/trunk/drivers/net/wireless/libertas/cmd.h +++ b/trunk/drivers/net/wireless/libertas/cmd.h @@ -6,13 +6,15 @@ #include "hostcmd.h" #include "dev.h" -#define lbs_cmd(priv, cmdnr, cmd, cb, cb_arg) \ - __lbs_cmd(priv, cmdnr, &(cmd)->hdr, sizeof(*(cmd)), cb, cb_arg) +/* lbs_cmd() infers the size of the buffer to copy data back into, from + the size of the target of the pointer. Since the command to be sent + may often be smaller, that size is set in cmd->size by the caller.*/ +#define lbs_cmd(priv, cmdnr, cmd, cb, cb_arg) ({ \ + uint16_t __sz = le16_to_cpu((cmd)->hdr.size); \ + (cmd)->hdr.size = cpu_to_le16(sizeof(*(cmd))); \ + __lbs_cmd(priv, cmdnr, &(cmd)->hdr, __sz, cb, cb_arg); \ +}) - -/* lbs_cmd_with_response() infers the size of the command to be _sent_ - and requires that the caller sets cmd->size to the (LE) size of - the _response_ buffer. */ #define lbs_cmd_with_response(priv, cmdnr, cmd) \ lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd))