Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a8bdcd71fd33e4a919f9f0cb32207c644b70853f
Commit:     a8bdcd71fd33e4a919f9f0cb32207c644b70853f
Parent:     7ad994dec7d36c319cb35cbf3a920d3bda96e6b0
Author:     Dan Williams <[EMAIL PROTECTED]>
AuthorDate: Tue Dec 11 12:40:35 2007 -0500
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 15:06:41 2008 -0800

    libertas: add simple copyback command callback
    
    A simple callback which copies the response back into the
    command buffer that was used to send the command to the
    card.  Will allow for direct command processing outside
    the mega-switches in cmd.c and cmdresp.c.
    
    Signed-off-by: Dan Williams <[EMAIL PROTECTED]>
    Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 drivers/net/wireless/libertas/cmd.c |   29 ++++++++++++++++++++++++++++-
 drivers/net/wireless/libertas/cmd.h |    7 +++++++
 2 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/libertas/cmd.c 
b/drivers/net/wireless/libertas/cmd.c
index 78870c7..c4b32a0 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1972,6 +1972,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
  *
  *  @param priv        A pointer to struct lbs_private structure
@@ -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 *),
diff --git a/drivers/net/wireless/libertas/cmd.h 
b/drivers/net/wireless/libertas/cmd.h
index 259d3e8..72857a1 100644
--- a/drivers/net/wireless/libertas/cmd.h
+++ b/drivers/net/wireless/libertas/cmd.h
@@ -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 */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to