diff mbox

[PATCH/RFC] ARM: shmobile: Disallow PINCTRL without GPIOLIB

Message ID 20130318135818.23765.51686.sendpatchset@w520 (mailing list archive)
State New, archived
Headers show

Commit Message

Magnus Damm March 18, 2013, 1:58 p.m. UTC
From: Magnus Damm <damm@opensource.se>

Modify mach-shmobile to only select PINCTRL in case of
ARCH_WANT_OPTIONAL_GPIOLIB is set.

This fixes a build error triggered when adding a new SoC
lacking GPIO software support (ARCH_WANT_OPTIONAL_GPIOLIB=n):

 CC      drivers/tty/vt/keyboard.o
In file included from drivers/pinctrl/core.c:30:0:
include/asm-generic/gpio.h: In function 'gpio_get_value_cansleep':
include/asm-generic/gpio.h:270:2: error: implicit declaration of function '__gpio_get_value'
include/asm-generic/gpio.h: In function 'gpio_set_value_cansleep':
include/asm-generic/gpio.h:276:2: error: implicit declaration of function '__gpio_set_value'
drivers/pinctrl/core.c: In function 'pinctrl_ready_for_gpio_range':
drivers/pinctrl/core.c:297:9: error: implicit declaration of function 'gpio_to_chip'
drivers/pinctrl/core.c:297:27: warning: initialization makes pointer from integer without a cast
drivers/pinctrl/core.c:304:45: error: dereferencing pointer to incomplete type
drivers/pinctrl/core.c:305:26: error: dereferencing pointer to incomplete type
drivers/pinctrl/core.c:305:39: error: dereferencing pointer to incomplete type
make[2]: *** [drivers/pinctrl/core.o] Error 1
make[1]: *** [drivers/pinctrl] Error 2
make[1]: *** Waiting for unfinished jobs....
  LD      drivers/sh/built-in.o

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Using renesas.git "next" 811689afc214564c4a5f238ecf4d8bdc0e52b615

 Trigger using the r8a73a4 patches that lack GPIO and PFC support.

 I am more than happy to replace this patch with something cleaner.

 arch/arm/Kconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Horman March 20, 2013, 1:05 p.m. UTC | #1
On Mon, Mar 18, 2013 at 10:58:18PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> Modify mach-shmobile to only select PINCTRL in case of
> ARCH_WANT_OPTIONAL_GPIOLIB is set.
> 
> This fixes a build error triggered when adding a new SoC
> lacking GPIO software support (ARCH_WANT_OPTIONAL_GPIOLIB=n):
> 
>  CC      drivers/tty/vt/keyboard.o
> In file included from drivers/pinctrl/core.c:30:0:
> include/asm-generic/gpio.h: In function 'gpio_get_value_cansleep':
> include/asm-generic/gpio.h:270:2: error: implicit declaration of function '__gpio_get_value'
> include/asm-generic/gpio.h: In function 'gpio_set_value_cansleep':
> include/asm-generic/gpio.h:276:2: error: implicit declaration of function '__gpio_set_value'
> drivers/pinctrl/core.c: In function 'pinctrl_ready_for_gpio_range':
> drivers/pinctrl/core.c:297:9: error: implicit declaration of function 'gpio_to_chip'
> drivers/pinctrl/core.c:297:27: warning: initialization makes pointer from integer without a cast
> drivers/pinctrl/core.c:304:45: error: dereferencing pointer to incomplete type
> drivers/pinctrl/core.c:305:26: error: dereferencing pointer to incomplete type
> drivers/pinctrl/core.c:305:39: error: dereferencing pointer to incomplete type
> make[2]: *** [drivers/pinctrl/core.o] Error 1
> make[1]: *** [drivers/pinctrl] Error 2
> make[1]: *** Waiting for unfinished jobs....
>   LD      drivers/sh/built-in.o
> 
> Signed-off-by: Magnus Damm <damm@opensource.se>

Laurent, could you review this please?

