From: Naresh Solanki <naresh.solanki@9elements.com>
To: Guenter Roeck <linux@roeck-us.net>,
linux-hwmon@vger.kernel.org, Jean Delvare <jdelvare@suse.com>
Cc: Patrick Rudolph <patrick.rudolph@9elements.com>,
Naresh Solanki <Naresh.Solanki@9elements.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/3] hwmon: (pmbus/core): Add rdev in pmbus_data struct
Date: Tue, 28 Mar 2023 17:03:33 +0200 [thread overview]
Message-ID: <20230328150335.90238-1-Naresh.Solanki@9elements.com> (raw)
Add regulator device in pmbus_data & initialize the same during PMBus
regulator register.
Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
---
drivers/hwmon/pmbus/pmbus_core.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 0ddef2c9ba9b..d93405f1a495 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -81,6 +81,7 @@ struct pmbus_label {
struct pmbus_data {
struct device *dev;
struct device *hwmon_dev;
+ struct regulator_dev **rdevs;
u32 flags; /* from platform data */
@@ -3109,9 +3110,13 @@ static int pmbus_regulator_register(struct pmbus_data *data)
struct device *dev = data->dev;
const struct pmbus_driver_info *info = data->info;
const struct pmbus_platform_data *pdata = dev_get_platdata(dev);
- struct regulator_dev *rdev;
int i;
+ data->rdevs = devm_kzalloc(dev, sizeof(struct regulator_dev *) * info->num_regulators,
+ GFP_KERNEL);
+ if (!data->rdevs)
+ return -ENOMEM;
+
for (i = 0; i < info->num_regulators; i++) {
struct regulator_config config = { };
@@ -3121,10 +3126,10 @@ static int pmbus_regulator_register(struct pmbus_data *data)
if (pdata && pdata->reg_init_data)
config.init_data = &pdata->reg_init_data[i];
- rdev = devm_regulator_register(dev, &info->reg_desc[i],
- &config);
- if (IS_ERR(rdev))
- return dev_err_probe(dev, PTR_ERR(rdev),
+ data->rdevs[i] = devm_regulator_register(dev, &info->reg_desc[i],
+ &config);
+ if (IS_ERR(data->rdevs[i]))
+ return dev_err_probe(dev, PTR_ERR(data->rdevs[i]),
"Failed to register %s regulator\n",
info->reg_desc[i].name);
}
base-commit: 8a863eb1b1162653d133856702e13560f3596b85
--
2.39.1
next reply other threads:[~2023-03-28 15:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-28 15:03 Naresh Solanki [this message]
2023-03-28 15:03 ` [PATCH v2 2/3] hwmon: (pmbus/core): Add regulator event support Naresh Solanki
2023-03-29 6:48 ` Matti Vaittinen
2023-04-05 13:15 ` Guenter Roeck
2023-04-05 13:57 ` Matti Vaittinen
2023-04-05 14:18 ` Guenter Roeck
2023-04-05 15:19 ` Mark Brown
2023-04-06 8:00 ` Matti Vaittinen
2023-04-06 13:43 ` Mark Brown
2023-04-10 8:19 ` Matti Vaittinen
2023-04-10 14:40 ` Guenter Roeck
2023-04-10 16:53 ` Matti Vaittinen
2023-04-10 17:47 ` Guenter Roeck
2023-04-11 6:10 ` Matti Vaittinen
2023-04-11 11:08 ` Mark Brown
2023-04-11 12:07 ` Mark Brown
2023-04-12 8:12 ` Matti Vaittinen
2023-04-11 9:12 ` Matti Vaittinen
2023-04-12 15:13 ` Guenter Roeck
2023-03-28 15:03 ` [PATCH v2 3/3] hwmon: (pmbus/core): Notify regulator events Naresh Solanki
2023-04-12 15:16 ` Guenter Roeck
2023-04-12 15:12 ` [PATCH v2 1/3] hwmon: (pmbus/core): Add rdev in pmbus_data struct Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230328150335.90238-1-Naresh.Solanki@9elements.com \
--to=naresh.solanki@9elements.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=patrick.rudolph@9elements.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox