Re: [PATCH v10 08/13] regulator: bd718x7: Split driver to common and bd718x7 specific parts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxx>
> > > Acked-by: Mark Brown <broonie@xxxxxxxxxx>
> > > ---
> > > 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



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux