Re: [PATCH v4 3/9] drivers: base: add linear ranges helpers

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

 



Hello Greg,

On Wed, 2020-03-18 at 14:50 +0100, gregkh@xxxxxxxxxxxxxxxxxxx wrote:
> On Wed, Mar 18, 2020 at 01:42:26PM +0000, Vaittinen, Matti wrote:
> > Hello Greg,
> > 
> > On Wed, 2020-03-18 at 14:08 +0100, Greg Kroah-Hartman wrote:
> > > On Tue, Feb 25, 2020 at 10:53:01AM +0200, Matti Vaittinen wrote:
> > > > Many devices have control registers which control some
> > > > measurable
> > > > property. Often a register contains control field so that
> > > > change in
> > > > this field causes linear change in the controlled property. It
> > > > is
> > > > not
> > > > a rare case that user wants to give 'meaningful' control values
> > > > and
> > > > driver needs to convert them to register field values. Even
> > > > more
> > > > often user wants to 'see' the currently set value - again in
> > > > meaningful units - and driver needs to convert the values it
> > > > reads
> > > > from register to these meaningful units. Examples of this
> > > > include:
> > > > 
> > > > - regulators, voltage/current configurations
> > > > - power, voltage/current configurations
> > > > - clk(?) NCOs
> > > > 
> > > > and maybe others I can't think of right now.
> > > > 
> > > > Provide a linear_range helper which can do conversion from user
> > > > value
> > > > to register value 'selector'.
> > > > 
> > > > The idea here is stolen from regulator framework and patches
> > > > refactoring
> > > > the regulator helpers to use this are following.
> > > > 
> > > > Signed-off-by: Matti Vaittinen <
> > > > matti.vaittinen@xxxxxxxxxxxxxxxxx>
> > > > ---
> > > > 
> > > > Changes since rfc-v3:
> > > >   - Kerneldoc fixes
> > > >   - Corrected commit message typo meaningfull => meaningful
> > > > 
> > > >  drivers/base/Kconfig         |   3 +
> > > >  drivers/base/Makefile        |   1 +
> > > >  drivers/base/linear_ranges.c | 246
> > > > +++++++++++++++++++++++++++++++++++
> > > 
> > > Why in drivers/base/ ?
> > > 
> > > Why not in lib/ ?
> > 
> > I was pondering which of these would be better. I decided to do
> > with
> > drivers/base because - in it's current form - this is really a
> > driver
> > related stuff. I see it somehow in same position as regmap code -
> > although this is just a tiny helper compared to regmap. But this
> > also
> > has pretty driver specific audience :)
> > 
> > And... I must admit I like things which I know. And I have been
> > doing
> > driver development and "know" a few of the driver related
> > colleagues -
> > hence working with them is easier for me ;) Getting to know the
> > colleagues maintaining lib is a bit scary :] Yep, I'm Finnish if
> > you
> > happen to wonder why getting to know people is scary xD
> > 
> > > >  include/linux/linear_range.h |  48 +++++++
> > > >  4 files changed, 298 insertions(+)
> > > >  create mode 100644 drivers/base/linear_ranges.c
> > > >  create mode 100644 include/linux/linear_range.h
> > > > 
> > > > diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> > > > index 5f0bc74d2409..636b6fa8e499 100644
> > > > --- a/drivers/base/Kconfig
> > > > +++ b/drivers/base/Kconfig
> > > > @@ -209,4 +209,7 @@ config GENERIC_ARCH_TOPOLOGY
> > > >  	  appropriate scaling, sysfs interface for reading
> > > > capacity
> > > > values at
> > > >  	  runtime.
> > > >  
> > > > +config LINEAR_RANGES
> > > > +	tristate
> > > 
> > > No help text at all???
> > 
> > Yes. The linear ranges has no meaning to be enabled alone. It only
> > plays a role if it is used by some driver/subsystem. And
> > drivers/subsystems should do
> > select LINEAR_RANGES. So showing help in any config tool is not
> > needed.
> > This should actually not be visible in menuconfig or others. I
> > think I
> > have seen a few examples like this.
> > 
> > Ayways, I have no obejctions to adding some text if absolutely
> > needed.
> > Any suggestions for a text politely saying - "please, pretend I am
> > not
> > here" - are welcome :) (Although, I think this really does not need
> > help text).
> 
> This kind of implies it needs to be in lib/ that way the needed code
> links it and all should be fine.

Sigh. I somehow guessed this was coming... Well, I had to try anyways
:) Please just ignore v5 - I did send it prior receiving your comments.
I am about to send v6 which will contain the changes you suggested.
Let's see how people who look things that go under lib/ will see this.

Br,
   Matti Vaittinen





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux