From: Sascha Hauer <s.hauer@pengutronix.de>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 02/11] regulator: merge struct regulator_internal fields into struct regulator_dev
Date: Wed, 20 Sep 2023 13:07:19 +0200 [thread overview]
Message-ID: <20230920110719.GS637806@pengutronix.de> (raw)
In-Reply-To: <20230920105203.qvzlmstpxoat5p4m@pengutronix.de>
On Wed, Sep 20, 2023 at 12:52:03PM +0200, Marco Felsch wrote:
> Hi Sascha,
>
> On 23-09-20, Sascha Hauer wrote:
> > Each struct regulator_dev instance has a struct regulator_internal
> > associated with it. The idea was that core internal fields are seen
> > by the core only. In the end this is more confusing than helpful. We
> > have a ri->rdev link, but no rdev->ri link so that we can't get a
> > rdev from a ri pointer. We could add that link, but instead make the
> > whole stuff a bit easier by just merging everything from struct
> > regulator_internal to struct regulator_dev.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > drivers/regulator/core.c | 214 ++++++++++++++++++---------------------
> > include/regulator.h | 9 ++
> > 2 files changed, 106 insertions(+), 117 deletions(-)
> >
> > diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> > index e9b5b82dbe..41a3378ac8 100644
> > --- a/drivers/regulator/core.c
> > +++ b/drivers/regulator/core.c
> > @@ -13,21 +13,8 @@
> >
> > static LIST_HEAD(regulator_list);
> >
> > -struct regulator_internal {
> > - struct list_head list;
> > - struct device_node *node;
> > - struct regulator_dev *rdev;
> > - int enable_count;
> > - int enable_time_us;
> > - int min_uv;
> > - int max_uv;
> > - char *name;
> > - const char *supply;
> > - struct list_head consumer_list;
> > -};
> > -
> > struct regulator {
> > - struct regulator_internal *ri;
> > + struct regulator_dev *rdev;
> > struct list_head list;
> > struct device *dev;
> > };
> > @@ -41,13 +28,12 @@ static int regulator_map_voltage(struct regulator_dev *rdev, int min_uV,
> > return -ENOSYS;
> > }
> >
> > -static int regulator_enable_internal(struct regulator_internal *ri)
> > +static int regulator_enable_internal(struct regulator_dev *rdev)
> > {
> > - struct regulator_dev *rdev = ri->rdev;
> > int ret;
> >
> > - if (ri->enable_count) {
> > - ri->enable_count++;
> > + if (rdev->enable_count) {
> > + rdev->enable_count++;
> > return 0;
> > }
> >
> > @@ -59,30 +45,29 @@ static int regulator_enable_internal(struct regulator_internal *ri)
> > if (ret)
> > return ret;
> >
> > - ret = rdev->desc->ops->enable(ri->rdev);
> > + ret = rdev->desc->ops->enable(rdev);
> > if (ret) {
> > regulator_disable(rdev->supply);
> > return ret;
> > }
> >
> > - if (ri->enable_time_us)
> > - udelay(ri->enable_time_us);
> > + if (rdev->enable_time_us)
> > + udelay(rdev->enable_time_us);
>
> regualtor_dev does not have a 'enable_time_us' or do I miss something?
Yes, the rest of this patch ;)
> > diff --git a/include/regulator.h b/include/regulator.h
> > index b0a500434c..5eb236e602 100644
> > --- a/include/regulator.h
> > +++ b/include/regulator.h
> > @@ -85,6 +85,15 @@ struct regulator_desc {
> > };
> >
> > struct regulator_dev {
> > + const char *name;
> > + struct list_head list;
> > + struct device_node *node;
> > + int enable_count;
> > + int enable_time_us;
> > + int min_uv;
> > + int max_uv;
> > + const char *supply_name;
> > + struct list_head consumer_list;
> > const struct regulator_desc *desc;
> > struct regmap *regmap;
> > bool boot_on;
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2023-09-20 11:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-20 10:33 [PATCH 00/11] regulator updates Sascha Hauer
2023-09-20 10:33 ` [PATCH 01/11] regulator: rename variable rd to rdev Sascha Hauer
2023-09-20 11:15 ` Marco Felsch
2023-09-20 10:33 ` [PATCH 02/11] regulator: merge struct regulator_internal fields into struct regulator_dev Sascha Hauer
2023-09-20 10:52 ` Marco Felsch
2023-09-20 11:07 ` Sascha Hauer [this message]
2023-09-20 11:13 ` Marco Felsch
2023-09-20 11:20 ` Marco Felsch
2023-09-20 10:33 ` [PATCH 03/11] regulator: introduce regulator logging functions Sascha Hauer
2023-09-20 11:22 ` Marco Felsch
2023-09-20 10:33 ` [PATCH 04/11] regulator: add regulator_get_voltage_internal() Sascha Hauer
2023-09-20 11:25 ` Marco Felsch
2023-09-20 11:45 ` Sascha Hauer
2023-09-20 10:33 ` [PATCH 05/11] regulator: Add missing cases in regulator_map_voltage() Sascha Hauer
2023-09-20 11:28 ` Marco Felsch
2023-09-20 10:33 ` [PATCH 06/11] regulator: stpmic1: add .get_voltage_sel Sascha Hauer
2023-09-20 11:29 ` Marco Felsch
2023-09-20 10:33 ` [PATCH 07/11] regulator: stpmic1: add .supply_name Sascha Hauer
2023-09-20 11:36 ` Marco Felsch
2023-09-20 10:33 ` [PATCH 08/11] regulator: register regulator as last step in of_regulator_register() Sascha Hauer
2023-09-20 11:39 ` Marco Felsch
2023-09-20 10:33 ` [PATCH 09/11] regulator: Set initial voltage Sascha Hauer
2023-09-20 11:51 ` Marco Felsch
2023-09-20 10:33 ` [PATCH 10/11] regulator: drop struct regulator_dev::supply_name Sascha Hauer
2023-09-20 11:51 ` Marco Felsch
2023-09-20 10:33 ` [PATCH 11/11] regulator: print regulator tree Sascha Hauer
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=20230920110719.GS637806@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=m.felsch@pengutronix.de \
/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