Re: [PATCH v2 1/3] gpio: regmap: Support few IC specific operations

From: Vaittinen, Matti
Date: Fri May 21 2021 - 06:20:47 EST



On Fri, 2021-05-21 at 13:09 +0300, Andy Shevchenko wrote:
> On Fri, May 21, 2021 at 12:53 PM Matti Vaittinen
> <matti.vaittinen@xxxxxxxxxxxxxxxxx> wrote:
> > The set_config and init_valid_mask GPIO operations are usually very
> > IC
> > specific. Allow IC drivers to provide these custom operations at
> > gpio-regmap registration.
>
> Thanks for this. In general (from design p.o.v.) looks good to me,
> one
> question below, though.
>
> > Signed-off-by: Matti Vaittinen <matti.vaittinen@xxxxxxxxxxxxxxxxx>
> >
> > ---
> > Changelog v2: (based on suggestions by Michael Walle)
> > - drop gpio_regmap_set_drvdata()
>
> But why do we have gpio_regmap_get_drvdata()

I was thinking the drivers might still need to get the drvdata. But now
I don't see how they could easily get it via this API. Yes, the
regmap_gpio struct (which is used to obtain the data via this API) is
returned by the registration - but the only place where IC driver could
store this is in the drvdata :) So yes, this is next to useless now.

Sure this API could be used in probe, after the registration - but
there the driver should have access to drvdata and config anyways.

I'll drop also the gpio_regmap_get_drvdata() in next version. Thanks
for pointing this out.

> and why is it different
> now to the new member handling?

Hmm. I am unsure what you mean by this?

>
> > - drop checks and WARN() for pretty much impossible cases