* [PATCH 1/2] regulator: isl6271a: Remove *rdev[3] from struct isl_pmic
@ 2019-01-28 14:19 Axel Lin
2019-01-28 14:19 ` [PATCH 2/2] regulator: isl6271a: Constify isl_core_ops and isl_fixed_ops Axel Lin
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2019-01-28 14:19 UTC (permalink / raw)
To: Mark Brown; +Cc: Marek Vasut, Liam Girdwood, linux-kernel, Axel Lin
This driver is using devm_regulator_register, so it's not necessary to
store *rdev[3] in struct isl_pmic. Use a local variable instead.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/isl6271a-regulator.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c
index 4abd8e9c81e5..ae29c8773057 100644
--- a/drivers/regulator/isl6271a-regulator.c
+++ b/drivers/regulator/isl6271a-regulator.c
@@ -31,7 +31,6 @@
/* PMIC details */
struct isl_pmic {
struct i2c_client *client;
- struct regulator_dev *rdev[3];
struct mutex mtx;
};
@@ -109,6 +108,7 @@ static const struct regulator_desc isl_rd[] = {
static int isl6271a_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
+ struct regulator_dev *rdev;
struct regulator_config config = { };
struct regulator_init_data *init_data = dev_get_platdata(&i2c->dev);
struct isl_pmic *pmic;
@@ -133,11 +133,10 @@ static int isl6271a_probe(struct i2c_client *i2c,
config.init_data = NULL;
config.driver_data = pmic;
- pmic->rdev[i] = devm_regulator_register(&i2c->dev, &isl_rd[i],
- &config);
- if (IS_ERR(pmic->rdev[i])) {
+ rdev = devm_regulator_register(&i2c->dev, &isl_rd[i], &config);
+ if (IS_ERR(rdev)) {
dev_err(&i2c->dev, "failed to register %s\n", id->name);
- return PTR_ERR(pmic->rdev[i]);
+ return PTR_ERR(rdev);
}
}
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] regulator: isl6271a: Constify isl_core_ops and isl_fixed_ops
2019-01-28 14:19 [PATCH 1/2] regulator: isl6271a: Remove *rdev[3] from struct isl_pmic Axel Lin
@ 2019-01-28 14:19 ` Axel Lin
0 siblings, 0 replies; 2+ messages in thread
From: Axel Lin @ 2019-01-28 14:19 UTC (permalink / raw)
To: Mark Brown; +Cc: Marek Vasut, Liam Girdwood, linux-kernel, Axel Lin
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/isl6271a-regulator.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c
index ae29c8773057..6f28bba81d13 100644
--- a/drivers/regulator/isl6271a-regulator.c
+++ b/drivers/regulator/isl6271a-regulator.c
@@ -65,14 +65,14 @@ static int isl6271a_set_voltage_sel(struct regulator_dev *dev,
return err;
}
-static struct regulator_ops isl_core_ops = {
+static const struct regulator_ops isl_core_ops = {
.get_voltage_sel = isl6271a_get_voltage_sel,
.set_voltage_sel = isl6271a_set_voltage_sel,
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
};
-static struct regulator_ops isl_fixed_ops = {
+static const struct regulator_ops isl_fixed_ops = {
.list_voltage = regulator_list_voltage_linear,
};
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-28 14:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-28 14:19 [PATCH 1/2] regulator: isl6271a: Remove *rdev[3] from struct isl_pmic Axel Lin
2019-01-28 14:19 ` [PATCH 2/2] regulator: isl6271a: Constify isl_core_ops and isl_fixed_ops Axel Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®