Commit 985d68a3 authored by Yogesh Ashok Powar's avatar Yogesh Ashok Powar Committed by John W. Linville

mwifiex: rearrange switch statement

Fixing coding style by rearranging the switch statement
Signed-off-by: default avatarYogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3e822635
...@@ -420,38 +420,34 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, ...@@ -420,38 +420,34 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv,
switch (action) { switch (action) {
case HostCmd_ACT_GEN_GET: case HostCmd_ACT_GEN_GET:
{ pg_tlv_hdr = (struct mwifiex_types_power_group *)
pg_tlv_hdr = ((u8 *) txp_cfg +
(struct mwifiex_types_power_group *) ((u8 *) sizeof(struct host_cmd_ds_txpwr_cfg));
txp_cfg +
sizeof pg = (struct mwifiex_power_group *)
(struct ((u8 *) pg_tlv_hdr +
host_cmd_ds_txpwr_cfg)); sizeof(struct mwifiex_types_power_group));
pg = (struct mwifiex_power_group *) ((u8 *)
pg_tlv_hdr + if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING)
sizeof(struct
mwifiex_types_power_group));
if (adapter->hw_status ==
MWIFIEX_HW_STATUS_INITIALIZING)
mwifiex_get_power_level(priv, txp_cfg); mwifiex_get_power_level(priv, txp_cfg);
priv->tx_power_level = (u16) pg->power_min; priv->tx_power_level = (u16) pg->power_min;
break; break;
}
case HostCmd_ACT_GEN_SET: case HostCmd_ACT_GEN_SET:
if (le32_to_cpu(txp_cfg->mode)) { if (!le32_to_cpu(txp_cfg->mode))
pg_tlv_hdr = break;
(struct mwifiex_types_power_group *) ((u8 *)
txp_cfg + pg_tlv_hdr = (struct mwifiex_types_power_group *)
sizeof ((u8 *) txp_cfg +
(struct sizeof(struct host_cmd_ds_txpwr_cfg));
host_cmd_ds_txpwr_cfg));
pg = (struct mwifiex_power_group *) ((u8 *) pg_tlv_hdr pg = (struct mwifiex_power_group *)
+ ((u8 *) pg_tlv_hdr +
sizeof(struct sizeof(struct mwifiex_types_power_group));
mwifiex_types_power_group));
if (pg->power_max == pg->power_min) if (pg->power_max == pg->power_min)
priv->tx_power_level = (u16) pg->power_min; priv->tx_power_level = (u16) pg->power_min;
}
break; break;
default: default:
dev_err(adapter->dev, "CMD_RESP: unknown cmd action %d\n", dev_err(adapter->dev, "CMD_RESP: unknown cmd action %d\n",
...@@ -679,91 +675,71 @@ static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp, ...@@ -679,91 +675,71 @@ static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp,
{ {
struct mwifiex_ds_reg_rw *reg_rw; struct mwifiex_ds_reg_rw *reg_rw;
struct mwifiex_ds_read_eeprom *eeprom; struct mwifiex_ds_read_eeprom *eeprom;
union reg {
struct host_cmd_ds_mac_reg_access *mac;
struct host_cmd_ds_bbp_reg_access *bbp;
struct host_cmd_ds_rf_reg_access *rf;
struct host_cmd_ds_pmic_reg_access *pmic;
struct host_cmd_ds_802_11_eeprom_access *eeprom;
} r;
if (!data_buf)
return 0;
if (data_buf) {
reg_rw = data_buf; reg_rw = data_buf;
eeprom = data_buf; eeprom = data_buf;
switch (type) { switch (type) {
case HostCmd_CMD_MAC_REG_ACCESS: case HostCmd_CMD_MAC_REG_ACCESS:
{ r.mac = (struct host_cmd_ds_mac_reg_access *)
struct host_cmd_ds_mac_reg_access *reg;
reg = (struct host_cmd_ds_mac_reg_access *)
&resp->params.mac_reg; &resp->params.mac_reg;
reg_rw->offset = cpu_to_le32( reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.mac->offset));
(u32) le16_to_cpu(reg->offset)); reg_rw->value = r.mac->value;
reg_rw->value = reg->value;
break; break;
}
case HostCmd_CMD_BBP_REG_ACCESS: case HostCmd_CMD_BBP_REG_ACCESS:
{ r.bbp = (struct host_cmd_ds_bbp_reg_access *)
struct host_cmd_ds_bbp_reg_access *reg;
reg = (struct host_cmd_ds_bbp_reg_access *)
&resp->params.bbp_reg; &resp->params.bbp_reg;
reg_rw->offset = cpu_to_le32( reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.bbp->offset));
(u32) le16_to_cpu(reg->offset)); reg_rw->value = cpu_to_le32((u32) r.bbp->value);
reg_rw->value = cpu_to_le32((u32) reg->value);
break; break;
}
case HostCmd_CMD_RF_REG_ACCESS: case HostCmd_CMD_RF_REG_ACCESS:
{ r.rf = (struct host_cmd_ds_rf_reg_access *)
struct host_cmd_ds_rf_reg_access *reg;
reg = (struct host_cmd_ds_rf_reg_access *)
&resp->params.rf_reg; &resp->params.rf_reg;
reg_rw->offset = cpu_to_le32( reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
(u32) le16_to_cpu(reg->offset)); reg_rw->value = cpu_to_le32((u32) r.bbp->value);
reg_rw->value = cpu_to_le32((u32) reg->value);
break; break;
}
case HostCmd_CMD_PMIC_REG_ACCESS: case HostCmd_CMD_PMIC_REG_ACCESS:
{ r.pmic = (struct host_cmd_ds_pmic_reg_access *)
struct host_cmd_ds_pmic_reg_access *reg;
reg = (struct host_cmd_ds_pmic_reg_access *)
&resp->params.pmic_reg; &resp->params.pmic_reg;
reg_rw->offset = cpu_to_le32( reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.pmic->offset));
(u32) le16_to_cpu(reg->offset)); reg_rw->value = cpu_to_le32((u32) r.pmic->value);
reg_rw->value = cpu_to_le32((u32) reg->value);
break; break;
}
case HostCmd_CMD_CAU_REG_ACCESS: case HostCmd_CMD_CAU_REG_ACCESS:
{ r.rf = (struct host_cmd_ds_rf_reg_access *)
struct host_cmd_ds_rf_reg_access *reg;
reg = (struct host_cmd_ds_rf_reg_access *)
&resp->params.rf_reg; &resp->params.rf_reg;
reg_rw->offset = cpu_to_le32( reg_rw->offset = cpu_to_le32((u32) le16_to_cpu(r.rf->offset));
(u32) le16_to_cpu(reg->offset)); reg_rw->value = cpu_to_le32((u32) r.rf->value);
reg_rw->value = cpu_to_le32((u32) reg->value);
break; break;
}
case HostCmd_CMD_802_11_EEPROM_ACCESS: case HostCmd_CMD_802_11_EEPROM_ACCESS:
{ r.eeprom = (struct host_cmd_ds_802_11_eeprom_access *)
struct host_cmd_ds_802_11_eeprom_access &resp->params.eeprom;
*cmd_eeprom = pr_debug("info: EEPROM read len=%x\n", r.eeprom->byte_count);
(struct host_cmd_ds_802_11_eeprom_access
*) &resp->params.eeprom;
pr_debug("info: EEPROM read len=%x\n",
cmd_eeprom->byte_count);
if (le16_to_cpu(eeprom->byte_count) < if (le16_to_cpu(eeprom->byte_count) <
le16_to_cpu( le16_to_cpu(r.eeprom->byte_count)) {
cmd_eeprom->byte_count)) {
eeprom->byte_count = cpu_to_le16(0); eeprom->byte_count = cpu_to_le16(0);
pr_debug("info: EEPROM read " pr_debug("info: EEPROM read length is too big\n");
"length is too big\n");
return -1; return -1;
} }
eeprom->offset = cmd_eeprom->offset; eeprom->offset = r.eeprom->offset;
eeprom->byte_count = cmd_eeprom->byte_count; eeprom->byte_count = r.eeprom->byte_count;
if (le16_to_cpu(eeprom->byte_count) > 0) if (le16_to_cpu(eeprom->byte_count) > 0)
memcpy(&eeprom->value, memcpy(&eeprom->value, &r.eeprom->value,
&cmd_eeprom->value, le16_to_cpu(r.eeprom->byte_count));
le16_to_cpu(eeprom->byte_count));
break; break;
}
default: default:
return -1; return -1;
} }
}
return 0; return 0;
} }
......
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