power: supply: sbs-battery: use correct flags field
diff mbox series

Message ID 20190815155322.20923-1-committed@heine.so
State Not Applicable, archived
Headers show
Series
  • power: supply: sbs-battery: use correct flags field
Related show

Commit Message

Michael Nosthoff Aug. 15, 2019, 3:53 p.m. UTC
the type flag is stored in the chip->flags field not in the
client->flags field. This currently leads to never using the ti
specific function but always falling back to the general one.

Signed-off-by: Michael Nosthoff <committed@heine.so>
---
 drivers/power/supply/sbs-battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Brian Norris Aug. 15, 2019, 4:38 p.m. UTC | #1
On Thu, Aug 15, 2019 at 8:53 AM Michael Nosthoff <committed@heine.so> wrote:
>
> the type flag is stored in the chip->flags field not in the
> client->flags field. This currently leads to never using the ti
> specific function but always falling back to the general one.

Whoops! Sorry about that. Probably could add:

Fixes: 76b16f4cdfb8 ("power: supply: sbs-battery: don't assume
MANUFACTURER_DATA formats")

and probably:

Cc: <stable@vger.kernel.org>

Also:

Reviewed-by: Brian Norris <briannorris@chromium.org>
Brian Norris Aug. 15, 2019, 4:42 p.m. UTC | #2
On Thu, Aug 15, 2019 at 9:38 AM Brian Norris <briannorris@chromium.org> wrote:
> On Thu, Aug 15, 2019 at 8:53 AM Michael Nosthoff <committed@heine.so> wrote:
> > the type flag is stored in the chip->flags field not in the
> > client->flags field. This currently leads to never using the ti
> > specific function but always falling back to the general one.

Also, the key point to why it will "never be used" is that the client
(struct i2c_client) doesn't have a flag for BIT(0). See I2C_CLIENT_*
flags, which start from 0x04.

Brian

Patch
diff mbox series

diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 048d205d7074..2e86cc1e0e35 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -620,7 +620,7 @@  static int sbs_get_property(struct power_supply *psy,
 	switch (psp) {
 	case POWER_SUPPLY_PROP_PRESENT:
 	case POWER_SUPPLY_PROP_HEALTH:
-		if (client->flags & SBS_FLAGS_TI_BQ20Z75)
+		if (chip->flags & SBS_FLAGS_TI_BQ20Z75)
 			ret = sbs_get_ti_battery_presence_and_health(client,
 								     psp, val);
 		else