Skip to contentSkip to conversation

power:sbs-manager: Fix double shift of select reg

PATCH In review James A. MacInnes 2 participants 2 messages Feb 15, 2018 – Feb 16, 2018 Power supply

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power:sbs-manager: Fix double shift of select reg

1 << BIT() causes double shift when the macro is unwrapped removed extra "1 <<"

---
 drivers/power/supply/sbs-manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/sbs-manager.c +1 -1
index ccb4217..cb6e8f6 100644
@@ -183,7 +183,7 @@ static int sbsm_select(struct i2c_mux_core *muxc, u32 chan)
 		return ret;
 
 	/* chan goes from 1 ... 4 */
-	reg = 1 << BIT(SBSM_SMB_BAT_OFFSET + chan);
+	reg = BIT(SBSM_SMB_BAT_OFFSET + chan);
 	ret = sbsm_write_word(data->client, SBSM_CMD_BATSYSSTATE, reg);
 	if (ret)
 		dev_err(dev, "Failed to select channel %i\n", chan);
Signature · 1 line
2.7.4
#1 lore raw

Hi James,

Quoted 2 lines · James A. MacInnes

1 << BIT() causes double shift when the macro is unwrapped removed extra "1 <<"

No Signed-off-by... But this is already fixed:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7d54d0d38ec42559c891526f079f1e035cd4b3ae

-- Sebastian

Quoted 20 lines
---
 drivers/power/supply/sbs-manager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/sbs-manager.c +1 -1
index ccb4217..cb6e8f6 100644
@@ -183,7 +183,7 @@ static int sbsm_select(struct i2c_mux_core *muxc, u32 chan)
 		return ret;
 
 	/* chan goes from 1 ... 4 */
-	reg = 1 << BIT(SBSM_SMB_BAT_OFFSET + chan);
+	reg = BIT(SBSM_SMB_BAT_OFFSET + chan);
 	ret = sbsm_write_word(data->client, SBSM_CMD_BATSYSSTATE, reg);
 	if (ret)
 		dev_err(dev, "Failed to select channel %i\n", chan);
Signature · 1 line
2.7.4