> ---
> 
>  Using renesas.git "next" 811689afc214564c4a5f238ecf4d8bdc0e52b615
> 
>  Trigger using the r8a73a4 patches that lack GPIO and PFC support.
> 
>  I am more than happy to replace this patch with something cleaner.
> 
>  arch/arm/Kconfig |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- 0001/arch/arm/Kconfig
> +++ work/arch/arm/Kconfig	2013-03-18 14:56:17.000000000 +0900
> @@ -725,7 +725,7 @@ config ARCH_SHMOBILE
>  	select MULTI_IRQ_HANDLER
>  	select NEED_MACH_MEMORY_H
>  	select NO_IOPORT
> -	select PINCTRL
> +	select PINCTRL if ARCH_WANT_OPTIONAL_GPIOLIB
>  	select PM_GENERIC_DOMAINS if PM
>  	select SPARSE_IRQ
>  	help
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Laurent Pinchart March 20, 2013, 3:28 p.m. UTC | #2
Hi Magnus,

Thanks for the patch.

On Monday 18 March 2013 22:58:18 Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
> 
> Modify mach-shmobile to only select PINCTRL in case of
> ARCH_WANT_OPTIONAL_GPIOLIB is set.
> 
> This fixes a build error triggered when adding a new SoC
> lacking GPIO software support (ARCH_WANT_OPTIONAL_GPIOLIB=n):
> 
>  CC      drivers/tty/vt/keyboard.o
> In file included from drivers/pinctrl/core.c:30:0:
> include/asm-generic/gpio.h: In function 'gpio_get_value_cansleep':
> include/asm-generic/gpio.h:270:2: error: implicit declaration of function
> '__gpio_get_value'
> include/asm-generic/gpio.h: In function 'gpio_set_value_cansleep':
> include/asm-generic/gpio.h:276:2: error: implicit declaration of function
> '__gpio_set_value'
> drivers/pinctrl/core.c: In function 'pinctrl_ready_for_gpio_range':
> drivers/pinctrl/core.c:297:9: error: implicit declaration of function
> 'gpio_to_chip'
> drivers/pinctrl/core.c:297:27: warning: initialization makes pointer from
> integer without a cast
> drivers/pinctrl/core.c:304:45: error: dereferencing pointer to incomplete
> type
> drivers/pinctrl/core.c:305:26: error: dereferencing pointer to incomplete
> type
> drivers/pinctrl/core.c:305:39: error: dereferencing pointer to incomplete
> type
> make[2]: *** [drivers/pinctrl/core.o] Error 1
> make[1]: *** [drivers/pinctrl] Error 2
> make[1]: *** Waiting for unfinished jobs....
>   LD      drivers/sh/built-in.o
> 
> Signed-off-by: Magnus Damm <damm@opensource.se>
>
> ---
> 
>  Using renesas.git "next" 811689afc214564c4a5f238ecf4d8bdc0e52b615
> 
>  Trigger using the r8a73a4 patches that lack GPIO and PFC support.
> 
>  I am more than happy to replace this patch with something cleaner.

If I'm not mistaken your patch fixes the compilation breakage by unselecting 
PINCTRL and making it possible no to select GPIOLIB. I'm fine with that as an 
interim solution, but I wonder whether we shouldn't just force PINCTRL and 
GPIOLIB for ARCH_SHMOBILE at some point.

> 
>  arch/arm/Kconfig |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- 0001/arch/arm/Kconfig
> +++ work/arch/arm/Kconfig	2013-03-18 14:56:17.000000000 +0900
> @@ -725,7 +725,7 @@ config ARCH_SHMOBILE
>  	select MULTI_IRQ_HANDLER
>  	select NEED_MACH_MEMORY_H
>  	select NO_IOPORT
> -	select PINCTRL
> +	select PINCTRL if ARCH_WANT_OPTIONAL_GPIOLIB



>  	select PM_GENERIC_DOMAINS if PM
>  	select SPARSE_IRQ
>  	help
Magnus Damm March 26, 2013, 4:04 a.m. UTC | #3
Hi Laurent,

