Skip to contentSkip to conversation

gpio: drop CONFIG_OF_GPIO in the definition of the struct gpio_chip

PATCH New Jean-Christophe PLAGNIOL-VILLARD 3 participants 8 messages Feb 13, 2012 – Feb 14, 2012 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: drop CONFIG_OF_GPIO in the definition of the struct gpio_chip

this will allow to avoid the ifdef CONFIG_OF_GPIO in gpio drivers

---
 include/asm-generic/gpio.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
include/asm-generic/gpio.h +0 -2
index 1ff4e22..c08b758 100644
@@ -122,7 +122,6 @@ struct gpio_chip {
 	unsigned		can_sleep:1;
 	unsigned		exported:1;
 
-#if defined(CONFIG_OF_GPIO)
 	/*
 	 * If CONFIG_OF is enabled, then all GPIO controllers described in the
 	 * device tree automatically may have an OF translation
@@ -131,7 +130,6 @@ struct gpio_chip {
 	int of_gpio_n_cells;
 	int (*of_xlate)(struct gpio_chip *gc,
 		        const struct of_phandle_args *gpiospec, u32 *flags);
-#endif
 };
 
 extern const char *gpiochip_is_requested(struct gpio_chip *chip,
Signature · 1 line
1.7.7
#1 lore raw

PATCH 1/1 gpio: drop CONFIG_OF_GPIO in the definition of the struct gpio_chip

On 02/13/2012 10:23 AM, Jean-Christophe PLAGNIOL-VILLARD :

Quoted 5 lines

this will allow to avoid the ifdef CONFIG_OF_GPIO in gpio drivers

Added devicetree-discuss ml.

Quoted 9 lines
---
 include/asm-generic/gpio.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
include/asm-generic/gpio.h +0 -0
index 1ff4e22..c08b758 100644

include/asm-generic/gpio.h struct gpio_chip { · line 126

Quoted 6 lines
include/asm-generic/gpio.h +0 -1
@@ -122,7 +122,6 @@ struct gpio_chip {
 	unsigned		can_sleep:1;
 	unsigned		exported:1;
 
-#if defined(CONFIG_OF_GPIO)
 	/*
 	 * If CONFIG_OF is enabled, then all GPIO controllers described in the

Maybe you will need to rework this comment.

include/asm-generic/gpio.h struct gpio_chip { · line 134

Quoted 6 lines
include/asm-generic/gpio.h +0 -1
 	 * device tree automatically may have an OF translation
@@ -131,7 +130,6 @@ struct gpio_chip {
 	int of_gpio_n_cells;
 	int (*of_xlate)(struct gpio_chip *gc,
 		        const struct of_phandle_args *gpiospec, u32 *flags);
-#endif

I do not know if we can remove the ifdef completely of just move of_node out of it.

Quoted 3 lines
include/asm-generic/gpio.h +0 -0
 };
 
 extern const char *gpiochip_is_requested(struct gpio_chip *chip,
Signature · 1 line
Nicolas Ferre
#2 lore raw

PATCH 1/1 gpio: drop CONFIG_OF_GPIO in the definition of the struct gpio_chip

Quoted 27 lines · Nicolas Ferre

On 02/13/2012 10:23 AM, Jean-Christophe PLAGNIOL-VILLARD :

Quoted 5 lines

this will allow to avoid the ifdef CONFIG_OF_GPIO in gpio drivers

Added devicetree-discuss ml.

Quoted 9 lines
---
 include/asm-generic/gpio.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
include/asm-generic/gpio.h +0 -0
index 1ff4e22..c08b758 100644

include/asm-generic/gpio.h struct gpio_chip { · line 126

Quoted 6 lines
include/asm-generic/gpio.h +0 -1
@@ -122,7 +122,6 @@ struct gpio_chip {
 	unsigned		can_sleep:1;
 	unsigned		exported:1;
 
-#if defined(CONFIG_OF_GPIO)
 	/*
 	 * If CONFIG_OF is enabled, then all GPIO controllers described in the

Maybe you will need to rework this comment.

Quoted 9 lines

include/asm-generic/gpio.h struct gpio_chip { · line 134

Quoted 6 lines
include/asm-generic/gpio.h +0 -1
 	 * device tree automatically may have an OF translation
@@ -131,7 +130,6 @@ struct gpio_chip {
 	int of_gpio_n_cells;
 	int (*of_xlate)(struct gpio_chip *gc,
 		        const struct of_phandle_args *gpiospec, u32 *flags);
-#endif

I do not know if we can remove the ifdef completely of just move of_node out of it.

basicaly ifdef on a struct is so so
so yes

Best Regards,
J.

#3 lore raw

PATCH 1/1 gpio: drop CONFIG_OF_GPIO in the definition of the struct gpio_chip

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

this will allow to avoid the ifdef CONFIG_OF_GPIO in gpio drivers

So would always enabling CONFIG_OF on at91 and then only 1 sub-arch is paying the price for additional space. Then we would only have ifdefs in the truly cross-platform gpio drivers.

Rob

Quoted 27 lines
---
 include/asm-generic/gpio.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
include/asm-generic/gpio.h +0 -2
index 1ff4e22..c08b758 100644
@@ -122,7 +122,6 @@ struct gpio_chip {
 	unsigned		can_sleep:1;
 	unsigned		exported:1;
 
-#if defined(CONFIG_OF_GPIO)
 	/*
 	 * If CONFIG_OF is enabled, then all GPIO controllers described in the
 	 * device tree automatically may have an OF translation
@@ -131,7 +130,6 @@ struct gpio_chip {
 	int of_gpio_n_cells;
 	int (*of_xlate)(struct gpio_chip *gc,
 		        const struct of_phandle_args *gpiospec, u32 *flags);
-#endif
 };
 
 extern const char *gpiochip_is_requested(struct gpio_chip *chip,
#4 lore raw

PATCH 1/1 gpio: drop CONFIG_OF_GPIO in the definition of the struct gpio_chip

Quoted 7 lines · Rob Herring
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

this will allow to avoid the ifdef CONFIG_OF_GPIO in gpio drivers

So would always enabling CONFIG_OF on at91 and then only 1 sub-arch is paying the price for additional space. Then we would only have ifdefs in the truly cross-platform gpio drivers.

we talk about 12bytes and here it's force to put a ifdef in the gpio drivers in platform_device we don't do so. So why should be do it here??

Drop the ifdef will ensure evenif we compile the code without OF_GPIO that all the work can compile

we recently introduce IS_ENABLED & co to drop the maximum of ifdef here it's the same idea

Best Regards,
J.

Quoted 30 lines

Rob

Quoted 27 lines
---
 include/asm-generic/gpio.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
include/asm-generic/gpio.h +0 -2
index 1ff4e22..c08b758 100644
@@ -122,7 +122,6 @@ struct gpio_chip {
 	unsigned		can_sleep:1;
 	unsigned		exported:1;
 
-#if defined(CONFIG_OF_GPIO)
 	/*
 	 * If CONFIG_OF is enabled, then all GPIO controllers described in the
 	 * device tree automatically may have an OF translation
@@ -131,7 +130,6 @@ struct gpio_chip {
 	int of_gpio_n_cells;
 	int (*of_xlate)(struct gpio_chip *gc,
 		        const struct of_phandle_args *gpiospec, u32 *flags);
-#endif
 };
 
 extern const char *gpiochip_is_requested(struct gpio_chip *chip,
#5 lore raw

PATCH 1/1 gpio: drop CONFIG_OF_GPIO in the definition of the struct gpio_chip

Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 7 lines · Rob Herring
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

this will allow to avoid the ifdef CONFIG_OF_GPIO in gpio drivers

So would always enabling CONFIG_OF on at91 and then only 1 sub-arch is paying the price for additional space. Then we would only have ifdefs in the truly cross-platform gpio drivers.

we talk about 12bytes and here it's force to put a ifdef in the gpio drivers in platform_device we don't do so. So why should be do it here??

But you are affecting everyone. I'm not saying we shouldn't do this. I'm just highlighting the reason this is a problem and gpio is just one instance. I think sub-arches should either always select OF or not. Trying to do both is just going to be a pain to maintain.

Quoted 2 lines

Drop the ifdef will ensure evenif we compile the code without OF_GPIO that all the work can compile

Yes, I understand the concept. To look at it another way, this has been here for a long time without issue because CONFIG_OF was designed to be selected at arch level.

Quoted 3 lines

we recently introduce IS_ENABLED & co to drop the maximum of ifdef here it's the same idea

I have no idea what you are referring to.

Rob

Quoted 32 lines

Best Regards,
J.

Quoted 30 lines

Rob

Quoted 27 lines
---
 include/asm-generic/gpio.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
include/asm-generic/gpio.h +0 -2
index 1ff4e22..c08b758 100644
@@ -122,7 +122,6 @@ struct gpio_chip {
 	unsigned		can_sleep:1;
 	unsigned		exported:1;
 
-#if defined(CONFIG_OF_GPIO)
 	/*
 	 * If CONFIG_OF is enabled, then all GPIO controllers described in the
 	 * device tree automatically may have an OF translation
@@ -131,7 +130,6 @@ struct gpio_chip {
 	int of_gpio_n_cells;
 	int (*of_xlate)(struct gpio_chip *gc,
 		        const struct of_phandle_args *gpiospec, u32 *flags);
-#endif
 };
 
 extern const char *gpiochip_is_requested(struct gpio_chip *chip,
#6 lore raw

PATCH 1/1 gpio: drop CONFIG_OF_GPIO in the definition of the struct gpio_chip

On 02/13/2012 03:33 PM, Rob Herring :

Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Rob Herring
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines

this will allow to avoid the ifdef CONFIG_OF_GPIO in gpio drivers

So would always enabling CONFIG_OF on at91 and then only 1 sub-arch is paying the price for additional space. Then we would only have ifdefs in the truly cross-platform gpio drivers.

Quoted 7 lines
Quoted 2 lines

we talk about 12bytes and here it's force to put a ifdef in the gpio drivers in platform_device we don't do so. So why should be do it here??

But you are affecting everyone. I'm not saying we shouldn't do this. I'm just highlighting the reason this is a problem and gpio is just one instance. I think sub-arches should either always select OF or not. Trying to do both is just going to be a pain to maintain.

(nothing related to the particular case discussed here, but...)

Rob,

It may be a pain to maintain (and I can tell it is), but we do not have the choice: the AT91 family is simply too widely spread in terms of number of SoC and release date of those SoC. We must maintain all of them working while we are doing the effort to switch most of the material to DT. As this work takes time I fear that the transition period will last for a long time.

Older SoCs will surely never be converted to device-tree as both the lack of workforce, customer habits and amount of boards existing and working correctly in mainline will go against this.

Best regards,

Signature · 1 line
Nicolas Ferre
#7 lore raw

PATCH 1/1 gpio: drop CONFIG_OF_GPIO in the definition of the struct gpio_chip

Quoted 29 lines · Nicolas Ferre

On 02/13/2012 03:33 PM, Rob Herring :

Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Rob Herring
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines

this will allow to avoid the ifdef CONFIG_OF_GPIO in gpio drivers

So would always enabling CONFIG_OF on at91 and then only 1 sub-arch is paying the price for additional space. Then we would only have ifdefs in the truly cross-platform gpio drivers.

Quoted 7 lines
Quoted 2 lines

we talk about 12bytes and here it's force to put a ifdef in the gpio drivers in platform_device we don't do so. So why should be do it here??

But you are affecting everyone. I'm not saying we shouldn't do this. I'm just highlighting the reason this is a problem and gpio is just one instance. I think sub-arches should either always select OF or not. Trying to do both is just going to be a pain to maintain.

(nothing related to the particular case discussed here, but...)

Rob,

It may be a pain to maintain (and I can tell it is), but we do not have the choice: the AT91 family is simply too widely spread in terms of number of SoC and release date of those SoC. We must maintain all of them working while we are doing the effort to switch most of the material to DT. As this work takes time I fear that the transition period will last for a long time.

Quoted 3 lines

Older SoCs will surely never be converted to device-tree as both the lack of workforce, customer habits and amount of boards existing and working correctly in mainline will go against this.

I'm not saying convert all the boards to DT, just unconditionally enable the config option. The only impact with that is kernel size, but I haven't quantified how much of an increase that is though. Is it a big deal if the boards are only minimally being maintained compared to the maintenance?

Rob