max1720x_battery: update register read function
Some maxfg registers are not within 0x00 ~ 0xFF.
Ignore the unnecessary error message by replacing
REGMAP_READ with regmap_read
Bug: 203671196
Signed-off-by: Jenny Ho <[email protected]>
Change-Id: I0cbbb0040d3806b9b1112e53fff2d2f66c172a61
diff --git a/max1720x_battery.c b/max1720x_battery.c
index 9b70688..a2720e7 100644
--- a/max1720x_battery.c
+++ b/max1720x_battery.c
@@ -3382,17 +3382,23 @@
size_t count, loff_t *ppos)
{
struct max1720x_chip *chip = (struct max1720x_chip *)filp->private_data;
+ const struct max17x0x_regmap *map = &chip->regmap;
u32 reg_address;
- u16 data;
+ unsigned int data;
char *tmp;
int ret = 0, len = 0;
+ if (!map->regmap) {
+ pr_err("Failed to read, no regmap\n");
+ return -EIO;
+ }
+
tmp = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!tmp)
return -ENOMEM;
for (reg_address = 0; reg_address <= 0xFF; reg_address++) {
- ret = REGMAP_READ(&chip->regmap, reg_address, &data);
+ ret = regmap_read(map->regmap, reg_address, &data);
if (ret < 0)
continue;