[PATCH 02/11] regulator: merge struct regulator_internal fields into struct regulator_dev
Marco Felsch
m.felsch at pengutronix.de
Wed Sep 20 04:13:14 PDT 2023
On 23-09-20, Sascha Hauer wrote:
> 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 at 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 ;)
Argh.. sorry for the noise.
Regards,
Marco
> > > 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 |
>
More information about the barebox
mailing list