On Thu, Mar 21, 2013 at 12:28 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Magnus,
>
> Thanks for the patch.
>
> On Monday 18 March 2013 22:58:18 Magnus Damm wrote:
>> From: Magnus Damm <damm@opensource.se>
>>
>> Modify mach-shmobile to only select PINCTRL in case of
>> ARCH_WANT_OPTIONAL_GPIOLIB is set.
>>
>> This fixes a build error triggered when adding a new SoC
>> lacking GPIO software support (ARCH_WANT_OPTIONAL_GPIOLIB=n):
>>
>>  CC      drivers/tty/vt/keyboard.o
>> In file included from drivers/pinctrl/core.c:30:0:
>> include/asm-generic/gpio.h: In function 'gpio_get_value_cansleep':
>> include/asm-generic/gpio.h:270:2: error: implicit declaration of function
>> '__gpio_get_value'
>> include/asm-generic/gpio.h: In function 'gpio_set_value_cansleep':
>> include/asm-generic/gpio.h:276:2: error: implicit declaration of function
>> '__gpio_set_value'
>> drivers/pinctrl/core.c: In function 'pinctrl_ready_for_gpio_range':
>> drivers/pinctrl/core.c:297:9: error: implicit declaration of function
>> 'gpio_to_chip'
>> drivers/pinctrl/core.c:297:27: warning: initialization makes pointer from
>> integer without a cast
>> drivers/pinctrl/core.c:304:45: error: dereferencing pointer to incomplete
>> type
>> drivers/pinctrl/core.c:305:26: error: dereferencing pointer to incomplete
>> type
>> drivers/pinctrl/core.c:305:39: error: dereferencing pointer to incomplete
>> type
>> make[2]: *** [drivers/pinctrl/core.o] Error 1
>> make[1]: *** [drivers/pinctrl] Error 2
>> make[1]: *** Waiting for unfinished jobs....
>>   LD      drivers/sh/built-in.o
>>
>> Signed-off-by: Magnus Damm <damm@opensource.se>
>>
>> ---
>>
>>  Using renesas.git "next" 811689afc214564c4a5f238ecf4d8bdc0e52b615
>>
>>  Trigger using the r8a73a4 patches that lack GPIO and PFC support.
>>
>>  I am more than happy to replace this patch with something cleaner.
>
> If I'm not mistaken your patch fixes the compilation breakage by unselecting
> PINCTRL and making it possible no to select GPIOLIB. I'm fine with that as an
> interim solution, but I wonder whether we shouldn't just force PINCTRL and
> GPIOLIB for ARCH_SHMOBILE at some point.

Thanks for your comments. I'm quite fine with any approach myself. My
main concern is to have to the mach-shmobile code in a state so it is
possible to add SoC support incrementally and start without any PFC or
GPIO and then add them one by one. Or add them together. Please note
that EMEV2 supports GPIO but not yet PINCTRL.

About this issue, the fact that selecting PINCTRL without GPIO results
in compile error makes me think that something needs slight adjustment
in the PFC code. Or perhaps PINCTRL without GPIO isn't a valid
combination? But if so, why do we have separate Kconfig entries?

Thanks,

/ magnus
Laurent Pinchart March 26, 2013, 3:23 p.m. UTC | #4
Hi Magnus,

On Tuesday 26 March 2013 13:04:25 Magnus Damm wrote:
> On Thu, Mar 21, 2013 at 12:28 AM, Laurent Pinchart wrote:
> > On Monday 18 March 2013 22:58:18 Magnus Damm wrote:
> >> From: Magnus Damm <damm@opensource.se>
> >> 
> >> Modify mach-shmobile to only select PINCTRL in case of
> >> ARCH_WANT_OPTIONAL_GPIOLIB is set.
> >> 
> >> This fixes a build error triggered when adding a new SoC
> >> 
> >> lacking GPIO software support (ARCH_WANT_OPTIONAL_GPIOLIB=n):
> >>  CC      drivers/tty/vt/keyboard.o
> >> 
> >> In file included from drivers/pinctrl/core.c:30:0:
> >> include/asm-generic/gpio.h: In function 'gpio_get_value_cansleep':
> >> include/asm-generic/gpio.h:270:2: error: implicit declaration of function
> >> '__gpio_get_value'
> >> include/asm-generic/gpio.h: In function 'gpio_set_value_cansleep':
> >> include/asm-generic/gpio.h:276:2: error: implicit declaration of function
> >> '__gpio_set_value'
> >> drivers/pinctrl/core.c: In function 'pinctrl_ready_for_gpio_range':
> >> drivers/pinctrl/core.c:297:9: error: implicit declaration of function
> >> 'gpio_to_chip'
> >> drivers/pinctrl/core.c:297:27: warning: initialization makes pointer from
> >> integer without a cast
> >> drivers/pinctrl/core.c:304:45: error: dereferencing pointer to incomplete
> >> type
> >> drivers/pinctrl/core.c:305:26: error: dereferencing pointer to incomplete
> >> type
> >> drivers/pinctrl/core.c:305:39: error: dereferencing pointer to incomplete
> >> type
> >> make[2]: *** [drivers/pinctrl/core.o] Error 1
> >> make[1]: *** [drivers/pinctrl] Error 2
> >> make[1]: *** Waiting for unfinished jobs....
> >> 
> >>   LD      drivers/sh/built-in.o
> >> 
> >> Signed-off-by: Magnus Damm <damm@opensource.se>
> >> 
> >> ---
> >> 
> >>  Using renesas.git "next" 811689afc214564c4a5f238ecf4d8bdc0e52b615
> >>  
> >>  Trigger using the r8a73a4 patches that lack GPIO and PFC support.
> >>  
> >>  I am more than happy to replace this patch with something cleaner.
> > 
> > If I'm not mistaken your patch fixes the compilation breakage by
> > unselecting PINCTRL and making it possible no to select GPIOLIB. I'm fine
> > with that as an interim solution, but I wonder whether we shouldn't just
> > force PINCTRL and GPIOLIB for ARCH_SHMOBILE at some point.
> 
> Thanks for your comments. I'm quite fine with any approach myself. My
> main concern is to have to the mach-shmobile code in a state so it is
> possible to add SoC support incrementally and start without any PFC or
> GPIO and then add them one by one. Or add them together. Please note
> that EMEV2 supports GPIO but not yet PINCTRL.

