Skip to contentSkip to conversation

MIPS: rb532: move GPIOD definition into C-files

PATCH Superseded Jackie Liu 4 participants 14 messages Mar 29, 2022 – Mar 30, 2022 MIPS

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Jackie Liu

author
#0 lore raw

PATCH 1/1 MIPS: rb532: move GPIOD definition into C-files

From: Jackie Liu <[email protected]>

My kernel robot report build error from drivers/iio/adc/da9150-gpadc.c,

We define GPIOD in rb.h, in fact he should only be used in gpio.c, but it affects the driver da9150-gpadc.c which goes against the original intention of the design, just move it to his scope.

At the same time, GPIONMIEN and IMASK6 are not used anywhere, just delete them.

---
 arch/mips/include/asm/mach-rc32434/rb.h | 9 ---------
 arch/mips/rb532/gpio.c                  | 8 ++++++++
 2 files changed, 8 insertions(+), 9 deletions(-)
arch/mips/include/asm/mach-rc32434/rb.h +0 -9
index 34d179ca020b..dd9d4b026e62 100644
@@ -29,15 +29,6 @@
 #define DEV3TC		0x01003C
 #define BTCS		0x010040
 #define BTCOMPARE	0x010044
-#define GPIOBASE	0x050000
-/* Offsets relative to GPIOBASE */
-#define GPIOFUNC	0x00
-#define GPIOCFG		0x04
-#define GPIOD		0x08
-#define GPIOILEVEL	0x0C
-#define GPIOISTAT	0x10
-#define GPIONMIEN	0x14
-#define IMASK6		0x38
 #define LO_WPX		(1 << 0)
 #define LO_ALE		(1 << 1)
 #define LO_CLE		(1 << 2)
arch/mips/rb532/gpio.c +8 -0
index 94f02ada4082..43e188d53a49 100644
@@ -37,6 +37,14 @@
 #include <asm/mach-rc32434/rb.h>
 #include <asm/mach-rc32434/gpio.h>
 
