mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
power: supply: ltc4162l: Use GENMASK macro in bitmask operation
Replace the bitmask operation BIT(6) - 1 with GENMASK(5, 0) to make the code clearer and readable. Reviewed-by: Nuno Sa <nuno.sa@analog.com> Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com> Link: https://lore.kernel.org/r/20250117024307.4119-1-kimseer.paller@analog.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
260d7c5e53
commit
92c71aa1a8
|
|
@ -410,7 +410,7 @@ static int ltc4162l_get_icharge(struct ltc4162l_info *info,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
regval &= BIT(6) - 1; /* Only the lower 5 bits */
|
||||
regval &= GENMASK(5, 0);
|
||||
|
||||
/* The charge current servo level: (icharge_dac + 1) × 1mV/RSNSB */
|
||||
++regval;
|
||||
|
|
@ -449,7 +449,7 @@ static int ltc4162l_get_vcharge(struct ltc4162l_info *info,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
regval &= BIT(6) - 1; /* Only the lower 5 bits */
|
||||
regval &= GENMASK(5, 0);
|
||||
|
||||
/*
|
||||
* charge voltage setting can be computed from
|
||||
|
|
@ -500,7 +500,7 @@ static int ltc4015_get_vcharge(struct ltc4162l_info *info,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
regval &= BIT(6) - 1; /* Only the lower 5 bits */
|
||||
regval &= GENMASK(5, 0);
|
||||
|
||||
/*
|
||||
* charge voltage setting can be computed from:
|
||||
|
|
@ -636,7 +636,7 @@ static int ltc4162l_get_iin_limit_dac(struct ltc4162l_info *info,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
regval &= BIT(6) - 1; /* Only 6 bits */
|
||||
regval &= GENMASK(5, 0);
|
||||
|
||||
/* (iin_limit_dac + 1) × 500μV / RSNSI */
|
||||
++regval;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user