All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: mediatek: fix mtk_eint link error
@ 2020-04-29 13:24 ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2020-04-29 13:24 UTC (permalink / raw)
  To: Sean Wang, Linus Walleij, Matthias Brugger, Light Hsieh
  Cc: Arnd Bergmann, Sean Wang, linux-gpio, linux-kernel, linux-arm-kernel

In a configuration with CONFIG_PINCTRL_MTK_MOORE=y and CONFIG_PINCTRL_MTK_PARIS=m,
we end up with the mtk_eint driver as a loadable module that cannot be
linked from built-in code:

aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.o: in function `mtk_build_eint':
(.text+0x304): undefined reference to `mtk_eint_do_init'
aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-moore.o: in function `mtk_gpio_set_config':
pinctrl-moore.c:(.text+0xf80): undefined reference to `mtk_eint_set_debounce'
aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-moore.o: in function `mtk_gpio_to_irq':
pinctrl-moore.c:(.text+0x1028): undefined reference to `mtk_eint_find_irq'

Simplify the Kconfig logic to always select EINT_MTK when it is needed, and
remove the 'default' statements.

Fixes: 8174a8512e3e ("pinctrl: mediatek: make MediaTek pinctrl v2 driver ready for buidling loadable module")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/pinctrl/mediatek/Kconfig    |  4 +---
 drivers/pinctrl/mediatek/mtk-eint.h | 28 ----------------------------
 2 files changed, 1 insertion(+), 31 deletions(-)

diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
index f32d3644c509..b6a8d91f4885 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
@@ -7,8 +7,6 @@ config EINT_MTK
 	depends on PINCTRL_MTK || PINCTRL_MTK_MOORE || PINCTRL_MTK_PARIS || COMPILE_TEST
 	select GPIOLIB
 	select IRQ_DOMAIN
-	default y if PINCTRL_MTK || PINCTRL_MTK_MOORE
-	default PINCTRL_MTK_PARIS
 
 config PINCTRL_MTK
 	bool
@@ -20,6 +18,7 @@ config PINCTRL_MTK
 	select OF_GPIO
 
 config PINCTRL_MTK_V2
+	select EINT_MTK
 	tristate
 
 config PINCTRL_MTK_MOORE
@@ -38,7 +37,6 @@ config PINCTRL_MTK_PARIS
 	select PINMUX
 	select GENERIC_PINCONF
 	select GPIOLIB
-	select EINT_MTK
 	select OF_GPIO
 	select PINCTRL_MTK_V2
 
diff --git a/drivers/pinctrl/mediatek/mtk-eint.h b/drivers/pinctrl/mediatek/mtk-eint.h
index 48468d0fae68..f40dab50a5f3 100644
--- a/drivers/pinctrl/mediatek/mtk-eint.h
+++ b/drivers/pinctrl/mediatek/mtk-eint.h
@@ -68,7 +68,6 @@ struct mtk_eint {
 	const struct mtk_eint_xt *gpio_xlate;
 };
 
-#if IS_ENABLED(CONFIG_EINT_MTK)
 int mtk_eint_do_init(struct mtk_eint *eint);
 int mtk_eint_do_suspend(struct mtk_eint *eint);
 int mtk_eint_do_resume(struct mtk_eint *eint);
@@ -76,31 +75,4 @@ int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_n,
 			  unsigned int debounce);
 int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n);
 
-#else
-static inline int mtk_eint_do_init(struct mtk_eint *eint)
-{
-	return -EOPNOTSUPP;
-}
-
-static inline int mtk_eint_do_suspend(struct mtk_eint *eint)
-{
-	return -EOPNOTSUPP;
-}
-
-static inline int mtk_eint_do_resume(struct mtk_eint *eint)
-{
-	return -EOPNOTSUPP;
-}
-
-static inline int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_n,
-			  unsigned int debounce)
-{
-	return -EOPNOTSUPP;
-}
-
-static inline int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n)
-{
-	return -EOPNOTSUPP;
-}
-#endif
 #endif /* __MTK_EINT_H */
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] pinctrl: mediatek: fix mtk_eint link error
@ 2020-04-29 13:24 ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2020-04-29 13:24 UTC (permalink / raw)
  To: Sean Wang, Linus Walleij, Matthias Brugger, Light Hsieh
  Cc: linux-arm-kernel, linux-gpio, Sean Wang, linux-kernel, Arnd Bergmann

In a configuration with CONFIG_PINCTRL_MTK_MOORE=y and CONFIG_PINCTRL_MTK_PARIS=m,
we end up with the mtk_eint driver as a loadable module that cannot be
linked from built-in code:

aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.o: in function `mtk_build_eint':
(.text+0x304): undefined reference to `mtk_eint_do_init'
aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-moore.o: in function `mtk_gpio_set_config':
pinctrl-moore.c:(.text+0xf80): undefined reference to `mtk_eint_set_debounce'
aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-moore.o: in function `mtk_gpio_to_irq':
pinctrl-moore.c:(.text+0x1028): undefined reference to `mtk_eint_find_irq'

Simplify the Kconfig logic to always select EINT_MTK when it is needed, and
remove the 'default' statements.

Fixes: 8174a8512e3e ("pinctrl: mediatek: make MediaTek pinctrl v2 driver ready for buidling loadable module")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/pinctrl/mediatek/Kconfig    |  4 +---
 drivers/pinctrl/mediatek/mtk-eint.h | 28 ----------------------------
 2 files changed, 1 insertion(+), 31 deletions(-)

diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
index f32d3644c509..b6a8d91f4885 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
@@ -7,8 +7,6 @@ config EINT_MTK
 	depends on PINCTRL_MTK || PINCTRL_MTK_MOORE || PINCTRL_MTK_PARIS || COMPILE_TEST
 	select GPIOLIB
 	select IRQ_DOMAIN
-	default y if PINCTRL_MTK || PINCTRL_MTK_MOORE
-	default PINCTRL_MTK_PARIS
 
 config PINCTRL_MTK
 	bool
@@ -20,6 +18,7 @@ config PINCTRL_MTK
 	select OF_GPIO
 
 config PINCTRL_MTK_V2
+	select EINT_MTK
 	tristate
 
 config PINCTRL_MTK_MOORE
@@ -38,7 +37,6 @@ config PINCTRL_MTK_PARIS
 	select PINMUX
 	select GENERIC_PINCONF
 	select GPIOLIB
-	select EINT_MTK
 	select OF_GPIO
 	select PINCTRL_MTK_V2
 
diff --git a/drivers/pinctrl/mediatek/mtk-eint.h b/drivers/pinctrl/mediatek/mtk-eint.h
index 48468d0fae68..f40dab50a5f3 100644
--- a/drivers/pinctrl/mediatek/mtk-eint.h
+++ b/drivers/pinctrl/mediatek/mtk-eint.h
@@ -68,7 +68,6 @@ struct mtk_eint {
 	const struct mtk_eint_xt *gpio_xlate;
 };
 
-#if IS_ENABLED(CONFIG_EINT_MTK)
 int mtk_eint_do_init(struct mtk_eint *eint);
 int mtk_eint_do_suspend(struct mtk_eint *eint);
 int mtk_eint_do_resume(struct mtk_eint *eint);
@@ -76,31 +75,4 @@ int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_n,
 			  unsigned int debounce);
 int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n);
 
-#else
-static inline int mtk_eint_do_init(struct mtk_eint *eint)
-{
-	return -EOPNOTSUPP;
-}
-
-static inline int mtk_eint_do_suspend(struct mtk_eint *eint)
-{
-	return -EOPNOTSUPP;
-}
-
-static inline int mtk_eint_do_resume(struct mtk_eint *eint)
-{
-	return -EOPNOTSUPP;
-}
-
-static inline int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_n,
-			  unsigned int debounce)
-{
-	return -EOPNOTSUPP;
-}
-
-static inline int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n)
-{
-	return -EOPNOTSUPP;
-}
-#endif
 #endif /* __MTK_EINT_H */
-- 
2.26.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: mediatek: fix mtk_eint link error
  2020-04-29 13:24 ` Arnd Bergmann
@ 2020-04-30  6:41   ` Light Hsieh
  -1 siblings, 0 replies; 4+ messages in thread
From: Light Hsieh @ 2020-04-30  6:41 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Sean Wang, Linus Walleij, Matthias Brugger, Sean Wang,
	linux-gpio, linux-kernel, linux-arm-kernel

On Wed, 2020-04-29 at 15:24 +0200, Arnd Bergmann wrote:
> In a configuration with CONFIG_PINCTRL_MTK_MOORE=y and CONFIG_PINCTRL_MTK_PARIS=m,
> we end up with the mtk_eint driver as a loadable module that cannot be
> linked from built-in code:

How did you set all MTK-related PINCTRL configs?
and what is the generated result of .config?



> aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.o: in function `mtk_build_eint':
> (.text+0x304): undefined reference to `mtk_eint_do_init'
> aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-moore.o: in function `mtk_gpio_set_config':
> pinctrl-moore.c:(.text+0xf80): undefined reference to `mtk_eint_set_debounce'
> aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-moore.o: in function `mtk_gpio_to_irq':
> pinctrl-moore.c:(.text+0x1028): undefined reference to `mtk_eint_find_irq'
> 
> Simplify the Kconfig logic to always select EINT_MTK when it is needed, and
> remove the 'default' statements.
> 
> Fixes: 8174a8512e3e ("pinctrl: mediatek: make MediaTek pinctrl v2 driver ready for buidling loadable module")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/pinctrl/mediatek/Kconfig    |  4 +---
>  drivers/pinctrl/mediatek/mtk-eint.h | 28 ----------------------------
>  2 files changed, 1 insertion(+), 31 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
> index f32d3644c509..b6a8d91f4885 100644
> --- a/drivers/pinctrl/mediatek/Kconfig
> +++ b/drivers/pinctrl/mediatek/Kconfig
> @@ -7,8 +7,6 @@ config EINT_MTK
>  	depends on PINCTRL_MTK || PINCTRL_MTK_MOORE || PINCTRL_MTK_PARIS || COMPILE_TEST
>  	select GPIOLIB
>  	select IRQ_DOMAIN
> -	default y if PINCTRL_MTK || PINCTRL_MTK_MOORE
> -	default PINCTRL_MTK_PARIS
>  
>  config PINCTRL_MTK
>  	bool
> @@ -20,6 +18,7 @@ config PINCTRL_MTK
>  	select OF_GPIO
>  
>  config PINCTRL_MTK_V2
> +	select EINT_MTK
>  	tristate
>  
>  config PINCTRL_MTK_MOORE
> @@ -38,7 +37,6 @@ config PINCTRL_MTK_PARIS
>  	select PINMUX
>  	select GENERIC_PINCONF
>  	select GPIOLIB
> -	select EINT_MTK
>  	select OF_GPIO
>  	select PINCTRL_MTK_V2

With this modification,PINCTRK_MTK_MOORE always select EINT_MTK
(indirectly via select PINCTRL_MTK_V2).
However, in previous review, Sean Wang said that PINCTRL_MTK_MOORE does
not always use EINT_MTK so PINCTRL_MTK_MOORE shall not select EINT_MTK
un-conditionally.


