diff mbox series

[1/8] iio: adc: ab8500-gpadc: Allow COMPILE_TEST builds

Message ID 20240330190849.1321065-2-jic23@kernel.org (mailing list archive)
State Changes Requested
Headers show
Series IIO: More use of device_for_each_child_node_scoped() and __free() | expand

Commit Message

Jonathan Cameron March 30, 2024, 7:08 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

The dependencies on various ab8500 components prevent this driver
being useful but they don't seem to prevent it being built.
Improve build coverage by allowing COMPILE_TEST.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij April 4, 2024, 11:36 a.m. UTC | #1
On Sat, Mar 30, 2024 at 8:09 PM Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> The dependencies on various ab8500 components prevent this driver
> being useful but they don't seem to prevent it being built.
> Improve build coverage by allowing COMPILE_TEST.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

...but I think AB8500_CORE is a hard requirement because
<linux/mfd/abx500.h> does not provide register accessor stubs?

Yours,
Linus Walleij
Jonathan Cameron April 5, 2024, 10:36 a.m. UTC | #2
On Thu, 4 Apr 2024 13:36:15 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Sat, Mar 30, 2024 at 8:09 PM Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > The dependencies on various ab8500 components prevent this driver
> > being useful but they don't seem to prevent it being built.
> > Improve build coverage by allowing COMPILE_TEST.
> >
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>  
> 
> ...but I think AB8500_CORE is a hard requirement because
> <linux/mfd/abx500.h> does not provide register accessor stubs?
> 
hmm. I clearly didn't test enough.  Ah well, I'll drop this one.
> Yours,
> Linus Walleij
Jonathan Cameron April 6, 2024, 10:27 a.m. UTC | #3
On Fri, 5 Apr 2024 11:36:22 +0100
Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:

> On Thu, 4 Apr 2024 13:36:15 +0200
> Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> > On Sat, Mar 30, 2024 at 8:09 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >   
> > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > >
> > > The dependencies on various ab8500 components prevent this driver
> > > being useful but they don't seem to prevent it being built.
> > > Improve build coverage by allowing COMPILE_TEST.
> > >
> > > Cc: Linus Walleij <linus.walleij@linaro.org>
> > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>    
> > 
> > ...but I think AB8500_CORE is a hard requirement because
> > <linux/mfd/abx500.h> does not provide register accessor stubs?
> >   
> hmm. I clearly didn't test enough.  Ah well, I'll drop this one.
> > Yours,
> > Linus Walleij  

Tested again, nope, AB8500_CORE isn't needed as far as I can tell.
What register accessor stubs were you referring to? There are some calls for debug dumps
in that header, but those aren't used by the ADC driver.

Jonathan


>
Linus Walleij April 8, 2024, 9:16 a.m. UTC | #4
On Sat, Apr 6, 2024 at 12:27 PM Jonathan Cameron <jic23@kernel.org> wrote:
> On Fri, 5 Apr 2024 11:36:22 +0100
> Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:
>
> > On Thu, 4 Apr 2024 13:36:15 +0200
> > Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > > On Sat, Mar 30, 2024 at 8:09 PM Jonathan Cameron <jic23@kernel.org> wrote:
> > >
> > > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > >
> > > > The dependencies on various ab8500 components prevent this driver
> > > > being useful but they don't seem to prevent it being built.
> > > > Improve build coverage by allowing COMPILE_TEST.
> > > >
> > > > Cc: Linus Walleij <linus.walleij@linaro.org>
> > > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > >
> > > ...but I think AB8500_CORE is a hard requirement because
> > > <linux/mfd/abx500.h> does not provide register accessor stubs?
> > >
> > hmm. I clearly didn't test enough.  Ah well, I'll drop this one.
> > > Yours,
> > > Linus Walleij
>
> Tested again, nope, AB8500_CORE isn't needed as far as I can tell.

Oh? Weird.

> What register accessor stubs were you referring to? There are some calls for debug dumps
> in that header, but those aren't used by the ADC driver.

<linux/mfd/abx500.h> has for example:
(...)
int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
        u8 *value);
(...)

and the ADC driver has:

        /* Check if ADC is not busy, lock and proceed */
        do {
                ret = abx500_get_register_interruptible(gpadc->dev,
                        AB8500_GPADC, AB8500_GPADC_STAT_REG, &val);


$ git grep abx500_get_register_interruptible include/linux/
include/linux/mfd/abx500.h:int
abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,

No stubs! I think there is just some other Kconfig stuff bringing the
AB8500 MFD core into
the build at any attempt.

Yours,
Linus Walleij
Jonathan Cameron April 13, 2024, 9:57 a.m. UTC | #5
On Mon, 8 Apr 2024 11:16:17 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Sat, Apr 6, 2024 at 12:27 PM Jonathan Cameron <jic23@kernel.org> wrote:
> > On Fri, 5 Apr 2024 11:36:22 +0100
> > Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:
> >  
> > > On Thu, 4 Apr 2024 13:36:15 +0200
> > > Linus Walleij <linus.walleij@linaro.org> wrote:
> > >  
> > > > On Sat, Mar 30, 2024 at 8:09 PM Jonathan Cameron <jic23@kernel.org> wrote:
> > > >  
> > > > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > > >
> > > > > The dependencies on various ab8500 components prevent this driver
> > > > > being useful but they don't seem to prevent it being built.
> > > > > Improve build coverage by allowing COMPILE_TEST.
> > > > >
> > > > > Cc: Linus Walleij <linus.walleij@linaro.org>
> > > > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>  
> > > >
> > > > ...but I think AB8500_CORE is a hard requirement because
> > > > <linux/mfd/abx500.h> does not provide register accessor stubs?
> > > >  
> > > hmm. I clearly didn't test enough.  Ah well, I'll drop this one.  
> > > > Yours,
> > > > Linus Walleij  
> >
> > Tested again, nope, AB8500_CORE isn't needed as far as I can tell.  
> 
> Oh? Weird.

> 
> > What register accessor stubs were you referring to? There are some calls for debug dumps
> > in that header, but those aren't used by the ADC driver.  
> 
> <linux/mfd/abx500.h> has for example:
> (...)
> int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
>         u8 *value);
> (...)
> 
> and the ADC driver has:
> 
>         /* Check if ADC is not busy, lock and proceed */
>         do {
>                 ret = abx500_get_register_interruptible(gpadc->dev,
>                         AB8500_GPADC, AB8500_GPADC_STAT_REG, &val);
> 
> 
> $ git grep abx500_get_register_interruptible include/linux/
> include/linux/mfd/abx500.h:int
> abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
> 
> No stubs! I think there is just some other Kconfig stuff bringing the
> AB8500 MFD core into
> the build at any attempt.

ah got it.  AB8500_CORE isn't needed, but ABX500_CORE is and that's indirectly
depended on by AB8500_CORE.  How about I change the dependency to
depends on ABX500_CORE && (AB8500_REGULATOR || COMPILE_TEST) instead?

As ABX500_CORE doesn't have a horrible indirect arch dependency that
AB8500_CORE does via db8500-prcmu.  I can build it on x86 but obviously
would want to hit this with a lot more build tests.

DB8500_PRCMU has some stubs but not a complete enough set to allow
AB5800_CORE to build.  Could fix that but it's a bigger change than
relaxing requirements of the ADC driver to the ones needed for building.

Jonathan


> 
> Yours,
> Linus Walleij
Linus Walleij April 15, 2024, 7:06 a.m. UTC | #6
On Sat, Apr 13, 2024 at 11:57 AM Jonathan Cameron <jic23@kernel.org> wrote:

> > $ git grep abx500_get_register_interruptible include/linux/
> > include/linux/mfd/abx500.h:int
> > abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
> >
> > No stubs! I think there is just some other Kconfig stuff bringing the
> > AB8500 MFD core into
> > the build at any attempt.
>
> ah got it.  AB8500_CORE isn't needed, but ABX500_CORE is and that's indirectly
> depended on by AB8500_CORE.  How about I change the dependency to
> depends on ABX500_CORE && (AB8500_REGULATOR || COMPILE_TEST) instead?

That looks like it will work!

> As ABX500_CORE doesn't have a horrible indirect arch dependency that
> AB8500_CORE does via db8500-prcmu.  I can build it on x86 but obviously
> would want to hit this with a lot more build tests.

Actually I want to drop the ABX500 indirection layer because that was
as the name says intended as an abstraction across a multitude of
ABX500 chips whereof AB8500 would be the first, however the others
never materialized.

But that's for another day, this works right now.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 8db68b80b391..e648198b0a0a 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -8,7 +8,7 @@  menu "Analog to digital converters"
 
 config AB8500_GPADC
 	bool "ST-Ericsson AB8500 GPADC driver"
-	depends on AB8500_CORE && REGULATOR_AB8500
+	depends on (AB8500_CORE && REGULATOR_AB8500) || COMPILE_TEST
 	default y
 	help
 	  AB8500 Analog Baseband, mixed signal integrated circuit GPADC