[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220130204557.15662-14-hdegoede@redhat.com>
Date: Sun, 30 Jan 2022 21:45:50 +0100
From: Hans de Goede <hdegoede@...hat.com>
To: "Rafael J . Wysocki" <rafael@...nel.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Mark Gross <markgross@...nel.org>,
Andy Shevchenko <andy@...nel.org>,
Wolfram Sang <wsa@...nel.org>,
Lee Jones <lee.jones@...aro.org>,
Sebastian Reichel <sre@...nel.org>,
MyungJoo Ham <myungjoo.ham@...sung.com>,
Chanwoo Choi <cw00.choi@...sung.com>,
Ard Biesheuvel <ardb@...nel.org>
Cc: Hans de Goede <hdegoede@...hat.com>, Len Brown <lenb@...nel.org>,
linux-acpi@...r.kernel.org, Yauhen Kharuzhy <jekhor@...il.com>,
Tsuchiya Yuto <kitakar@...il.com>,
Fabio Aiuto <fabioaiuto83@...il.com>,
platform-driver-x86@...r.kernel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-efi@...r.kernel.org
Subject: [PATCH v4 13/20] power: supply: bq25890: Use the devm_regmap_field_bulk_alloc() helper
Use the devm_regmap_field_bulk_alloc() helper function instead of
open-coding this ourselves.
Signed-off-by: Hans de Goede <hdegoede@...hat.com>
---
Changes in v3:
- This is a new patch in v3 of this patch-series
---
drivers/power/supply/bq25890_charger.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 179abed92f9b..852a6fec4339 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -1165,7 +1165,6 @@ static int bq25890_probe(struct i2c_client *client,
struct device *dev = &client->dev;
struct bq25890_device *bq;
int ret;
- int i;
bq = devm_kzalloc(dev, sizeof(*bq), GFP_KERNEL);
if (!bq)
@@ -1182,15 +1181,10 @@ static int bq25890_probe(struct i2c_client *client,
return dev_err_probe(dev, PTR_ERR(bq->rmap),
"failed to allocate register map\n");
- for (i = 0; i < ARRAY_SIZE(bq25890_reg_fields); i++) {
- const struct reg_field *reg_fields = bq25890_reg_fields;
-
- bq->rmap_fields[i] = devm_regmap_field_alloc(dev, bq->rmap,
- reg_fields[i]);
- if (IS_ERR(bq->rmap_fields[i]))
- return dev_err_probe(dev, PTR_ERR(bq->rmap_fields[i]),
- "cannot allocate regmap field\n");
- }
+ ret = devm_regmap_field_bulk_alloc(dev, bq->rmap, bq->rmap_fields,
+ bq25890_reg_fields, F_MAX_FIELDS);
+ if (ret)
+ return ret;
i2c_set_clientdata(client, bq);
--
2.33.1
Powered by blists - more mailing lists