Commit edcc3604 authored by Olivier Sobrie's avatar Olivier Sobrie Committed by John W. Linville

libertas: fix errors in functions accessing module registers

Problems located in the two functions lbs_set_reg() and lbs_get_reg():
- The offset field of struct cmd_ds_reg_access was not filled in
- The test on the return code of lbs_cmd_with_response() in function
  lbs_get_reg() was inverted
Signed-off-by: default avatarOlivier Sobrie <olivier@sobrie.be>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6a2a0e73
...@@ -873,6 +873,7 @@ int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value) ...@@ -873,6 +873,7 @@ int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value)
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.hdr.size = cpu_to_le16(sizeof(cmd)); cmd.hdr.size = cpu_to_le16(sizeof(cmd));
cmd.action = cpu_to_le16(CMD_ACT_GET); cmd.action = cpu_to_le16(CMD_ACT_GET);
cmd.offset = cpu_to_le16(offset);
if (reg != CMD_MAC_REG_ACCESS && if (reg != CMD_MAC_REG_ACCESS &&
reg != CMD_BBP_REG_ACCESS && reg != CMD_BBP_REG_ACCESS &&
...@@ -882,7 +883,7 @@ int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value) ...@@ -882,7 +883,7 @@ int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value)
} }
ret = lbs_cmd_with_response(priv, reg, &cmd); ret = lbs_cmd_with_response(priv, reg, &cmd);
if (ret) { if (!ret) {
if (reg == CMD_BBP_REG_ACCESS || reg == CMD_RF_REG_ACCESS) if (reg == CMD_BBP_REG_ACCESS || reg == CMD_RF_REG_ACCESS)
*value = cmd.value.bbp_rf; *value = cmd.value.bbp_rf;
else if (reg == CMD_MAC_REG_ACCESS) else if (reg == CMD_MAC_REG_ACCESS)
...@@ -915,6 +916,7 @@ int lbs_set_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 value) ...@@ -915,6 +916,7 @@ int lbs_set_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 value)
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.hdr.size = cpu_to_le16(sizeof(cmd)); cmd.hdr.size = cpu_to_le16(sizeof(cmd));
cmd.action = cpu_to_le16(CMD_ACT_SET); cmd.action = cpu_to_le16(CMD_ACT_SET);
cmd.offset = cpu_to_le16(offset);
if (reg == CMD_BBP_REG_ACCESS || reg == CMD_RF_REG_ACCESS) if (reg == CMD_BBP_REG_ACCESS || reg == CMD_RF_REG_ACCESS)
cmd.value.bbp_rf = (u8) (value & 0xFF); cmd.value.bbp_rf = (u8) (value & 0xFF);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment