diff mbox series

[1/4] iio: adc: rcar-gyroadc: mark OF related data as maybe unused

Message ID 20230311111457.251475-1-krzysztof.kozlowski@linaro.org (mailing list archive)
State Accepted
Headers show
Series [1/4] iio: adc: rcar-gyroadc: mark OF related data as maybe unused | expand

Commit Message

Krzysztof Kozlowski March 11, 2023, 11:14 a.m. UTC
The driver can be compile tested with !CONFIG_OF making certain data
unused:

  drivers/iio/adc/rcar-gyroadc.c:286:34: error: ‘rcar_gyroadc_child_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/iio/adc/rcar-gyroadc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron March 11, 2023, 12:23 p.m. UTC | #1
On Sat, 11 Mar 2023 12:14:54 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> The driver can be compile tested with !CONFIG_OF making certain data
> unused:
> 
>   drivers/iio/adc/rcar-gyroadc.c:286:34: error: ‘rcar_gyroadc_child_match’ defined but not used [-Werror=unused-const-variable=]
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Whilst in general I'd prefer to see these converted to generic fw properties, this
one is not trivial. So applied to the togreg branch of iio.git.

It would be nice if anyone has time to circle back to this and get rid of
the of specific stuff.

Jonathan


> ---
>  drivers/iio/adc/rcar-gyroadc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c
> index 27d9e147b4b7..b8972f673c9d 100644
> --- a/drivers/iio/adc/rcar-gyroadc.c
> +++ b/drivers/iio/adc/rcar-gyroadc.c
> @@ -283,7 +283,7 @@ static const struct of_device_id rcar_gyroadc_match[] = {
>  
>  MODULE_DEVICE_TABLE(of, rcar_gyroadc_match);
>  
> -static const struct of_device_id rcar_gyroadc_child_match[] = {
> +static const struct of_device_id rcar_gyroadc_child_match[] __maybe_unused = {
>  	/* Mode 1 ADCs */
>  	{
>  		.compatible	= "fujitsu,mb88101a",
Krzysztof Kozlowski March 11, 2023, 12:26 p.m. UTC | #2
On 11/03/2023 13:23, Jonathan Cameron wrote:
> On Sat, 11 Mar 2023 12:14:54 +0100
> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> 
>> The driver can be compile tested with !CONFIG_OF making certain data
>> unused:
>>
>>   drivers/iio/adc/rcar-gyroadc.c:286:34: error: ‘rcar_gyroadc_child_match’ defined but not used [-Werror=unused-const-variable=]
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> Whilst in general I'd prefer to see these converted to generic fw properties, this
> one is not trivial. So applied to the togreg branch of iio.git.
> 
> It would be nice if anyone has time to circle back to this and get rid of
> the of specific stuff.

This is device ID table. What do you want to remove here? What OF part?

Best regards,
Krzysztof
Jonathan Cameron March 11, 2023, 6:47 p.m. UTC | #3
On Sat, 11 Mar 2023 13:26:12 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> On 11/03/2023 13:23, Jonathan Cameron wrote:
> > On Sat, 11 Mar 2023 12:14:54 +0100
> > Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> >   
> >> The driver can be compile tested with !CONFIG_OF making certain data
> >> unused:
> >>
> >>   drivers/iio/adc/rcar-gyroadc.c:286:34: error: ‘rcar_gyroadc_child_match’ defined but not used [-Werror=unused-const-variable=]
> >>
> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>  
> > 
> > Whilst in general I'd prefer to see these converted to generic fw properties, this
> > one is not trivial. So applied to the togreg branch of iio.git.
> > 
> > It would be nice if anyone has time to circle back to this and get rid of
> > the of specific stuff.  
> 
> This is device ID table. What do you want to remove here? What OF part?

All of it (well not the table, but the code that directly accesses the
table).  As a general rule I'd like to see all driver in IIO
using the generic firmware accessors in property.h so that they work
with PRP0001 and other firmware types (see reply to later patch)

It's understandable that a given driver is only used on dt based
platforms, but that doesn't mean I wouldn't prefer generic code
if we can do it easily.  It becomes easier to review and better as a source
of code that might get copied into future drivers.

Jonathan

> 
> Best regards,
> Krzysztof
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c
index 27d9e147b4b7..b8972f673c9d 100644
--- a/drivers/iio/adc/rcar-gyroadc.c
+++ b/drivers/iio/adc/rcar-gyroadc.c
@@ -283,7 +283,7 @@  static const struct of_device_id rcar_gyroadc_match[] = {
 
 MODULE_DEVICE_TABLE(of, rcar_gyroadc_match);
 
-static const struct of_device_id rcar_gyroadc_child_match[] = {
+static const struct of_device_id rcar_gyroadc_child_match[] __maybe_unused = {
 	/* Mode 1 ADCs */
 	{
 		.compatible	= "fujitsu,mb88101a",