+#define GPIOBASE	0x050000
+/* Offsets relative to GPIOBASE */
+#define GPIOFUNC	0x00
+#define GPIOCFG		0x04
+#define GPIOD		0x08
+#define GPIOILEVEL	0x0C
+#define GPIOISTAT	0x10
+
 struct rb532_gpio_chip {
 	struct gpio_chip chip;
 	void __iomem	 *regbase;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · Jackie Liu

From: Jackie Liu <[email protected]>

My kernel robot report build error from drivers/iio/adc/da9150-gpadc.c,

We define GPIOD in rb.h, in fact he should only be used in gpio.c, but

he --> it

Quoted 5 lines

it affects the driver da9150-gpadc.c which goes against the original intention of the design, just move it to his scope.

At the same time, GPIONMIEN and IMASK6 are not used anywhere, just delete them.

While not being used it's good to leave (save) them since it might be the only means of the HW documentation. I know that Git history will keep that, but it is more explicit just to have them in the code.

...

Quoted 4 lines
 #define DEV3TC         0x01003C
 #define BTCS           0x010040
 #define BTCOMPARE      0x010044
-#define GPIOBASE       0x050000

...

Quoted 1 line

+#define GPIOBASE 0x050000

I think this one belongs to the header.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#2 lore raw
Quoted 13 lines · Andy Shevchenko
Quoted 6 lines · Jackie Liu

From: Jackie Liu <[email protected]>

My kernel robot report build error from drivers/iio/adc/da9150-gpadc.c,

We define GPIOD in rb.h, in fact he should only be used in gpio.c, but

he --> it

Quoted 2 lines

it affects the driver da9150-gpadc.c which goes against the original intention of the design, just move it to his scope.

Quoted 6 lines
Quoted 2 lines

At the same time, GPIONMIEN and IMASK6 are not used anywhere, just delete them.

While not being used it's good to leave (save) them since it might be the only means of the HW documentation. I know that Git history will keep that, but it is more explicit just to have them in the code.

Sure.

Quoted 8 lines

...

Quoted 4 lines
  #define DEV3TC         0x01003C
  #define BTCS           0x010040
  #define BTCOMPARE      0x010044

-#define GPIOBASE 0x050000

Quoted 5 lines

...

Quoted 1 line

+#define GPIOBASE 0x050000

I think this one belongs to the header.

I think it would be better to put it in gpio.c, after all it belongs to the GPIO module and is not used elsewhere. It doesn't feel good if we put it in the header file.

--
BR, Jackie Liu

#3 lore raw
Quoted 35 lines · Jackie Liu
Quoted 13 lines · Andy Shevchenko
Quoted 6 lines · Jackie Liu

From: Jackie Liu <[email protected]>

My kernel robot report build error from drivers/iio/adc/da9150-gpadc.c,

We define GPIOD in rb.h, in fact he should only be used in gpio.c, but

he --> it

Quoted 2 lines

it affects the driver da9150-gpadc.c which goes against the original intention of the design, just move it to his scope.

Quoted 6 lines
Quoted 2 lines

At the same time, GPIONMIEN and IMASK6 are not used anywhere, just delete them.

While not being used it's good to leave (save) them since it might be the only means of the HW documentation. I know that Git history will keep that, but it is more explicit just to have them in the code.

Sure.

Quoted 10 lines

...

Quoted 4 lines
  #define DEV3TC         0x01003C
  #define BTCS           0x010040
  #define BTCOMPARE      0x010044

-#define GPIOBASE 0x050000

...

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

+#define GPIOBASE 0x050000

I think this one belongs to the header.

I think it would be better to put it in gpio.c, after all it belongs to the GPIO module and is not used elsewhere. It doesn't feel good if we put it in the header file.

I have a patchset, where the both files will go away. No need to clean up now.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
#4 lore raw
Quoted 2 lines · Thomas Bogendoerfer
Quoted 1 line · Jackie Liu

在 2022/3/29 下午8:54, Andy Shevchenko 写道:

...

Quoted 6 lines
Quoted 3 lines

I think it would be better to put it in gpio.c, after all it belongs to the GPIO module and is not used elsewhere. It doesn't feel good if we put it in the header file.

I have a patchset, where the both files will go away. No need to clean up now.

Do you plan them to be backported? If not, I would recommend applying this patch in order to have it backported and then do whatever you want we those files.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
Quoted 7 lines · Andy Shevchenko
Quoted 2 lines · Thomas Bogendoerfer
Quoted 1 line · Jackie Liu

在 2022/3/29 下午8:54, Andy Shevchenko 写道:

...

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I think it would be better to put it in gpio.c, after all it belongs to the GPIO module and is not used elsewhere. It doesn't feel good if we put it in the header file.

I have a patchset, where the both files will go away. No need to clean up now.

Do you plan them to be backported? If not, I would recommend applying

no plan for backporting

Quoted 2 lines

this patch in order to have it backported and then do whatever you want we those files.

why ? This doesn't fix anything, doesn't it ?

But if it makes people happy, I'll apply it.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
#6 lore raw
Quoted 4 lines · Thomas Bogendoerfer
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Thomas Bogendoerfer

On Wed, Mar 30, 2022 at 09:46:07AM +0800, Jackie Liu wrote:

...

Quoted 11 lines
Quoted 4 lines
Quoted 2 lines

I have a patchset, where the both files will go away. No need to clean up now.

Do you plan them to be backported? If not, I would recommend applying

no plan for backporting

Quoted 2 lines

this patch in order to have it backported and then do whatever you want we those files.

why ? This doesn't fix anything, doesn't it ?

It fixes compilation breakage in some cases. I think the author of this patch can (should) elaborate.
Also, it might need a Fixes tag.

Quoted 1 line

But if it makes people happy, I'll apply it.

Yes, please.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#7 lore raw
Quoted 12 lines · Andy Shevchenko
Quoted 4 lines · Thomas Bogendoerfer
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Thomas Bogendoerfer

On Wed, Mar 30, 2022 at 09:46:07AM +0800, Jackie Liu wrote:

...

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

I have a patchset, where the both files will go away. No need to clean up now.

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

Do you plan them to be backported? If not, I would recommend applying

no plan for backporting

Quoted 2 lines

this patch in order to have it backported and then do whatever you want we those files.

why ? This doesn't fix anything, doesn't it ?

Like the patch I submitted in the first version, there are some gcc errors.

[...]
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....

Quoted 4 lines

It fixes compilation breakage in some cases. I think the author of this patch can (should) elaborate.
Also, it might need a Fixes tag.

Um, it's really hard to say which commit is fixed, just because this header file defines a GPIOD, and someone else uses this later.

Quoted 5 lines
Quoted 2 lines

But if it makes people happy, I'll apply it.

Yes, please.

--
Jackie Liu

#8 lore raw
Quoted 3 lines · Jackie Liu
Quoted 2 lines · Andy Shevchenko

On Wed, Mar 30, 2022 at 12:32 PM Thomas Bogendoerfer <[email protected]> wrote:

...

Quoted 6 lines
Quoted 3 lines

It fixes compilation breakage in some cases. I think the author of this patch can (should) elaborate.
Also, it might need a Fixes tag.

Um, it's really hard to say which commit is fixed, just because this header file defines a GPIOD, and someone else uses this later.

I think we may use the original commit where the header in mips appeared with a justification that the definitions are not needed to be there and it may induce build errors, which in fact happens.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author
#9 lore raw
Quoted 11 lines · Andy Shevchenko
Quoted 3 lines · Jackie Liu
Quoted 2 lines · Andy Shevchenko

On Wed, Mar 30, 2022 at 12:32 PM Thomas Bogendoerfer <[email protected]> wrote:

...

Quoted 4 lines
Quoted 3 lines

It fixes compilation breakage in some cases. I think the author of this patch can (should) elaborate.
Also, it might need a Fixes tag.

Quoted 7 lines
Quoted 2 lines

Um, it's really hard to say which commit is fixed, just because this header file defines a GPIOD, and someone else uses this later.

I think we may use the original commit where the header in mips appeared with a justification that the definitions are not needed to be there and it may induce build errors, which in fact happens.

Sure, Thanks, I will send new patch v3 later.

--
BR, Jackie Liu

#10 lore raw
In reply to Jackie Liu
Quoted 47 lines · Jackie Liu
Quoted 12 lines · Andy Shevchenko
Quoted 4 lines · Thomas Bogendoerfer
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Thomas Bogendoerfer

On Wed, Mar 30, 2022 at 09:46:07AM +0800, Jackie Liu wrote:

...

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

I have a patchset, where the both files will go away. No need to clean up now.

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

Do you plan them to be backported? If not, I would recommend applying

no plan for backporting

Quoted 2 lines

this patch in order to have it backported and then do whatever you want we those files.

why ? This doesn't fix anything, doesn't it ?

Like the patch I submitted in the first version, there are some gcc errors.

[...]
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....

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

It fixes compilation breakage in some cases. I think the author of this patch can (should) elaborate.
Also, it might need a Fixes tag.

Um, it's really hard to say which commit is fixed, just because this header file defines a GPIOD, and someone else uses this later.

ok, now I got it.

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

But if it makes people happy, I'll apply it.

Yes, please.

will do,

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
author
#11 lore raw

PATCH v2 1/1 MIPS: rb532: move GPIOD definition into C-files

In reply to Andy Shevchenko

From: Jackie Liu <[email protected]>

My kernel robot report build error from drivers/iio/adc/da9150-gpadc.c,

We define GPIOD in rb.h, in fact he should only be used in gpio.c, but it affects the driver da9150-gpadc.c which goes against the original intention of the design, just move it to his scope.

---
v1->v2:
Keep GPIONMIEN and IMASK6 as hardware document.

 arch/mips/include/asm/mach-rc32434/rb.h |  9 ---------
 arch/mips/rb532/gpio.c                  | 10 ++++++++++
 2 files changed, 10 insertions(+), 9 deletions(-)
arch/mips/include/asm/mach-rc32434/rb.h +0 -9
index 34d179ca020b..dd9d4b026e62 100644
@@ -29,15 +29,6 @@
 #define DEV3TC		0x01003C
 #define BTCS		0x010040
 #define BTCOMPARE	0x010044
-#define GPIOBASE	0x050000
-/* Offsets relative to GPIOBASE */
-#define GPIOFUNC	0x00
-#define GPIOCFG		0x04
-#define GPIOD		0x08
-#define GPIOILEVEL	0x0C
-#define GPIOISTAT	0x10
-#define GPIONMIEN	0x14
-#define IMASK6		0x38
 #define LO_WPX		(1 << 0)
 #define LO_ALE		(1 << 1)
 #define LO_CLE		(1 << 2)
arch/mips/rb532/gpio.c +10 -0
index 94f02ada4082..29c21b9d42da 100644
@@ -37,6 +37,16 @@
 #include <asm/mach-rc32434/rb.h>
 #include <asm/mach-rc32434/gpio.h>
 
+#define GPIOBASE	0x050000
+/* Offsets relative to GPIOBASE */
+#define GPIOFUNC	0x00
+#define GPIOCFG		0x04
+#define GPIOD		0x08
+#define GPIOILEVEL	0x0C
+#define GPIOISTAT	0x10
+#define GPIONMIEN	0x14
+#define IMASK6		0x38
+
 struct rb532_gpio_chip {
 	struct gpio_chip chip;
 	void __iomem	 *regbase;
Signature · 1 line
2.25.1
author
#12 lore raw

PATCH v3 1/1 MIPS: rb532: move GPIOD definition into C-files

In reply to Andy Shevchenko

From: Jackie Liu <[email protected]>

My kernel robot report build error from drivers/iio/adc/da9150-gpadc.c,

We define GPIOD in rb.h, in fact it should only be used in gpio.c, but it affects the driver da9150-gpadc.c which goes against the original intention of the design, just move it to his scope.

---
v1->v2:
Keep GPIONMIEN and IMASK6 as hardware document.
v2->v3:
he to it.

 arch/mips/include/asm/mach-rc32434/rb.h |  9 ---------
 arch/mips/rb532/gpio.c                  | 10 ++++++++++
 2 files changed, 10 insertions(+), 9 deletions(-)
arch/mips/include/asm/mach-rc32434/rb.h +0 -9
index 34d179ca020b..dd9d4b026e62 100644
@@ -29,15 +29,6 @@
 #define DEV3TC		0x01003C
 #define BTCS		0x010040
 #define BTCOMPARE	0x010044
-#define GPIOBASE	0x050000
-/* Offsets relative to GPIOBASE */
-#define GPIOFUNC	0x00
-#define GPIOCFG		0x04
-#define GPIOD		0x08
-#define GPIOILEVEL	0x0C
-#define GPIOISTAT	0x10
-#define GPIONMIEN	0x14
-#define IMASK6		0x38
 #define LO_WPX		(1 << 0)
 #define LO_ALE		(1 << 1)
 #define LO_CLE		(1 << 2)
arch/mips/rb532/gpio.c +10 -0
index 94f02ada4082..29c21b9d42da 100644
@@ -37,6 +37,16 @@
 #include <asm/mach-rc32434/rb.h>
 #include <asm/mach-rc32434/gpio.h>
 
+#define GPIOBASE	0x050000
+/* Offsets relative to GPIOBASE */
+#define GPIOFUNC	0x00
+#define GPIOCFG		0x04
+#define GPIOD		0x08
+#define GPIOILEVEL	0x0C
+#define GPIOISTAT	0x10
+#define GPIONMIEN	0x14
+#define IMASK6		0x38
+
 struct rb532_gpio_chip {
 	struct gpio_chip chip;
 	void __iomem	 *regbase;
Signature · 1 line
2.25.1
#13 lore raw
Quoted 3 lines · Jackie Liu

From: Jackie Liu <[email protected]>

My kernel robot report build error from drivers/iio/adc/da9150-gpadc.c,

Reports.

Quoted 3 lines

We define GPIOD in rb.h, in fact it should only be used in gpio.c, but it affects the driver da9150-gpadc.c which goes against the original intention of the design, just move it to his scope.

s/his/its/.

Quoted 9 lines

---
v1->v2:
Keep GPIONMIEN and IMASK6 as hardware document.
v2->v3:
he to it.

What? :-)

[...]

MBR, Sergey