Re: [PATCH 4/4] regulator: Convert tps65023 to use regmap API

Grant Likely
2011-07-16T02:06:25Z

On Sat, Jul 16, 2011 at 10:47:09AM +0900, Mark Brown wrote:
> On Fri, Jul 15, 2011 at 12:29:54PM -0600, Grant Likely wrote:
> > On Fri, Jul 15, 2011 at 01:48:05PM +0900, Mark Brown wrote:
>
> > > Right, the driver is always going to know exactly what bus it registered
> > > on but for many drivers we don't really have any bus-specific code once
> > > we factor out the register I/O.
>
> > Exactly my point. The only time a global registration list is needed
> > is at setup time. Once the regmap structure is initialized, it
> > doesn't need to reference the list. I far prefer the simplicity of an
> > explicit bus type initialization than the implicit method with the
>
> I'm just not seeing massive complexity here, and I am writing a lot of
> multi-bus drivers with bolierplate code. My ideal world would be one
> line probe and exit functions for the buses, or better yet a single ops
> structure assigned to both buses, as with my user hat on if I'm telling
> the API the struct device to use I really shouldn't be having to tell it
> what bus the device is on since I just told it that.
>
> > extra indirection code needed to implement it, by my measure, ~60-70
> > lines of code.
>
> If you're talking about pure lines of code here then obviously you don't
> need to convert terribly many drivers before you end up with a saving
> overall.
>
> > Also, making is explicit guarantees that there is no question about
> > the i2c or spi module of regmap getting loaded before it gets used.
>
> The bus must obviously be ready for the device to probe in the first
> place and the regmap API is static only so it'll always be there. We
> just need to load the regmap hooks along with the bus core and we're
> fine.
>
> Still, the merge window is getting near so I guess I'll make the change :/

:) Indeed. We can merge without and then enjoy the argument at our
leisure after the merge window.

g.