[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200117134026.GM15507@dell>
Date: Fri, 17 Jan 2020 13:40:26 +0000
From: Lee Jones <lee.jones@...aro.org>
To: "Vaittinen, Matti" <Matti.Vaittinen@...rohmeurope.com>
Cc: "linux-leds@...r.kernel.org" <linux-leds@...r.kernel.org>,
"dmurphy@...com" <dmurphy@...com>,
"linux-rtc@...r.kernel.org" <linux-rtc@...r.kernel.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"alexandre.belloni@...tlin.com" <alexandre.belloni@...tlin.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"mturquette@...libre.com" <mturquette@...libre.com>,
"mazziesaccount@...il.com" <mazziesaccount@...il.com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"jacek.anaszewski@...il.com" <jacek.anaszewski@...il.com>,
"a.zummo@...ertech.it" <a.zummo@...ertech.it>,
"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
"lgirdwood@...il.com" <lgirdwood@...il.com>,
"mark.rutland@....com" <mark.rutland@....com>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"bgolaszewski@...libre.com" <bgolaszewski@...libre.com>,
"linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
"sboyd@...nel.org" <sboyd@...nel.org>,
"pavel@....cz" <pavel@....cz>,
"broonie@...nel.org" <broonie@...nel.org>
Subject: Re: [PATCH v10 08/13] regulator: bd718x7: Split driver to common and
bd718x7 specific parts
On Fri, 17 Jan 2020, Vaittinen, Matti wrote:
> Hello Lee,
>
> On Fri, 2020-01-17 at 10:28 +0000, Lee Jones wrote:
> > On Fri, 17 Jan 2020, Matti Vaittinen wrote:
> >
> > > Few ROHM PMICs allow setting the voltage states for different
> > > system states
> > > like RUN, IDLE, SUSPEND and LPSR. States are then changed via SoC
> > > specific
> > > mechanisms. bd718x7 driver implemented device-tree parsing
> > > functions for
> > > these state specific voltages. The parsing functions can be re-used
> > > by
> > > other ROHM chip drivers like bd71828. Split the generic functions
> > > from
> > > bd718x7-regulator.c to rohm-regulator.c and export them for other
> > > modules
> > > to use.
> > >
> > > Signed-off-by: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
> > > Acked-by: Mark Brown <broonie@...nel.org>
> > > ---
> > > no changes since v9
> > >
> > > drivers/regulator/Kconfig | 4 +
> > > drivers/regulator/Makefile | 1 +
> > > drivers/regulator/bd718x7-regulator.c | 183 ++++++++------------
> > > ------
> > > drivers/regulator/rohm-regulator.c | 95 +++++++++++++
> > > include/linux/mfd/rohm-generic.h | 66 ++++++++++
> > > 5 files changed, 221 insertions(+), 128 deletions(-)
> > > create mode 100644 drivers/regulator/rohm-regulator.c
> >
> > [...]
> >
> > > diff --git a/include/linux/mfd/rohm-generic.h
> > > b/include/linux/mfd/rohm-generic.h
> > > index ff3dd7578fd3..6cc5a0819959 100644
> > > --- a/include/linux/mfd/rohm-generic.h
> > > +++ b/include/linux/mfd/rohm-generic.h
> > > @@ -4,6 +4,9 @@
> > > #ifndef __LINUX_MFD_ROHM_H__
> > > #define __LINUX_MFD_ROHM_H__
> > >
> > > +#include <linux/regmap.h>
> > > +#include <linux/regulator/driver.h>
> > > +
> > > enum rohm_chip_type {
> > > ROHM_CHIP_TYPE_BD71837 = 0,
> > > ROHM_CHIP_TYPE_BD71847,
> > > @@ -17,4 +20,67 @@ struct rohm_regmap_dev {
> > > struct regmap *regmap;
> > > };
> > >
> > > +enum {
> > > + ROHM_DVS_LEVEL_UNKNOWN,
> > > + ROHM_DVS_LEVEL_RUN,
> > > + ROHM_DVS_LEVEL_IDLE,
> > > + ROHM_DVS_LEVEL_SUSPEND,
> > > + ROHM_DVS_LEVEL_LPSR,
> > > +#define ROHM_DVS_LEVEL_MAX ROHM_DVS_LEVEL_LPSR
> >
> > Haven't seen this before. Is it legit?
> >
>
> I don't know why it wouldn't be :) I kind of grew used to that when I
> still did some networking stuff.
Networking it not a good example.
It's full of odd little quirks to the standard styling.
> It doesn't really matter in this case but for example the netlink
> headers do:
>
> enum {
> foo,
> #define foo foo
> bar,
> #define bar bar
> ...
> };
>
> https://elixir.bootlin.com/linux/v5.5-rc6/source/include/uapi/linux/rtnetlink.h
>
> What is the good here is that this allows one to nicely exclude
> unsupported stuff using preprocessor:
>
> #include <header_with_or_without_foo_dependng_on_version.h>
>
> #ifdef foo
> use_foo(foo);
> #endif
>
> What about:
> >
> > ROHM_DVS_LEVEL_MAX = ROHM_DVS_LEVEL_LPSR
>
> Anyways, I don't see why define wouldn't be Ok here - but sure it can
> be changed if you insist ;) Just let me know if you can accept the
> define or not :)
Let's go for not in this instance. :D
--
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
Powered by blists - more mailing lists