Message ID | 20241101104416.4954-2-victorshihgli@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [V1] mmc: sd_uhs2: correction of incorrect type in assignment | expand |
On Fri, 1 Nov 2024 at 11:44, Victor Shih <victorshihgli@gmail.com> wrote: > > From: Victor Shih <victor.shih@genesyslogic.com.tw> > > There is a type issue in assignment in the sd_uhs2_dev_init(), > sd_uhs2_enum() and sd_uhs2_config_write() that will generate > a warnin when building the kernel. > > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202410260423.15jvE6qc-lkp@intel.com/ > Closes: https://lore.kernel.org/oe-kbuild-all/202410261827.7h8YK8u2-lkp@intel.com/ > Suggested-by: Adrian Hunter <adrian.hunter@intel.com> > Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw> > Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw> Applied for next, thanks! Kind regards Uffe > --- > drivers/mmc/core/sd_uhs2.c | 56 ++++++++++++++++++++------------------ > 1 file changed, 29 insertions(+), 27 deletions(-) > > diff --git a/drivers/mmc/core/sd_uhs2.c b/drivers/mmc/core/sd_uhs2.c > index ddd2291ad7c4..0611db848c23 100644 > --- a/drivers/mmc/core/sd_uhs2.c > +++ b/drivers/mmc/core/sd_uhs2.c > @@ -144,6 +144,7 @@ static int sd_uhs2_dev_init(struct mmc_host *host) > struct uhs2_command uhs2_cmd = {}; > u32 cnt; > u32 dap, gap, resp_gap; > + u32 payload0; > u8 gd = 0; > int err; > > @@ -180,10 +181,11 @@ static int sd_uhs2_dev_init(struct mmc_host *host) > * Let's retry the DEVICE_INIT command no more than 30 times. > */ > for (cnt = 0; cnt < 30; cnt++) { > - uhs2_cmd.payload[0] = ((dap & 0xF) << 12) | > - UHS2_DEV_INIT_COMPLETE_FLAG | > - ((gd & 0xF) << 4) | > - (gap & 0xF); > + payload0 = ((dap & 0xF) << 12) | > + UHS2_DEV_INIT_COMPLETE_FLAG | > + ((gd & 0xF) << 4) | > + (gap & 0xF); > + uhs2_cmd.payload[0] = payload0; > > sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_DEV_INIT_PAYLOAD_LEN, > UHS2_DEV_INIT_RESP_LEN); > @@ -229,6 +231,7 @@ static int sd_uhs2_enum(struct mmc_host *host, u32 *node_id) > { > struct mmc_command cmd = {0}; > struct uhs2_command uhs2_cmd = {}; > + u32 payload0; > u8 id_f = 0xF, id_l = 0x0; > int err; > > @@ -247,8 +250,8 @@ static int sd_uhs2_enum(struct mmc_host *host, u32 *node_id) > UHS2_NATIVE_CMD_PLEN_4B | > (UHS2_DEV_CMD_ENUMERATE >> 8); > > - uhs2_cmd.payload[0] = (id_f << 4) | id_l; > - uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]); > + payload0 = (id_f << 4) | id_l; > + uhs2_cmd.payload[0] = cpu_to_be32(payload0); > > sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_DEV_ENUM_PAYLOAD_LEN, UHS2_DEV_ENUM_RESP_LEN); > > @@ -469,6 +472,7 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) > { > struct mmc_command cmd = {0}; > struct uhs2_command uhs2_cmd = {}; > + u32 payload0, payload1; > u8 nMinDataGap; > int err; > > @@ -491,10 +495,10 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) > host->uhs2_caps.n_lanes_set = UHS2_DEV_CONFIG_GEN_SET_2L_FD_HD; > card->uhs2_config.n_lanes_set = UHS2_DEV_CONFIG_GEN_SET_2L_FD_HD; > > - uhs2_cmd.payload[0] = card->uhs2_config.n_lanes_set << UHS2_DEV_CONFIG_N_LANES_POS; > - uhs2_cmd.payload[1] = 0; > - uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]); > - uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]); > + payload0 = card->uhs2_config.n_lanes_set << UHS2_DEV_CONFIG_N_LANES_POS; > + payload1 = 0; > + uhs2_cmd.payload[0] = cpu_to_be32(payload0); > + uhs2_cmd.payload[1] = cpu_to_be32(payload1); > > /* > * There is no payload because per spec, there should be > @@ -549,8 +553,7 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) > card->uhs2_config.speed_range_set = UHS2_DEV_CONFIG_PHY_SET_SPEED_A; > } > > - uhs2_cmd.payload[0] = > - card->uhs2_config.speed_range_set << UHS2_DEV_CONFIG_PHY_SET_SPEED_POS; > + payload0 = card->uhs2_config.speed_range_set << UHS2_DEV_CONFIG_PHY_SET_SPEED_POS; > > card->uhs2_config.n_lss_sync_set = (max(card->uhs2_config.n_lss_sync, > host->uhs2_caps.n_lss_sync) >> 2) & > @@ -562,10 +565,10 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) > UHS2_DEV_CONFIG_N_LSS_DIR_MASK; > host->uhs2_caps.n_lss_dir_set = card->uhs2_config.n_lss_dir_set; > > - uhs2_cmd.payload[1] = (card->uhs2_config.n_lss_dir_set << UHS2_DEV_CONFIG_N_LSS_DIR_POS) | > - card->uhs2_config.n_lss_sync_set; > - uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]); > - uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]); > + payload1 = (card->uhs2_config.n_lss_dir_set << UHS2_DEV_CONFIG_N_LSS_DIR_POS) | > + card->uhs2_config.n_lss_sync_set; > + uhs2_cmd.payload[0] = cpu_to_be32(payload0); > + uhs2_cmd.payload[1] = cpu_to_be32(payload1); > > memset(uhs2_cmd.uhs2_resp, 0, sizeof(uhs2_cmd.uhs2_resp)); > > @@ -612,13 +615,12 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) > host->uhs2_caps.max_retry_set = 3; > card->uhs2_config.max_retry_set = host->uhs2_caps.max_retry_set; > > - uhs2_cmd.payload[0] = > - (card->uhs2_config.maxblk_len_set << UHS2_DEV_CONFIG_MAX_BLK_LEN_POS) | > - (card->uhs2_config.max_retry_set << UHS2_DEV_CONFIG_LT_SET_MAX_RETRY_POS) | > - (card->uhs2_config.n_fcu_set << UHS2_DEV_CONFIG_N_FCU_POS); > - uhs2_cmd.payload[1] = card->uhs2_config.n_data_gap_set; > - uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]); > - uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]); > + payload0 = (card->uhs2_config.maxblk_len_set << UHS2_DEV_CONFIG_MAX_BLK_LEN_POS) | > + (card->uhs2_config.max_retry_set << UHS2_DEV_CONFIG_LT_SET_MAX_RETRY_POS) | > + (card->uhs2_config.n_fcu_set << UHS2_DEV_CONFIG_N_FCU_POS); > + payload1 = card->uhs2_config.n_data_gap_set; > + uhs2_cmd.payload[0] = cpu_to_be32(payload0); > + uhs2_cmd.payload[1] = cpu_to_be32(payload1); > > sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_CFG_WRITE_PAYLOAD_LEN, 0); > > @@ -645,10 +647,10 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) > UHS2_NATIVE_CMD_PLEN_8B | > (UHS2_DEV_CONFIG_GEN_SET >> 8); > > - uhs2_cmd.payload[0] = 0; > - uhs2_cmd.payload[1] = UHS2_DEV_CONFIG_GEN_SET_CFG_COMPLETE; > - uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]); > - uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]); > + payload0 = 0; > + payload1 = UHS2_DEV_CONFIG_GEN_SET_CFG_COMPLETE; > + uhs2_cmd.payload[0] = cpu_to_be32(payload0); > + uhs2_cmd.payload[1] = cpu_to_be32(payload1); > > memset(uhs2_cmd.uhs2_resp, 0, sizeof(uhs2_cmd.uhs2_resp)); > sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_CFG_WRITE_PAYLOAD_LEN, > -- > 2.25.1 >
diff --git a/drivers/mmc/core/sd_uhs2.c b/drivers/mmc/core/sd_uhs2.c index ddd2291ad7c4..0611db848c23 100644 --- a/drivers/mmc/core/sd_uhs2.c +++ b/drivers/mmc/core/sd_uhs2.c @@ -144,6 +144,7 @@ static int sd_uhs2_dev_init(struct mmc_host *host) struct uhs2_command uhs2_cmd = {}; u32 cnt; u32 dap, gap, resp_gap; + u32 payload0; u8 gd = 0; int err; @@ -180,10 +181,11 @@ static int sd_uhs2_dev_init(struct mmc_host *host) * Let's retry the DEVICE_INIT command no more than 30 times. */ for (cnt = 0; cnt < 30; cnt++) { - uhs2_cmd.payload[0] = ((dap & 0xF) << 12) | - UHS2_DEV_INIT_COMPLETE_FLAG | - ((gd & 0xF) << 4) | - (gap & 0xF); + payload0 = ((dap & 0xF) << 12) | + UHS2_DEV_INIT_COMPLETE_FLAG | + ((gd & 0xF) << 4) | + (gap & 0xF); + uhs2_cmd.payload[0] = payload0; sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_DEV_INIT_PAYLOAD_LEN, UHS2_DEV_INIT_RESP_LEN); @@ -229,6 +231,7 @@ static int sd_uhs2_enum(struct mmc_host *host, u32 *node_id) { struct mmc_command cmd = {0}; struct uhs2_command uhs2_cmd = {}; + u32 payload0; u8 id_f = 0xF, id_l = 0x0; int err; @@ -247,8 +250,8 @@ static int sd_uhs2_enum(struct mmc_host *host, u32 *node_id) UHS2_NATIVE_CMD_PLEN_4B | (UHS2_DEV_CMD_ENUMERATE >> 8); - uhs2_cmd.payload[0] = (id_f << 4) | id_l; - uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]); + payload0 = (id_f << 4) | id_l; + uhs2_cmd.payload[0] = cpu_to_be32(payload0); sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_DEV_ENUM_PAYLOAD_LEN, UHS2_DEV_ENUM_RESP_LEN); @@ -469,6 +472,7 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) { struct mmc_command cmd = {0}; struct uhs2_command uhs2_cmd = {}; + u32 payload0, payload1; u8 nMinDataGap; int err; @@ -491,10 +495,10 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) host->uhs2_caps.n_lanes_set = UHS2_DEV_CONFIG_GEN_SET_2L_FD_HD; card->uhs2_config.n_lanes_set = UHS2_DEV_CONFIG_GEN_SET_2L_FD_HD; - uhs2_cmd.payload[0] = card->uhs2_config.n_lanes_set << UHS2_DEV_CONFIG_N_LANES_POS; - uhs2_cmd.payload[1] = 0; - uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]); - uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]); + payload0 = card->uhs2_config.n_lanes_set << UHS2_DEV_CONFIG_N_LANES_POS; + payload1 = 0; + uhs2_cmd.payload[0] = cpu_to_be32(payload0); + uhs2_cmd.payload[1] = cpu_to_be32(payload1); /* * There is no payload because per spec, there should be @@ -549,8 +553,7 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) card->uhs2_config.speed_range_set = UHS2_DEV_CONFIG_PHY_SET_SPEED_A; } - uhs2_cmd.payload[0] = - card->uhs2_config.speed_range_set << UHS2_DEV_CONFIG_PHY_SET_SPEED_POS; + payload0 = card->uhs2_config.speed_range_set << UHS2_DEV_CONFIG_PHY_SET_SPEED_POS; card->uhs2_config.n_lss_sync_set = (max(card->uhs2_config.n_lss_sync, host->uhs2_caps.n_lss_sync) >> 2) & @@ -562,10 +565,10 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) UHS2_DEV_CONFIG_N_LSS_DIR_MASK; host->uhs2_caps.n_lss_dir_set = card->uhs2_config.n_lss_dir_set; - uhs2_cmd.payload[1] = (card->uhs2_config.n_lss_dir_set << UHS2_DEV_CONFIG_N_LSS_DIR_POS) | - card->uhs2_config.n_lss_sync_set; - uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]); - uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]); + payload1 = (card->uhs2_config.n_lss_dir_set << UHS2_DEV_CONFIG_N_LSS_DIR_POS) | + card->uhs2_config.n_lss_sync_set; + uhs2_cmd.payload[0] = cpu_to_be32(payload0); + uhs2_cmd.payload[1] = cpu_to_be32(payload1); memset(uhs2_cmd.uhs2_resp, 0, sizeof(uhs2_cmd.uhs2_resp)); @@ -612,13 +615,12 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) host->uhs2_caps.max_retry_set = 3; card->uhs2_config.max_retry_set = host->uhs2_caps.max_retry_set; - uhs2_cmd.payload[0] = - (card->uhs2_config.maxblk_len_set << UHS2_DEV_CONFIG_MAX_BLK_LEN_POS) | - (card->uhs2_config.max_retry_set << UHS2_DEV_CONFIG_LT_SET_MAX_RETRY_POS) | - (card->uhs2_config.n_fcu_set << UHS2_DEV_CONFIG_N_FCU_POS); - uhs2_cmd.payload[1] = card->uhs2_config.n_data_gap_set; - uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]); - uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]); + payload0 = (card->uhs2_config.maxblk_len_set << UHS2_DEV_CONFIG_MAX_BLK_LEN_POS) | + (card->uhs2_config.max_retry_set << UHS2_DEV_CONFIG_LT_SET_MAX_RETRY_POS) | + (card->uhs2_config.n_fcu_set << UHS2_DEV_CONFIG_N_FCU_POS); + payload1 = card->uhs2_config.n_data_gap_set; + uhs2_cmd.payload[0] = cpu_to_be32(payload0); + uhs2_cmd.payload[1] = cpu_to_be32(payload1); sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_CFG_WRITE_PAYLOAD_LEN, 0); @@ -645,10 +647,10 @@ static int sd_uhs2_config_write(struct mmc_host *host, struct mmc_card *card) UHS2_NATIVE_CMD_PLEN_8B | (UHS2_DEV_CONFIG_GEN_SET >> 8); - uhs2_cmd.payload[0] = 0; - uhs2_cmd.payload[1] = UHS2_DEV_CONFIG_GEN_SET_CFG_COMPLETE; - uhs2_cmd.payload[0] = cpu_to_be32(uhs2_cmd.payload[0]); - uhs2_cmd.payload[1] = cpu_to_be32(uhs2_cmd.payload[1]); + payload0 = 0; + payload1 = UHS2_DEV_CONFIG_GEN_SET_CFG_COMPLETE; + uhs2_cmd.payload[0] = cpu_to_be32(payload0); + uhs2_cmd.payload[1] = cpu_to_be32(payload1); memset(uhs2_cmd.uhs2_resp, 0, sizeof(uhs2_cmd.uhs2_resp)); sd_uhs2_cmd_assemble(&cmd, &uhs2_cmd, UHS2_CFG_WRITE_PAYLOAD_LEN,