Right. In that case your patch is fine.

> About this issue, the fact that selecting PINCTRL without GPIO results
> in compile error makes me think that something needs slight adjustment
> in the PFC code.

The above errors come from the pinctrl core (although the PFC driver might not 
compile either in this case). Linus, what's your opinion on this ? Do we want 
to support systems with pinctrl but without gpiolib ?

> Or perhaps PINCTRL without GPIO isn't a valid combination? But if so, why do
> we have separate Kconfig entries?
Simon Horman March 27, 2013, 11:47 a.m. UTC | #5
On Tue, Mar 26, 2013 at 04:23:58PM +0100, Laurent Pinchart wrote:
> Hi Magnus,
> 
> On Tuesday 26 March 2013 13:04:25 Magnus Damm wrote:
> > On Thu, Mar 21, 2013 at 12:28 AM, Laurent Pinchart wrote:
> > > On Monday 18 March 2013 22:58:18 Magnus Damm wrote:
> > >> From: Magnus Damm <damm@opensource.se>
> > >> 
> > >> Modify mach-shmobile to only select PINCTRL in case of
> > >> ARCH_WANT_OPTIONAL_GPIOLIB is set.
> > >> 
> > >> This fixes a build error triggered when adding a new SoC
> > >> 
> > >> lacking GPIO software support (ARCH_WANT_OPTIONAL_GPIOLIB=n):
> > >>  CC      drivers/tty/vt/keyboard.o
> > >> 
> > >> In file included from drivers/pinctrl/core.c:30:0:
> > >> include/asm-generic/gpio.h: In function 'gpio_get_value_cansleep':
> > >> include/asm-generic/gpio.h:270:2: error: implicit declaration of function
> > >> '__gpio_get_value'
> > >> include/asm-generic/gpio.h: In function 'gpio_set_value_cansleep':
> > >> include/asm-generic/gpio.h:276:2: error: implicit declaration of function
> > >> '__gpio_set_value'
> > >> drivers/pinctrl/core.c: In function 'pinctrl_ready_for_gpio_range':
> > >> drivers/pinctrl/core.c:297:9: error: implicit declaration of function
> > >> 'gpio_to_chip'
> > >> drivers/pinctrl/core.c:297:27: warning: initialization makes pointer from
> > >> integer without a cast
> > >> drivers/pinctrl/core.c:304:45: error: dereferencing pointer to incomplete
> > >> type
> > >> drivers/pinctrl/core.c:305:26: error: dereferencing pointer to incomplete
> > >> type
> > >> drivers/pinctrl/core.c:305:39: error: dereferencing pointer to incomplete
> > >> type
> > >> make[2]: *** [drivers/pinctrl/core.o] Error 1
> > >> make[1]: *** [drivers/pinctrl] Error 2
> > >> make[1]: *** Waiting for unfinished jobs....
> > >> 
> > >>   LD      drivers/sh/built-in.o
> > >> 
> > >> Signed-off-by: Magnus Damm <damm@opensource.se>
> > >> 
> > >> ---
> > >> 
> > >>  Using renesas.git "next" 811689afc214564c4a5f238ecf4d8bdc0e52b615
> > >>  
> > >>  Trigger using the r8a73a4 patches that lack GPIO and PFC support.
> > >>  
> > >>  I am more than happy to replace this patch with something cleaner.
> > > 
> > > If I'm not mistaken your patch fixes the compilation breakage by
> > > unselecting PINCTRL and making it possible no to select GPIOLIB. I'm fine
> > > with that as an interim solution, but I wonder whether we shouldn't just
> > > force PINCTRL and GPIOLIB for ARCH_SHMOBILE at some point.
> > 
> > Thanks for your comments. I'm quite fine with any approach myself. My
> > main concern is to have to the mach-shmobile code in a state so it is
> > possible to add SoC support incrementally and start without any PFC or
> > GPIO and then add them one by one. Or add them together. Please note
> > that EMEV2 supports GPIO but not yet PINCTRL.
> 
> Right. In that case your patch is fine.
> 
> > About this issue, the fact that selecting PINCTRL without GPIO results
> > in compile error makes me think that something needs slight adjustment
> > in the PFC code.
> 
> The above errors come from the pinctrl core (although the PFC driver might not 
> compile either in this case). Linus, what's your opinion on this ? Do we want 
> to support systems with pinctrl but without gpiolib ?
> 
> > Or perhaps PINCTRL without GPIO isn't a valid combination? But if so, why do
> > we have separate Kconfig entries?