>  
> diff --git a/drivers/pinctrl/mediatek/mtk-eint.h b/drivers/pinctrl/mediatek/mtk-eint.h
> index 48468d0fae68..f40dab50a5f3 100644
> --- a/drivers/pinctrl/mediatek/mtk-eint.h
> +++ b/drivers/pinctrl/mediatek/mtk-eint.h
> @@ -68,7 +68,6 @@ struct mtk_eint {
>  	const struct mtk_eint_xt *gpio_xlate;
>  };
>  
> -#if IS_ENABLED(CONFIG_EINT_MTK)
>  int mtk_eint_do_init(struct mtk_eint *eint);
>  int mtk_eint_do_suspend(struct mtk_eint *eint);
>  int mtk_eint_do_resume(struct mtk_eint *eint);
> @@ -76,31 +75,4 @@ int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_n,
>  			  unsigned int debounce);
>  int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n);
>  
> -#else
> -static inline int mtk_eint_do_init(struct mtk_eint *eint)
> -{
> -	return -EOPNOTSUPP;
> -}
> -
> -static inline int mtk_eint_do_suspend(struct mtk_eint *eint)
> -{
> -	return -EOPNOTSUPP;
> -}
> -
> -static inline int mtk_eint_do_resume(struct mtk_eint *eint)
> -{
> -	return -EOPNOTSUPP;
> -}
> -
> -static inline int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_n,
> -			  unsigned int debounce)
> -{
> -	return -EOPNOTSUPP;
> -}
> -
> -static inline int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n)
> -{
> -	return -EOPNOTSUPP;
> -}
> -#endif
>  #endif /* __MTK_EINT_H */


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl: mediatek: fix mtk_eint link error
@ 2020-04-30  6:41   ` Light Hsieh
  0 siblings, 0 replies; 4+ messages in thread
From: Light Hsieh @ 2020-04-30  6:41 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Sean Wang, Linus Walleij, Sean Wang, linux-kernel, linux-gpio,
	Matthias Brugger, linux-arm-kernel

On Wed, 2020-04-29 at 15:24 +0200, Arnd Bergmann wrote:
> In a configuration with CONFIG_PINCTRL_MTK_MOORE=y and CONFIG_PINCTRL_MTK_PARIS=m,
> we end up with the mtk_eint driver as a loadable module that cannot be
> linked from built-in code:

How did you set all MTK-related PINCTRL configs?
and what is the generated result of .config?



> aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.o: in function `mtk_build_eint':
> (.text+0x304): undefined reference to `mtk_eint_do_init'
> aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-moore.o: in function `mtk_gpio_set_config':
> pinctrl-moore.c:(.text+0xf80): undefined reference to `mtk_eint_set_debounce'
> aarch64-linux-ld: drivers/pinctrl/mediatek/pinctrl-moore.o: in function `mtk_gpio_to_irq':
> pinctrl-moore.c:(.text+0x1028): undefined reference to `mtk_eint_find_irq'
> 
> Simplify the Kconfig logic to always select EINT_MTK when it is needed, and
> remove the 'default' statements.
> 
> Fixes: 8174a8512e3e ("pinctrl: mediatek: make MediaTek pinctrl v2 driver ready for buidling loadable module")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/pinctrl/mediatek/Kconfig    |  4 +---
>  drivers/pinctrl/mediatek/mtk-eint.h | 28 ----------------------------
>  2 files changed, 1 insertion(+), 31 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
> index f32d3644c509..b6a8d91f4885 100644
> --- a/drivers/pinctrl/mediatek/Kconfig
> +++ b/drivers/pinctrl/mediatek/Kconfig
> @@ -7,8 +7,6 @@ config EINT_MTK
>  	depends on PINCTRL_MTK || PINCTRL_MTK_MOORE || PINCTRL_MTK_PARIS || COMPILE_TEST
>  	select GPIOLIB
>  	select IRQ_DOMAIN
> -	default y if PINCTRL_MTK || PINCTRL_MTK_MOORE
> -	default PINCTRL_MTK_PARIS
>  
>  config PINCTRL_MTK
>  	bool
> @@ -20,6 +18,7 @@ config PINCTRL_MTK
>  	select OF_GPIO
>  
>  config PINCTRL_MTK_V2
> +	select EINT_MTK
>  	tristate
>  
>  config PINCTRL_MTK_MOORE
> @@ -38,7 +37,6 @@ config PINCTRL_MTK_PARIS
>  	select PINMUX
>  	select GENERIC_PINCONF
>  	select GPIOLIB
> -	select EINT_MTK
>  	select OF_GPIO
>  	select PINCTRL_MTK_V2

With this modification,PINCTRK_MTK_MOORE always select EINT_MTK
(indirectly via select PINCTRL_MTK_V2).
However, in previous review, Sean Wang said that PINCTRL_MTK_MOORE does
not always use EINT_MTK so PINCTRL_MTK_MOORE shall not select EINT_MTK
un-conditionally.


>  
> diff --git a/drivers/pinctrl/mediatek/mtk-eint.h b/drivers/pinctrl/mediatek/mtk-eint.h
> index 48468d0fae68..f40dab50a5f3 100644
> --- a/drivers/pinctrl/mediatek/mtk-eint.h
> +++ b/drivers/pinctrl/mediatek/mtk-eint.h
> @@ -68,7 +68,6 @@ struct mtk_eint {
>  	const struct mtk_eint_xt *gpio_xlate;
>  };
>  
> -#if IS_ENABLED(CONFIG_EINT_MTK)
>  int mtk_eint_do_init(struct mtk_eint *eint);
>  int mtk_eint_do_suspend(struct mtk_eint *eint);
>  int mtk_eint_do_resume(struct mtk_eint *eint);
> @@ -76,31 +75,4 @@ int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_n,
>  			  unsigned int debounce);
>  int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n);
>  
> -#else
> -static inline int mtk_eint_do_init(struct mtk_eint *eint)
> -{
> -	return -EOPNOTSUPP;
> -}
> -
> -static inline int mtk_eint_do_suspend(struct mtk_eint *eint)
> -{
> -	return -EOPNOTSUPP;
> -}
> -
> -static inline int mtk_eint_do_resume(struct mtk_eint *eint)
> -{
> -	return -EOPNOTSUPP;
> -}
> -
> -static inline int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_n,
> -			  unsigned int debounce)
> -{
> -	return -EOPNOTSUPP;
> -}
> -
> -static inline int mtk_eint_find_irq(struct mtk_eint *eint, unsigned long eint_n)
> -{
> -	return -EOPNOTSUPP;
> -}
> -#endif
>  #endif /* __MTK_EINT_H */

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-30  6:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 13:24 [PATCH] pinctrl: mediatek: fix mtk_eint link error Arnd Bergmann
2020-04-29 13:24 ` Arnd Bergmann
2020-04-30  6:41 ` Light Hsieh
2020-04-30  6:41   ` Light Hsieh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.