power: supply: axp288_fuel_gauge: Report register-address on readb / writeb errors
authorHans de Goede <hdegoede@redhat.com>
Sun, 1 Aug 2021 13:30:59 +0000 (15:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 09:42:58 +0000 (11:42 +0200)
[ Upstream commit caa534c3ba40c6e8352b42cbbbca9ba481814ac8 ]

When fuel_gauge_reg_readb()/_writeb() fails, report which register we
were trying to read / write when the error happened.

Also reword the message a bit:
- Drop the axp288 prefix, dev_err() already prints this
- Switch from telegram / abbreviated style to a normal sentence, aligning
  the message with those from fuel_gauge_read_*bit_word()

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/power/supply/axp288_fuel_gauge.c

index 089056cb8e73af595bc668ca32a3dc8bc8f9b0fb..85e6c9bacf06778ca697a44c7e3d0510391e952a 100644 (file)
@@ -169,7 +169,7 @@ static int fuel_gauge_reg_readb(struct axp288_fg_info *info, int reg)
        }
 
        if (ret < 0) {
-               dev_err(&info->pdev->dev, "axp288 reg read err:%d\n", ret);
+               dev_err(&info->pdev->dev, "Error reading reg 0x%02x err: %d\n", reg, ret);
                return ret;
        }
 
@@ -183,7 +183,7 @@ static int fuel_gauge_reg_writeb(struct axp288_fg_info *info, int reg, u8 val)
        ret = regmap_write(info->regmap, reg, (unsigned int)val);
 
        if (ret < 0)
-               dev_err(&info->pdev->dev, "axp288 reg write err:%d\n", ret);
+               dev_err(&info->pdev->dev, "Error writing reg 0x%02x err: %d\n", reg, ret);
 
        return ret;
 }