RE: [PATCH v3] mwifiex: Reduce endian conversion for REG Host Commands
Hi Prasun, > From: Prasun Maiti [mailto:prasunmait...@gmail.com] > Sent: Thursday, June 23, 2016 10:59 AM > To: Amitkumar Karwar > Cc: Nishant Sarmukadam; Linux Wireless; Linux Next; Linux Kernel; Kalle > Valo > Subject: [PATCH v3] mwifiex: Reduce endian conversion for REG Host > Commands > > For multiple REG Host Commands (e.g HostCmd_CMD_802_11_EEPROM_ACCESS, > HostCmd_CMD_MAC_REG_ACCESS etc.) "cpu_to_leX"-converted values are saved > to driver. So, "leX_to_cpu" conversion is required too many times > afterwards in driver. > > This patch reduces the endian: conversion without saving "cpu_to_leX" > converted values in driver. This will convert endianness in prepare > command and command response path. > > Signed-off-by: Prasun Maiti> --- > Changes in v3: > - Fixed the following warnings: > * sta_ioctl.c:1339:34: warning: comparison of distinct pointer > types lacks a cast [enabled by default] > * sta_cmdresp.c:821:6: warning: comparison of distinct pointer > types lacks a cast [enabled by default] > > drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 28 +++ > - > drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 37 +++ > --- > drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 21 ++-- > 3 files changed, 41 insertions(+), 45 deletions(-) > > diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c > b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c > index e436574..9df02ba 100644 > --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c > +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c > @@ -1130,9 +1130,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > cmd->size = cpu_to_le16(sizeof(*mac_reg) + S_DS_GEN); > mac_reg = >params.mac_reg; > mac_reg->action = cpu_to_le16(cmd_action); > - mac_reg->offset = > - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); > - mac_reg->value = reg_rw->value; > + mac_reg->offset = cpu_to_le16((u16) reg_rw->offset); > + mac_reg->value = cpu_to_le32(reg_rw->value); > break; > } > case HostCmd_CMD_BBP_REG_ACCESS: > @@ -1142,9 +1141,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > cmd->size = cpu_to_le16(sizeof(*bbp_reg) + S_DS_GEN); > bbp_reg = >params.bbp_reg; > bbp_reg->action = cpu_to_le16(cmd_action); > - bbp_reg->offset = > - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); > - bbp_reg->value = (u8) le32_to_cpu(reg_rw->value); > + bbp_reg->offset = cpu_to_le16((u16) reg_rw->offset); > + bbp_reg->value = (u8) reg_rw->value; > break; > } > case HostCmd_CMD_RF_REG_ACCESS: > @@ -1154,8 +1152,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > cmd->size = cpu_to_le16(sizeof(*rf_reg) + S_DS_GEN); > rf_reg = >params.rf_reg; > rf_reg->action = cpu_to_le16(cmd_action); > - rf_reg->offset = cpu_to_le16((u16) le32_to_cpu(reg_rw- > >offset)); > - rf_reg->value = (u8) le32_to_cpu(reg_rw->value); > + rf_reg->offset = cpu_to_le16((u16) reg_rw->offset); > + rf_reg->value = (u8) reg_rw->value; > break; > } > case HostCmd_CMD_PMIC_REG_ACCESS: > @@ -1165,9 +1163,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > cmd->size = cpu_to_le16(sizeof(*pmic_reg) + S_DS_GEN); > pmic_reg = >params.pmic_reg; > pmic_reg->action = cpu_to_le16(cmd_action); > - pmic_reg->offset = > - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); > - pmic_reg->value = (u8) le32_to_cpu(reg_rw->value); > + pmic_reg->offset = cpu_to_le16((u16) reg_rw->offset); > + pmic_reg->value = (u8) reg_rw->value; > break; > } > case HostCmd_CMD_CAU_REG_ACCESS: > @@ -1177,9 +1174,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > cmd->size = cpu_to_le16(sizeof(*cau_reg) + S_DS_GEN); > cau_reg = >params.rf_reg; > cau_reg->action = cpu_to_le16(cmd_action); > - cau_reg->offset = > - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); > - cau_reg->value = (u8) le32_to_cpu(reg_rw->value); > + cau_reg->offset = cpu_to_le16((u16) reg_rw->offset); > + cau_reg->value = (u8) reg_rw->value; > break; > } > case HostCmd_CMD_802_11_EEPROM_ACCESS: > @@ -1190,8 +1186,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > > cmd->size = cpu_to_le16(sizeof(*cmd_eeprom) + S_DS_GEN); > cmd_eeprom->action =
RE: [PATCH v3] mwifiex: Reduce endian conversion for REG Host Commands
Hi Prasun, > From: Prasun Maiti [mailto:prasunmait...@gmail.com] > Sent: Thursday, June 23, 2016 10:59 AM > To: Amitkumar Karwar > Cc: Nishant Sarmukadam; Linux Wireless; Linux Next; Linux Kernel; Kalle > Valo > Subject: [PATCH v3] mwifiex: Reduce endian conversion for REG Host > Commands > > For multiple REG Host Commands (e.g HostCmd_CMD_802_11_EEPROM_ACCESS, > HostCmd_CMD_MAC_REG_ACCESS etc.) "cpu_to_leX"-converted values are saved > to driver. So, "leX_to_cpu" conversion is required too many times > afterwards in driver. > > This patch reduces the endian: conversion without saving "cpu_to_leX" > converted values in driver. This will convert endianness in prepare > command and command response path. > > Signed-off-by: Prasun Maiti > --- > Changes in v3: > - Fixed the following warnings: > * sta_ioctl.c:1339:34: warning: comparison of distinct pointer > types lacks a cast [enabled by default] > * sta_cmdresp.c:821:6: warning: comparison of distinct pointer > types lacks a cast [enabled by default] > > drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 28 +++ > - > drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c | 37 +++ > --- > drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 21 ++-- > 3 files changed, 41 insertions(+), 45 deletions(-) > > diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c > b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c > index e436574..9df02ba 100644 > --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c > +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c > @@ -1130,9 +1130,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > cmd->size = cpu_to_le16(sizeof(*mac_reg) + S_DS_GEN); > mac_reg = >params.mac_reg; > mac_reg->action = cpu_to_le16(cmd_action); > - mac_reg->offset = > - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); > - mac_reg->value = reg_rw->value; > + mac_reg->offset = cpu_to_le16((u16) reg_rw->offset); > + mac_reg->value = cpu_to_le32(reg_rw->value); > break; > } > case HostCmd_CMD_BBP_REG_ACCESS: > @@ -1142,9 +1141,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > cmd->size = cpu_to_le16(sizeof(*bbp_reg) + S_DS_GEN); > bbp_reg = >params.bbp_reg; > bbp_reg->action = cpu_to_le16(cmd_action); > - bbp_reg->offset = > - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); > - bbp_reg->value = (u8) le32_to_cpu(reg_rw->value); > + bbp_reg->offset = cpu_to_le16((u16) reg_rw->offset); > + bbp_reg->value = (u8) reg_rw->value; > break; > } > case HostCmd_CMD_RF_REG_ACCESS: > @@ -1154,8 +1152,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > cmd->size = cpu_to_le16(sizeof(*rf_reg) + S_DS_GEN); > rf_reg = >params.rf_reg; > rf_reg->action = cpu_to_le16(cmd_action); > - rf_reg->offset = cpu_to_le16((u16) le32_to_cpu(reg_rw- > >offset)); > - rf_reg->value = (u8) le32_to_cpu(reg_rw->value); > + rf_reg->offset = cpu_to_le16((u16) reg_rw->offset); > + rf_reg->value = (u8) reg_rw->value; > break; > } > case HostCmd_CMD_PMIC_REG_ACCESS: > @@ -1165,9 +1163,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > cmd->size = cpu_to_le16(sizeof(*pmic_reg) + S_DS_GEN); > pmic_reg = >params.pmic_reg; > pmic_reg->action = cpu_to_le16(cmd_action); > - pmic_reg->offset = > - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); > - pmic_reg->value = (u8) le32_to_cpu(reg_rw->value); > + pmic_reg->offset = cpu_to_le16((u16) reg_rw->offset); > + pmic_reg->value = (u8) reg_rw->value; > break; > } > case HostCmd_CMD_CAU_REG_ACCESS: > @@ -1177,9 +1174,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > cmd->size = cpu_to_le16(sizeof(*cau_reg) + S_DS_GEN); > cau_reg = >params.rf_reg; > cau_reg->action = cpu_to_le16(cmd_action); > - cau_reg->offset = > - cpu_to_le16((u16) le32_to_cpu(reg_rw->offset)); > - cau_reg->value = (u8) le32_to_cpu(reg_rw->value); > + cau_reg->offset = cpu_to_le16((u16) reg_rw->offset); > + cau_reg->value = (u8) reg_rw->value; > break; > } > case HostCmd_CMD_802_11_EEPROM_ACCESS: > @@ -1190,8 +1186,8 @@ static int mwifiex_cmd_reg_access(struct > host_cmd_ds_command *cmd, > > cmd->size = cpu_to_le16(sizeof(*cmd_eeprom) + S_DS_GEN); > cmd_eeprom->action = cpu_to_le16(cmd_action); > -