I am currently planning to apply this patch to the soc branch
of the renesas tree as Magnus's "[PATCH 00/04] ARM: shmobile: r8a73a4 SoC
support V3" series depends on it and I'd rather not block that series.

I realise that this patch is a temporary fix. A more permanent
solution can be based on top of it.
Linus Walleij April 9, 2013, 8:06 a.m. UTC | #6
On Tue, Mar 26, 2013 at 4:23 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:

>> About this issue, the fact that selecting PINCTRL without GPIO results
>> in compile error makes me think that something needs slight adjustment
>> in the PFC code.
>
> The above errors come from the pinctrl core (although the PFC driver might not
> compile either in this case). Linus, what's your opinion on this ? Do we want
> to support systems with pinctrl but without gpiolib ?

Yes. It is perfectly legal to have pin controllers that do not correlate
GPIO ranges.

Does commit 2afe8229687ec24cbc07e78449a588bb8b68f858
"pinctrl: core: add dependence of GPIOLIB"
by Haojian fix this issue?

Yours,
Linus Walleij
Laurent Pinchart April 9, 2013, 2:07 p.m. UTC | #7
Hi Linus,

On Tuesday 09 April 2013 10:06:45 Linus Walleij wrote:
> On Tue, Mar 26, 2013 at 4:23 PM, Laurent Pinchart wrote:
> >> About this issue, the fact that selecting PINCTRL without GPIO results
> >> in compile error makes me think that something needs slight adjustment
> >> in the PFC code.
> > 
> > The above errors come from the pinctrl core (although the PFC driver might
> > not compile either in this case). Linus, what's your opinion on this ? Do
> > we want to support systems with pinctrl but without gpiolib ?
> 
> Yes. It is perfectly legal to have pin controllers that do not correlate
> GPIO ranges.
> 
> Does commit 2afe8229687ec24cbc07e78449a588bb8b68f858
> "pinctrl: core: add dependence of GPIOLIB"
> by Haojian fix this issue?

Yes it does.

I've just sent a patch that makes GPIOLIB support optional in the PFC driver. 
Magnus, with these two, should we revert 
6722f6cb763203cab775297b6e9d00834af0d6d7 ?
diff mbox

Patch

--- 0001/arch/arm/Kconfig
+++ work/arch/arm/Kconfig	2013-03-18 14:56:17.000000000 +0900
@@ -725,7 +725,7 @@  config ARCH_SHMOBILE
 	select MULTI_IRQ_HANDLER
 	select NEED_MACH_MEMORY_H
 	select NO_IOPORT
-	select PINCTRL
+	select PINCTRL if ARCH_WANT_OPTIONAL_GPIOLIB
 	select PM_GENERIC_DOMAINS if PM
 	select SPARSE_IRQ
 	help