carl9170 firmware: save a few bytes on the command handler
[carl9170fw.git] / carlfw / src / cmd.c
index f5bbad86f8e5393083881f3b5c7f5129c9a56e72..058f9674677752763bd20bb456b119ab6fdaa44a 100644 (file)
@@ -37,9 +37,12 @@ void handle_cmd(struct carl9170_rsp *resp)
        unsigned int i;
 
        /* copies cmd, len and extra fields */
-       resp->hdr.hdr_data = cmd->hdr.hdr_data;
+       resp->hdr.len = cmd->hdr.len;
+       resp->hdr.cmd = cmd->hdr.cmd;
+       resp->hdr.ext = cmd->hdr.ext;
+       resp->hdr.seq |= cmd->hdr.seq;
 
-       switch (cmd->hdr.cmd) {
+       switch (cmd->hdr.cmd & ~CARL9170_CMD_ASYNC_FLAG) {
        case CARL9170_CMD_RREG:
                for (i = 0; i < (cmd->hdr.len / 4); i++)
                        resp->rreg_res.vals[i] = get(cmd->rreg.regs[i]);
@@ -56,7 +59,11 @@ void handle_cmd(struct carl9170_rsp *resp)
                break;
 
        case CARL9170_CMD_SWRST:
-               resp->hdr.len = 0;
+               /*
+                * Command has no payload, so the response
+                * has no payload either.
+                * resp->hdr.len = 0;
+                */
                fw.wlan.mac_reset = CARL9170_MAC_RESET_FORCE;
                break;
 
@@ -103,7 +110,9 @@ void handle_cmd(struct carl9170_rsp *resp)
                break;
 
        case CARL9170_CMD_FREQ_START:
-               resp->hdr.len = 0;
+               /*
+                * resp->hdr.len = 0;
+                */
                rf_notify_set_channel();
                break;