Skip to contentSkip to conversation

iio: adc: da9150-gpadc: fix build on mips CONFIG_MIKROTIK_RB532=y

PATCH In review Jackie Liu 3 participants 5 messages Mar 24, 2022 – Mar 28, 2022

Subsystems (2)
lore
Share & tools
lore

Jackie Liu

author
#0 lore raw

PATCH 1/1 iio: adc: da9150-gpadc: fix build on mips CONFIG_MIKROTIK_RB532=y

From: Jackie Liu <[email protected]>

kernel robot report build fail by randconfig:

[...]
drivers/iio/adc/da9150-gpadc.c:254:13: error: ‘DA9150_GPADC_CHAN_0x08’ undeclared here (not in a function); did you mean ‘DA9150_GPADC_CHAN_TBAT’?

  254 |  .channel = DA9150_GPADC_CHAN_##_id,   \
      |             ^~~~~~~~~~~~~~~~~~
drivers/iio/adc/da9150-gpadc.c:273:2: note: in expansion of macro ‘DA9150_GPADC_CHANNEL’
  273 |  DA9150_GPADC_CHANNEL(_id, _hw_id, _type,   \
      |  ^~~~~~~~~~~~~~~~~~~~
drivers/iio/adc/da9150-gpadc.c:281:2: note: in expansion of macro ‘DA9150_GPADC_CHANNEL_PROCESSED’
  281 |  DA9150_GPADC_CHANNEL_PROCESSED(GPIOD, GPIOD_6V, IIO_VOLTAGE, NULL),
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

make[4]: *** [../scripts/Makefile.build:288: drivers/iio/adc/da9150-gpadc.o] Error 1 make[3]: *** [../scripts/Makefile.build:550: drivers/iio/adc] Error 2 make[3]: *** Waiting for unfinished jobs....
[...]

---
 drivers/iio/adc/da9150-gpadc.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iio/adc/da9150-gpadc.c +6 -0
index 8f0d3fb63b67..ed32061aee51 100644
@@ -273,6 +273,12 @@ static const struct iio_info da9150_gpadc_info = {
 	DA9150_GPADC_CHANNEL(_id, _hw_id, _type,			\
 			     BIT(IIO_CHAN_INFO_PROCESSED), _ext_name)
 
+/*
+ * Workaround for arch/mips/include/asm/mach-rc32434/rb.h
+ *   #define GPIOD 0x08
+ */
+#undef GPIOD
+
 /* Supported channels */
 static const struct iio_chan_spec da9150_gpadc_channels[] = {
 	DA9150_GPADC_CHANNEL_PROCESSED(GPIOA, GPIOA_6V, IIO_VOLTAGE, NULL),
Signature · 1 line
2.25.1
#1 lore raw
Quoted 16 lines · Jackie Liu

From: Jackie Liu <[email protected]>

kernel robot report build fail by randconfig:

[...]
drivers/iio/adc/da9150-gpadc.c:254:13: error: ‘DA9150_GPADC_CHAN_0x08’ undeclared here (not in a function); did you mean ‘DA9150_GPADC_CHAN_TBAT’?

  254 |  .channel = DA9150_GPADC_CHAN_##_id,   \
      |             ^~~~~~~~~~~~~~~~~~
drivers/iio/adc/da9150-gpadc.c:273:2: note: in expansion of macro ‘DA9150_GPADC_CHANNEL’
  273 |  DA9150_GPADC_CHANNEL(_id, _hw_id, _type,   \
      |  ^~~~~~~~~~~~~~~~~~~~
drivers/iio/adc/da9150-gpadc.c:281:2: note: in expansion of macro ‘DA9150_GPADC_CHANNEL_PROCESSED’
  281 |  DA9150_GPADC_CHANNEL_PROCESSED(GPIOD, GPIOD_6V, IIO_VOLTAGE, NULL),
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 4 lines

make[4]: *** [../scripts/Makefile.build:288: drivers/iio/adc/da9150-gpadc.o] Error 1 make[3]: *** [../scripts/Makefile.build:550: drivers/iio/adc] Error 2 make[3]: *** Waiting for unfinished jobs....
[...]

These lines are noise and no need to be in the commit message.

drivers/iio/adc/da9150-gpadc.c static const struct iio_info da9150_gpadc_info = { · line 280

Quoted 5 lines
drivers/iio/adc/da9150-gpadc.c +5 -0
+/*
+ * Workaround for arch/mips/include/asm/mach-rc32434/rb.h
+ *   #define GPIOD 0x08
+ */
+#undef GPIOD

Looking at the bottom here the better approach seems to be namespacing of GPIO registers in the above mentioned header and corresponding users.

Quoted 3 lines

/* Supported channels */
static const struct iio_chan_spec da9150_gpadc_channels[] = {
DA9150_GPADC_CHANNEL_PROCESSED(GPIOA, GPIOA_6V, IIO_VOLTAGE, NULL),

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#2 lore raw
Quoted 24 lines · On Thu, 24 Mar 2022 12:18:14 +0200 Andy Shevchenko <[email protected]>…
Quoted 16 lines · Jackie Liu

From: Jackie Liu <[email protected]>

kernel robot report build fail by randconfig:

[...]
drivers/iio/adc/da9150-gpadc.c:254:13: error: ‘DA9150_GPADC_CHAN_0x08’ undeclared here (not in a function); did you mean ‘DA9150_GPADC_CHAN_TBAT’?

  254 |  .channel = DA9150_GPADC_CHAN_##_id,   \
      |             ^~~~~~~~~~~~~~~~~~
drivers/iio/adc/da9150-gpadc.c:273:2: note: in expansion of macro ‘DA9150_GPADC_CHANNEL’
  273 |  DA9150_GPADC_CHANNEL(_id, _hw_id, _type,   \
      |  ^~~~~~~~~~~~~~~~~~~~
drivers/iio/adc/da9150-gpadc.c:281:2: note: in expansion of macro ‘DA9150_GPADC_CHANNEL_PROCESSED’
  281 |  DA9150_GPADC_CHANNEL_PROCESSED(GPIOD, GPIOD_6V, IIO_VOLTAGE, NULL),
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
Quoted 4 lines

make[4]: *** [../scripts/Makefile.build:288: drivers/iio/adc/da9150-gpadc.o] Error 1 make[3]: *** [../scripts/Makefile.build:550: drivers/iio/adc] Error 2 make[3]: *** Waiting for unfinished jobs....
[...]

These lines are noise and no need to be in the commit message.

Quoted 9 lines

drivers/iio/adc/da9150-gpadc.c static const struct iio_info da9150_gpadc_info = { · line 280

Quoted 5 lines
drivers/iio/adc/da9150-gpadc.c +5 -0
+/*
+ * Workaround for arch/mips/include/asm/mach-rc32434/rb.h
+ *   #define GPIOD 0x08
+ */
+#undef GPIOD  

Looking at the bottom here the better approach seems to be namespacing of GPIO registers in the above mentioned header and corresponding users.

Agreed. Having around it here is just going to the tip of the iceberg long term. The header + users need fixing if it's going to be widely enough included that we can see it in places like this.

From some very basic grepping I 'suspect' you could just push the defines down into arch/mips/rb532/gpio.c but I may well be wrong...

Jonathan

Quoted 5 lines
Quoted 4 lines

/* Supported channels */
static const struct iio_chan_spec da9150_gpadc_channels[] = {
DA9150_GPADC_CHANNEL_PROCESSED(GPIOA, GPIOA_6V, IIO_VOLTAGE, NULL),

#3 lore raw
Quoted 6 lines · Jonathan Cameron
Quoted 1 line · On Thu, 24 Mar 2022 12:18:14 +0200 Andy Shevchenko <[email protected]>…

On Thu, Mar 24, 2022 at 7:58 AM Jackie Liu <[email protected]> wrote:

From some very basic grepping I 'suspect' you could just push the defines down into arch/mips/rb532/gpio.c but I may well be wrong...

It would be ideal if we may hide them in the C-file(s).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#4 lore raw

Hi Andy and Jonathan.

Hello, thank you for your replies, in fact, I also think it is not
suitable to do a workaround here, I want to directly try to modify the definition under the MIPS/rb532 architecture, if possible.

--
Jackie Liu

Quoted 10 lines · Andy Shevchenko
Quoted 6 lines · Jonathan Cameron
Quoted 1 line · On Thu, 24 Mar 2022 12:18:14 +0200 Andy Shevchenko <[email protected]>…

On Thu, Mar 24, 2022 at 7:58 AM Jackie Liu <[email protected]> wrote:

From some very basic grepping I 'suspect' you could just push the defines
down into arch/mips/rb532/gpio.c but I may well be wrong...

It would be ideal if we may hide them in the C-file(s).