* [PATCH] gpio: omap: Allow building as a loadable module
@ 2015-04-23 23:56 ` Tony Lindgren
0 siblings, 0 replies; 12+ messages in thread
From: Tony Lindgren @ 2015-04-23 23:56 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: linux-gpio, linux-omap, linux-arm-kernel, Felipe Balbi,
Javier Martinez Canillas, Grygorii Strashko, Kevin Hilman,
Nishanth Menon, Santosh Shilimkar
We currently get all kinds of errors building the omap gpio driver
as a module starting with:
undefined reference to `omap2_gpio_resume_after_idle'
undefined reference to `omap2_gpio_prepare_for_idle'
...
Let's fix the issue by adding inline functions to the header.
Note that we can now also remove the two unused functions for
omap_set_gpio_debounce and omap_set_gpio_debounce_time.
Then doing rmmod on the module produces further warnings
because of missing exit related functions. Let's add those.
And finally, we can make the Kconfig entry just a tristate
option that's selected for omaps.
Cc: Felipe Balbi <balbi@ti.com>
Cc: Javier Martinez Canillas <javier@dowhile0.org>
Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/gpio/Kconfig | 2 +-
drivers/gpio/gpio-omap.c | 24 ++++++++++++++++++++++++
include/linux/platform_data/gpio-omap.h | 12 ++++++++++--
3 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index caefe80..ff7df95 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -308,7 +308,7 @@ config GPIO_OCTEON
family of SOCs.
config GPIO_OMAP
- bool "TI OMAP GPIO support" if COMPILE_TEST && !ARCH_OMAP2PLUS
+ tristate "TI OMAP GPIO support" if ARCH_OMAP2PLUS || COMPILE_TEST
default y if ARCH_OMAP
depends on ARM
select GENERIC_IRQ_CHIP
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index b59c3ca..384a852 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1202,6 +1202,17 @@ static int omap_gpio_probe(struct platform_device *pdev)
return 0;
}
+static int omap_gpio_remove(struct platform_device *pdev)
+{
+ struct gpio_bank *bank = platform_get_drvdata(pdev);
+
+ list_del(&bank->node);
+ gpiochip_remove(&bank->chip);
+ pm_runtime_disable(bank->dev);
+
+ return 0;
+}
+
#ifdef CONFIG_ARCH_OMAP2PLUS
#if defined(CONFIG_PM)
@@ -1387,6 +1398,7 @@ static int omap_gpio_runtime_resume(struct device *dev)
}
#endif /* CONFIG_PM */
+#if IS_BUILTIN(CONFIG_GPIO_OMAP)
void omap2_gpio_prepare_for_idle(int pwr_mode)
{
struct gpio_bank *bank;
@@ -1412,6 +1424,7 @@ void omap2_gpio_resume_after_idle(void)
pm_runtime_get_sync(bank->dev);
}
}
+#endif
#if defined(CONFIG_PM)
static void omap_gpio_init_context(struct gpio_bank *p)
@@ -1567,6 +1580,7 @@ MODULE_DEVICE_TABLE(of, omap_gpio_match);
static struct platform_driver omap_gpio_driver = {
.probe = omap_gpio_probe,
+ .remove = omap_gpio_remove,
.driver = {
.name = "omap_gpio",
.pm = &gpio_pm_ops,
@@ -1584,3 +1598,13 @@ static int __init omap_gpio_drv_reg(void)
return platform_driver_register(&omap_gpio_driver);
}
postcore_initcall(omap_gpio_drv_reg);
+
+static void __exit omap_gpio_exit(void)
+{
+ platform_driver_unregister(&omap_gpio_driver);
+}
+module_exit(omap_gpio_exit);
+
+MODULE_DESCRIPTION("omap gpio driver");
+MODULE_ALIAS("platform:gpio-omap");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h
index 5d50b25..cb26181 100644
--- a/include/linux/platform_data/gpio-omap.h
+++ b/include/linux/platform_data/gpio-omap.h
@@ -208,9 +208,17 @@ struct omap_gpio_platform_data {
int (*get_context_loss_count)(struct device *dev);
};
+#if IS_BUILTIN(CONFIG_GPIO_OMAP)
extern void omap2_gpio_prepare_for_idle(int off_mode);
extern void omap2_gpio_resume_after_idle(void);
-extern void omap_set_gpio_debounce(int gpio, int enable);
-extern void omap_set_gpio_debounce_time(int gpio, int enable);
+#else
+static inline void omap2_gpio_prepare_for_idle(int off_mode)
+{
+}
+
+static inline void omap2_gpio_resume_after_idle(void)
+{
+}
+#endif
#endif
--
2.1.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] gpio: omap: Allow building as a loadable module
@ 2015-04-23 23:56 ` Tony Lindgren
0 siblings, 0 replies; 12+ messages in thread
From: Tony Lindgren @ 2015-04-23 23:56 UTC (permalink / raw)
To: linux-arm-kernel
We currently get all kinds of errors building the omap gpio driver
as a module starting with:
undefined reference to `omap2_gpio_resume_after_idle'
undefined reference to `omap2_gpio_prepare_for_idle'
...
Let's fix the issue by adding inline functions to the header.
Note that we can now also remove the two unused functions for
omap_set_gpio_debounce and omap_set_gpio_debounce_time.
Then doing rmmod on the module produces further warnings
because of missing exit related functions. Let's add those.
And finally, we can make the Kconfig entry just a tristate
option that's selected for omaps.
Cc: Felipe Balbi <balbi@ti.com>
Cc: Javier Martinez Canillas <javier@dowhile0.org>
Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
drivers/gpio/Kconfig | 2 +-
drivers/gpio/gpio-omap.c | 24 ++++++++++++++++++++++++
include/linux/platform_data/gpio-omap.h | 12 ++++++++++--
3 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index caefe80..ff7df95 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -308,7 +308,7 @@ config GPIO_OCTEON
family of SOCs.
config GPIO_OMAP
- bool "TI OMAP GPIO support" if COMPILE_TEST && !ARCH_OMAP2PLUS
+ tristate "TI OMAP GPIO support" if ARCH_OMAP2PLUS || COMPILE_TEST
default y if ARCH_OMAP
depends on ARM
select GENERIC_IRQ_CHIP
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index b59c3ca..384a852 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1202,6 +1202,17 @@ static int omap_gpio_probe(struct platform_device *pdev)
return 0;
}
+static int omap_gpio_remove(struct platform_device *pdev)
+{
+ struct gpio_bank *bank = platform_get_drvdata(pdev);
+
+ list_del(&bank->node);
+ gpiochip_remove(&bank->chip);
+ pm_runtime_disable(bank->dev);
+
+ return 0;
+}
+
#ifdef CONFIG_ARCH_OMAP2PLUS
#if defined(CONFIG_PM)
@@ -1387,6 +1398,7 @@ static int omap_gpio_runtime_resume(struct device *dev)
}
#endif /* CONFIG_PM */
+#if IS_BUILTIN(CONFIG_GPIO_OMAP)
void omap2_gpio_prepare_for_idle(int pwr_mode)
{
struct gpio_bank *bank;
@@ -1412,6 +1424,7 @@ void omap2_gpio_resume_after_idle(void)
pm_runtime_get_sync(bank->dev);
}
}
+#endif
#if defined(CONFIG_PM)
static void omap_gpio_init_context(struct gpio_bank *p)
@@ -1567,6 +1580,7 @@ MODULE_DEVICE_TABLE(of, omap_gpio_match);
static struct platform_driver omap_gpio_driver = {
.probe = omap_gpio_probe,
+ .remove = omap_gpio_remove,
.driver = {
.name = "omap_gpio",
.pm = &gpio_pm_ops,
@@ -1584,3 +1598,13 @@ static int __init omap_gpio_drv_reg(void)
return platform_driver_register(&omap_gpio_driver);
}
postcore_initcall(omap_gpio_drv_reg);
+
+static void __exit omap_gpio_exit(void)
+{
+ platform_driver_unregister(&omap_gpio_driver);
+}
+module_exit(omap_gpio_exit);
+
+MODULE_DESCRIPTION("omap gpio driver");
+MODULE_ALIAS("platform:gpio-omap");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h
index 5d50b25..cb26181 100644
--- a/include/linux/platform_data/gpio-omap.h
+++ b/include/linux/platform_data/gpio-omap.h
@@ -208,9 +208,17 @@ struct omap_gpio_platform_data {
int (*get_context_loss_count)(struct device *dev);
};
+#if IS_BUILTIN(CONFIG_GPIO_OMAP)
extern void omap2_gpio_prepare_for_idle(int off_mode);
extern void omap2_gpio_resume_after_idle(void);
-extern void omap_set_gpio_debounce(int gpio, int enable);
-extern void omap_set_gpio_debounce_time(int gpio, int enable);
+#else
+static inline void omap2_gpio_prepare_for_idle(int off_mode)
+{
+}
+
+static inline void omap2_gpio_resume_after_idle(void)
+{
+}
+#endif
#endif
--
2.1.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] gpio: omap: Allow building as a loadable module
2015-04-23 23:56 ` Tony Lindgren
@ 2015-04-24 14:59 ` Grygorii.Strashko@linaro.org
-1 siblings, 0 replies; 12+ messages in thread
From: Grygorii.Strashko@linaro.org @ 2015-04-24 14:59 UTC (permalink / raw)
To: Tony Lindgren, Linus Walleij, Alexandre Courbot
Cc: linux-gpio, linux-omap, linux-arm-kernel, Felipe Balbi,
Javier Martinez Canillas, Kevin Hilman, Nishanth Menon,
Santosh Shilimkar
On 04/24/2015 02:56 AM, Tony Lindgren wrote:
> We currently get all kinds of errors building the omap gpio driver
> as a module starting with:
>
> undefined reference to `omap2_gpio_resume_after_idle'
> undefined reference to `omap2_gpio_prepare_for_idle'
> ...
>
> Let's fix the issue by adding inline functions to the header.
> Note that we can now also remove the two unused functions for
> omap_set_gpio_debounce and omap_set_gpio_debounce_time.
>
> Then doing rmmod on the module produces further warnings
> because of missing exit related functions. Let's add those.
>
> And finally, we can make the Kconfig entry just a tristate
> option that's selected for omaps.
Reviewed-by: Grygorii Strashko <grygorii.strashko@linaro.org>
boot tested on: dra7-evm with gpio-omap.ko
>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
> drivers/gpio/Kconfig | 2 +-
> drivers/gpio/gpio-omap.c | 24 ++++++++++++++++++++++++
> include/linux/platform_data/gpio-omap.h | 12 ++++++++++--
> 3 files changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index caefe80..ff7df95 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -308,7 +308,7 @@ config GPIO_OCTEON
> family of SOCs.
>
> config GPIO_OMAP
> - bool "TI OMAP GPIO support" if COMPILE_TEST && !ARCH_OMAP2PLUS
> + tristate "TI OMAP GPIO support" if ARCH_OMAP2PLUS || COMPILE_TEST
> default y if ARCH_OMAP
> depends on ARM
> select GENERIC_IRQ_CHIP
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index b59c3ca..384a852 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1202,6 +1202,17 @@ static int omap_gpio_probe(struct platform_device *pdev)
> return 0;
> }
>
> +static int omap_gpio_remove(struct platform_device *pdev)
> +{
> + struct gpio_bank *bank = platform_get_drvdata(pdev);
> +
> + list_del(&bank->node);
> + gpiochip_remove(&bank->chip);
> + pm_runtime_disable(bank->dev);
> +
> + return 0;
> +}
> +
> #ifdef CONFIG_ARCH_OMAP2PLUS
>
> #if defined(CONFIG_PM)
> @@ -1387,6 +1398,7 @@ static int omap_gpio_runtime_resume(struct device *dev)
> }
> #endif /* CONFIG_PM */
>
> +#if IS_BUILTIN(CONFIG_GPIO_OMAP)
> void omap2_gpio_prepare_for_idle(int pwr_mode)
> {
> struct gpio_bank *bank;
> @@ -1412,6 +1424,7 @@ void omap2_gpio_resume_after_idle(void)
> pm_runtime_get_sync(bank->dev);
> }
> }
> +#endif
>
> #if defined(CONFIG_PM)
> static void omap_gpio_init_context(struct gpio_bank *p)
> @@ -1567,6 +1580,7 @@ MODULE_DEVICE_TABLE(of, omap_gpio_match);
>
> static struct platform_driver omap_gpio_driver = {
> .probe = omap_gpio_probe,
> + .remove = omap_gpio_remove,
> .driver = {
> .name = "omap_gpio",
> .pm = &gpio_pm_ops,
> @@ -1584,3 +1598,13 @@ static int __init omap_gpio_drv_reg(void)
> return platform_driver_register(&omap_gpio_driver);
> }
> postcore_initcall(omap_gpio_drv_reg);
> +
> +static void __exit omap_gpio_exit(void)
> +{
> + platform_driver_unregister(&omap_gpio_driver);
> +}
> +module_exit(omap_gpio_exit);
> +
> +MODULE_DESCRIPTION("omap gpio driver");
> +MODULE_ALIAS("platform:gpio-omap");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h
> index 5d50b25..cb26181 100644
> --- a/include/linux/platform_data/gpio-omap.h
> +++ b/include/linux/platform_data/gpio-omap.h
> @@ -208,9 +208,17 @@ struct omap_gpio_platform_data {
> int (*get_context_loss_count)(struct device *dev);
> };
>
> +#if IS_BUILTIN(CONFIG_GPIO_OMAP)
> extern void omap2_gpio_prepare_for_idle(int off_mode);
> extern void omap2_gpio_resume_after_idle(void);
> -extern void omap_set_gpio_debounce(int gpio, int enable);
> -extern void omap_set_gpio_debounce_time(int gpio, int enable);
> +#else
> +static inline void omap2_gpio_prepare_for_idle(int off_mode)
> +{
> +}
> +
> +static inline void omap2_gpio_resume_after_idle(void)
> +{
> +}
> +#endif
>
> #endif
>
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] gpio: omap: Allow building as a loadable module
@ 2015-04-24 14:59 ` Grygorii.Strashko@linaro.org
0 siblings, 0 replies; 12+ messages in thread
From: Grygorii.Strashko@linaro.org @ 2015-04-24 14:59 UTC (permalink / raw)
To: linux-arm-kernel
On 04/24/2015 02:56 AM, Tony Lindgren wrote:
> We currently get all kinds of errors building the omap gpio driver
> as a module starting with:
>
> undefined reference to `omap2_gpio_resume_after_idle'
> undefined reference to `omap2_gpio_prepare_for_idle'
> ...
>
> Let's fix the issue by adding inline functions to the header.
> Note that we can now also remove the two unused functions for
> omap_set_gpio_debounce and omap_set_gpio_debounce_time.
>
> Then doing rmmod on the module produces further warnings
> because of missing exit related functions. Let's add those.
>
> And finally, we can make the Kconfig entry just a tristate
> option that's selected for omaps.
Reviewed-by: Grygorii Strashko <grygorii.strashko@linaro.org>
boot tested on: dra7-evm with gpio-omap.ko
>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
> drivers/gpio/Kconfig | 2 +-
> drivers/gpio/gpio-omap.c | 24 ++++++++++++++++++++++++
> include/linux/platform_data/gpio-omap.h | 12 ++++++++++--
> 3 files changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index caefe80..ff7df95 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -308,7 +308,7 @@ config GPIO_OCTEON
> family of SOCs.
>
> config GPIO_OMAP
> - bool "TI OMAP GPIO support" if COMPILE_TEST && !ARCH_OMAP2PLUS
> + tristate "TI OMAP GPIO support" if ARCH_OMAP2PLUS || COMPILE_TEST
> default y if ARCH_OMAP
> depends on ARM
> select GENERIC_IRQ_CHIP
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index b59c3ca..384a852 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1202,6 +1202,17 @@ static int omap_gpio_probe(struct platform_device *pdev)
> return 0;
> }
>
> +static int omap_gpio_remove(struct platform_device *pdev)
> +{
> + struct gpio_bank *bank = platform_get_drvdata(pdev);
> +
> + list_del(&bank->node);
> + gpiochip_remove(&bank->chip);
> + pm_runtime_disable(bank->dev);
> +
> + return 0;
> +}
> +
> #ifdef CONFIG_ARCH_OMAP2PLUS
>
> #if defined(CONFIG_PM)
> @@ -1387,6 +1398,7 @@ static int omap_gpio_runtime_resume(struct device *dev)
> }
> #endif /* CONFIG_PM */
>
> +#if IS_BUILTIN(CONFIG_GPIO_OMAP)
> void omap2_gpio_prepare_for_idle(int pwr_mode)
> {
> struct gpio_bank *bank;
> @@ -1412,6 +1424,7 @@ void omap2_gpio_resume_after_idle(void)
> pm_runtime_get_sync(bank->dev);
> }
> }
> +#endif
>
> #if defined(CONFIG_PM)
> static void omap_gpio_init_context(struct gpio_bank *p)
> @@ -1567,6 +1580,7 @@ MODULE_DEVICE_TABLE(of, omap_gpio_match);
>
> static struct platform_driver omap_gpio_driver = {
> .probe = omap_gpio_probe,
> + .remove = omap_gpio_remove,
> .driver = {
> .name = "omap_gpio",
> .pm = &gpio_pm_ops,
> @@ -1584,3 +1598,13 @@ static int __init omap_gpio_drv_reg(void)
> return platform_driver_register(&omap_gpio_driver);
> }
> postcore_initcall(omap_gpio_drv_reg);
> +
> +static void __exit omap_gpio_exit(void)
> +{
> + platform_driver_unregister(&omap_gpio_driver);
> +}
> +module_exit(omap_gpio_exit);
> +
> +MODULE_DESCRIPTION("omap gpio driver");
> +MODULE_ALIAS("platform:gpio-omap");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h
> index 5d50b25..cb26181 100644
> --- a/include/linux/platform_data/gpio-omap.h
> +++ b/include/linux/platform_data/gpio-omap.h
> @@ -208,9 +208,17 @@ struct omap_gpio_platform_data {
> int (*get_context_loss_count)(struct device *dev);
> };
>
> +#if IS_BUILTIN(CONFIG_GPIO_OMAP)
> extern void omap2_gpio_prepare_for_idle(int off_mode);
> extern void omap2_gpio_resume_after_idle(void);
> -extern void omap_set_gpio_debounce(int gpio, int enable);
> -extern void omap_set_gpio_debounce_time(int gpio, int enable);
> +#else
> +static inline void omap2_gpio_prepare_for_idle(int off_mode)
> +{
> +}
> +
> +static inline void omap2_gpio_resume_after_idle(void)
> +{
> +}
> +#endif
>
> #endif
>
--
regards,
-grygorii
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] gpio: omap: Allow building as a loadable module
2015-04-23 23:56 ` Tony Lindgren
@ 2015-04-24 15:40 ` santosh shilimkar
-1 siblings, 0 replies; 12+ messages in thread
From: santosh shilimkar @ 2015-04-24 15:40 UTC (permalink / raw)
To: Tony Lindgren, Linus Walleij, Alexandre Courbot
Cc: linux-gpio, linux-omap, linux-arm-kernel, Felipe Balbi,
Javier Martinez Canillas, Grygorii Strashko, Kevin Hilman,
Nishanth Menon, Santosh Shilimkar
On 4/23/2015 4:56 PM, Tony Lindgren wrote:
> We currently get all kinds of errors building the omap gpio driver
> as a module starting with:
>
> undefined reference to `omap2_gpio_resume_after_idle'
> undefined reference to `omap2_gpio_prepare_for_idle'
> ...
>
> Let's fix the issue by adding inline functions to the header.
> Note that we can now also remove the two unused functions for
> omap_set_gpio_debounce and omap_set_gpio_debounce_time.
>
> Then doing rmmod on the module produces further warnings
> because of missing exit related functions. Let's add those.
>
> And finally, we can make the Kconfig entry just a tristate
> option that's selected for omaps.
>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
> drivers/gpio/Kconfig | 2 +-
> drivers/gpio/gpio-omap.c | 24 ++++++++++++++++++++++++
> include/linux/platform_data/gpio-omap.h | 12 ++++++++++--
> 3 files changed, 35 insertions(+), 3 deletions(-)
>
That platform header needs serious clean-up and we now
add two more inlines there.
But, being able to use gpio as loadable module
might be good enough reason to take this one.
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] gpio: omap: Allow building as a loadable module
@ 2015-04-24 15:40 ` santosh shilimkar
0 siblings, 0 replies; 12+ messages in thread
From: santosh shilimkar @ 2015-04-24 15:40 UTC (permalink / raw)
To: linux-arm-kernel
On 4/23/2015 4:56 PM, Tony Lindgren wrote:
> We currently get all kinds of errors building the omap gpio driver
> as a module starting with:
>
> undefined reference to `omap2_gpio_resume_after_idle'
> undefined reference to `omap2_gpio_prepare_for_idle'
> ...
>
> Let's fix the issue by adding inline functions to the header.
> Note that we can now also remove the two unused functions for
> omap_set_gpio_debounce and omap_set_gpio_debounce_time.
>
> Then doing rmmod on the module produces further warnings
> because of missing exit related functions. Let's add those.
>
> And finally, we can make the Kconfig entry just a tristate
> option that's selected for omaps.
>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
> drivers/gpio/Kconfig | 2 +-
> drivers/gpio/gpio-omap.c | 24 ++++++++++++++++++++++++
> include/linux/platform_data/gpio-omap.h | 12 ++++++++++--
> 3 files changed, 35 insertions(+), 3 deletions(-)
>
That platform header needs serious clean-up and we now
add two more inlines there.
But, being able to use gpio as loadable module
might be good enough reason to take this one.
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] gpio: omap: Allow building as a loadable module
2015-04-23 23:56 ` Tony Lindgren
@ 2015-04-24 16:11 ` Felipe Balbi
-1 siblings, 0 replies; 12+ messages in thread
From: Felipe Balbi @ 2015-04-24 16:11 UTC (permalink / raw)
To: Tony Lindgren
Cc: Linus Walleij, Alexandre Courbot, linux-gpio, linux-omap,
linux-arm-kernel, Felipe Balbi, Javier Martinez Canillas,
Grygorii Strashko, Kevin Hilman, Nishanth Menon,
Santosh Shilimkar
[-- Attachment #1: Type: text/plain, Size: 4497 bytes --]
On Thu, Apr 23, 2015 at 04:56:22PM -0700, Tony Lindgren wrote:
> We currently get all kinds of errors building the omap gpio driver
> as a module starting with:
>
> undefined reference to `omap2_gpio_resume_after_idle'
> undefined reference to `omap2_gpio_prepare_for_idle'
> ...
>
> Let's fix the issue by adding inline functions to the header.
> Note that we can now also remove the two unused functions for
> omap_set_gpio_debounce and omap_set_gpio_debounce_time.
>
> Then doing rmmod on the module produces further warnings
> because of missing exit related functions. Let's add those.
>
> And finally, we can make the Kconfig entry just a tristate
> option that's selected for omaps.
>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
Just to be clear: when GPIO is a module, we can't really idle, can we ?
Reviewed-by: Felipe Balbi <balbi@ti.com>
> ---
> drivers/gpio/Kconfig | 2 +-
> drivers/gpio/gpio-omap.c | 24 ++++++++++++++++++++++++
> include/linux/platform_data/gpio-omap.h | 12 ++++++++++--
> 3 files changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index caefe80..ff7df95 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -308,7 +308,7 @@ config GPIO_OCTEON
> family of SOCs.
>
> config GPIO_OMAP
> - bool "TI OMAP GPIO support" if COMPILE_TEST && !ARCH_OMAP2PLUS
> + tristate "TI OMAP GPIO support" if ARCH_OMAP2PLUS || COMPILE_TEST
> default y if ARCH_OMAP
> depends on ARM
> select GENERIC_IRQ_CHIP
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index b59c3ca..384a852 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1202,6 +1202,17 @@ static int omap_gpio_probe(struct platform_device *pdev)
> return 0;
> }
>
> +static int omap_gpio_remove(struct platform_device *pdev)
> +{
> + struct gpio_bank *bank = platform_get_drvdata(pdev);
> +
> + list_del(&bank->node);
> + gpiochip_remove(&bank->chip);
> + pm_runtime_disable(bank->dev);
> +
> + return 0;
> +}
> +
> #ifdef CONFIG_ARCH_OMAP2PLUS
>
> #if defined(CONFIG_PM)
> @@ -1387,6 +1398,7 @@ static int omap_gpio_runtime_resume(struct device *dev)
> }
> #endif /* CONFIG_PM */
>
> +#if IS_BUILTIN(CONFIG_GPIO_OMAP)
> void omap2_gpio_prepare_for_idle(int pwr_mode)
> {
> struct gpio_bank *bank;
> @@ -1412,6 +1424,7 @@ void omap2_gpio_resume_after_idle(void)
> pm_runtime_get_sync(bank->dev);
> }
> }
> +#endif
>
> #if defined(CONFIG_PM)
> static void omap_gpio_init_context(struct gpio_bank *p)
> @@ -1567,6 +1580,7 @@ MODULE_DEVICE_TABLE(of, omap_gpio_match);
>
> static struct platform_driver omap_gpio_driver = {
> .probe = omap_gpio_probe,
> + .remove = omap_gpio_remove,
> .driver = {
> .name = "omap_gpio",
> .pm = &gpio_pm_ops,
> @@ -1584,3 +1598,13 @@ static int __init omap_gpio_drv_reg(void)
> return platform_driver_register(&omap_gpio_driver);
> }
> postcore_initcall(omap_gpio_drv_reg);
> +
> +static void __exit omap_gpio_exit(void)
> +{
> + platform_driver_unregister(&omap_gpio_driver);
> +}
> +module_exit(omap_gpio_exit);
> +
> +MODULE_DESCRIPTION("omap gpio driver");
> +MODULE_ALIAS("platform:gpio-omap");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h
> index 5d50b25..cb26181 100644
> --- a/include/linux/platform_data/gpio-omap.h
> +++ b/include/linux/platform_data/gpio-omap.h
> @@ -208,9 +208,17 @@ struct omap_gpio_platform_data {
> int (*get_context_loss_count)(struct device *dev);
> };
>
> +#if IS_BUILTIN(CONFIG_GPIO_OMAP)
> extern void omap2_gpio_prepare_for_idle(int off_mode);
> extern void omap2_gpio_resume_after_idle(void);
> -extern void omap_set_gpio_debounce(int gpio, int enable);
> -extern void omap_set_gpio_debounce_time(int gpio, int enable);
> +#else
> +static inline void omap2_gpio_prepare_for_idle(int off_mode)
> +{
> +}
> +
> +static inline void omap2_gpio_resume_after_idle(void)
> +{
> +}
> +#endif
>
> #endif
> --
> 2.1.4
>
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] gpio: omap: Allow building as a loadable module
@ 2015-04-24 16:11 ` Felipe Balbi
0 siblings, 0 replies; 12+ messages in thread
From: Felipe Balbi @ 2015-04-24 16:11 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Apr 23, 2015 at 04:56:22PM -0700, Tony Lindgren wrote:
> We currently get all kinds of errors building the omap gpio driver
> as a module starting with:
>
> undefined reference to `omap2_gpio_resume_after_idle'
> undefined reference to `omap2_gpio_prepare_for_idle'
> ...
>
> Let's fix the issue by adding inline functions to the header.
> Note that we can now also remove the two unused functions for
> omap_set_gpio_debounce and omap_set_gpio_debounce_time.
>
> Then doing rmmod on the module produces further warnings
> because of missing exit related functions. Let's add those.
>
> And finally, we can make the Kconfig entry just a tristate
> option that's selected for omaps.
>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
Just to be clear: when GPIO is a module, we can't really idle, can we ?
Reviewed-by: Felipe Balbi <balbi@ti.com>
> ---
> drivers/gpio/Kconfig | 2 +-
> drivers/gpio/gpio-omap.c | 24 ++++++++++++++++++++++++
> include/linux/platform_data/gpio-omap.h | 12 ++++++++++--
> 3 files changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index caefe80..ff7df95 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -308,7 +308,7 @@ config GPIO_OCTEON
> family of SOCs.
>
> config GPIO_OMAP
> - bool "TI OMAP GPIO support" if COMPILE_TEST && !ARCH_OMAP2PLUS
> + tristate "TI OMAP GPIO support" if ARCH_OMAP2PLUS || COMPILE_TEST
> default y if ARCH_OMAP
> depends on ARM
> select GENERIC_IRQ_CHIP
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index b59c3ca..384a852 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -1202,6 +1202,17 @@ static int omap_gpio_probe(struct platform_device *pdev)
> return 0;
> }
>
> +static int omap_gpio_remove(struct platform_device *pdev)
> +{
> + struct gpio_bank *bank = platform_get_drvdata(pdev);
> +
> + list_del(&bank->node);
> + gpiochip_remove(&bank->chip);
> + pm_runtime_disable(bank->dev);
> +
> + return 0;
> +}
> +
> #ifdef CONFIG_ARCH_OMAP2PLUS
>
> #if defined(CONFIG_PM)
> @@ -1387,6 +1398,7 @@ static int omap_gpio_runtime_resume(struct device *dev)
> }
> #endif /* CONFIG_PM */
>
> +#if IS_BUILTIN(CONFIG_GPIO_OMAP)
> void omap2_gpio_prepare_for_idle(int pwr_mode)
> {
> struct gpio_bank *bank;
> @@ -1412,6 +1424,7 @@ void omap2_gpio_resume_after_idle(void)
> pm_runtime_get_sync(bank->dev);
> }
> }
> +#endif
>
> #if defined(CONFIG_PM)
> static void omap_gpio_init_context(struct gpio_bank *p)
> @@ -1567,6 +1580,7 @@ MODULE_DEVICE_TABLE(of, omap_gpio_match);
>
> static struct platform_driver omap_gpio_driver = {
> .probe = omap_gpio_probe,
> + .remove = omap_gpio_remove,
> .driver = {
> .name = "omap_gpio",
> .pm = &gpio_pm_ops,
> @@ -1584,3 +1598,13 @@ static int __init omap_gpio_drv_reg(void)
> return platform_driver_register(&omap_gpio_driver);
> }
> postcore_initcall(omap_gpio_drv_reg);
> +
> +static void __exit omap_gpio_exit(void)
> +{
> + platform_driver_unregister(&omap_gpio_driver);
> +}
> +module_exit(omap_gpio_exit);
> +
> +MODULE_DESCRIPTION("omap gpio driver");
> +MODULE_ALIAS("platform:gpio-omap");
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h
> index 5d50b25..cb26181 100644
> --- a/include/linux/platform_data/gpio-omap.h
> +++ b/include/linux/platform_data/gpio-omap.h
> @@ -208,9 +208,17 @@ struct omap_gpio_platform_data {
> int (*get_context_loss_count)(struct device *dev);
> };
>
> +#if IS_BUILTIN(CONFIG_GPIO_OMAP)
> extern void omap2_gpio_prepare_for_idle(int off_mode);
> extern void omap2_gpio_resume_after_idle(void);
> -extern void omap_set_gpio_debounce(int gpio, int enable);
> -extern void omap_set_gpio_debounce_time(int gpio, int enable);
> +#else
> +static inline void omap2_gpio_prepare_for_idle(int off_mode)
> +{
> +}
> +
> +static inline void omap2_gpio_resume_after_idle(void)
> +{
> +}
> +#endif
>
> #endif
> --
> 2.1.4
>
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150424/e9d135df/attachment-0001.sig>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] gpio: omap: Allow building as a loadable module
2015-04-24 16:11 ` Felipe Balbi
@ 2015-04-24 16:22 ` Tony Lindgren
-1 siblings, 0 replies; 12+ messages in thread
From: Tony Lindgren @ 2015-04-24 16:22 UTC (permalink / raw)
To: Felipe Balbi
Cc: Linus Walleij, Alexandre Courbot, linux-gpio, linux-omap,
linux-arm-kernel, Javier Martinez Canillas, Grygorii Strashko,
Kevin Hilman, Nishanth Menon, Santosh Shilimkar
* Felipe Balbi <balbi@ti.com> [150424 09:14]:
> On Thu, Apr 23, 2015 at 04:56:22PM -0700, Tony Lindgren wrote:
> > We currently get all kinds of errors building the omap gpio driver
> > as a module starting with:
> >
> > undefined reference to `omap2_gpio_resume_after_idle'
> > undefined reference to `omap2_gpio_prepare_for_idle'
> > ...
> >
> > Let's fix the issue by adding inline functions to the header.
> > Note that we can now also remove the two unused functions for
> > omap_set_gpio_debounce and omap_set_gpio_debounce_time.
> >
> > Then doing rmmod on the module produces further warnings
> > because of missing exit related functions. Let's add those.
> >
> > And finally, we can make the Kconfig entry just a tristate
> > option that's selected for omaps.
> >
> > Cc: Felipe Balbi <balbi@ti.com>
> > Cc: Javier Martinez Canillas <javier@dowhile0.org>
> > Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
> > Cc: Kevin Hilman <khilman@deeprootsystems.com>
> > Cc: Nishanth Menon <nm@ti.com>
> > Cc: Santosh Shilimkar <ssantosh@kernel.org>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
>
> Just to be clear: when GPIO is a module, we can't really idle, can we ?
Right we cannot do off idle because of the context loss
until we have some way to register driver specific idle
functions.
Regards,
Tony
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] gpio: omap: Allow building as a loadable module
@ 2015-04-24 16:22 ` Tony Lindgren
0 siblings, 0 replies; 12+ messages in thread
From: Tony Lindgren @ 2015-04-24 16:22 UTC (permalink / raw)
To: linux-arm-kernel
* Felipe Balbi <balbi@ti.com> [150424 09:14]:
> On Thu, Apr 23, 2015 at 04:56:22PM -0700, Tony Lindgren wrote:
> > We currently get all kinds of errors building the omap gpio driver
> > as a module starting with:
> >
> > undefined reference to `omap2_gpio_resume_after_idle'
> > undefined reference to `omap2_gpio_prepare_for_idle'
> > ...
> >
> > Let's fix the issue by adding inline functions to the header.
> > Note that we can now also remove the two unused functions for
> > omap_set_gpio_debounce and omap_set_gpio_debounce_time.
> >
> > Then doing rmmod on the module produces further warnings
> > because of missing exit related functions. Let's add those.
> >
> > And finally, we can make the Kconfig entry just a tristate
> > option that's selected for omaps.
> >
> > Cc: Felipe Balbi <balbi@ti.com>
> > Cc: Javier Martinez Canillas <javier@dowhile0.org>
> > Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
> > Cc: Kevin Hilman <khilman@deeprootsystems.com>
> > Cc: Nishanth Menon <nm@ti.com>
> > Cc: Santosh Shilimkar <ssantosh@kernel.org>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
>
> Just to be clear: when GPIO is a module, we can't really idle, can we ?
Right we cannot do off idle because of the context loss
until we have some way to register driver specific idle
functions.
Regards,
Tony
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] gpio: omap: Allow building as a loadable module
2015-04-23 23:56 ` Tony Lindgren
@ 2015-05-06 13:23 ` Linus Walleij
-1 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2015-05-06 13:23 UTC (permalink / raw)
To: Tony Lindgren
Cc: Alexandre Courbot, linux-gpio, Linux-OMAP, linux-arm-kernel,
Felipe Balbi, Javier Martinez Canillas, Grygorii Strashko,
Kevin Hilman, Nishanth Menon, Santosh Shilimkar
On Fri, Apr 24, 2015 at 1:56 AM, Tony Lindgren <tony@atomide.com> wrote:
> We currently get all kinds of errors building the omap gpio driver
> as a module starting with:
>
> undefined reference to `omap2_gpio_resume_after_idle'
> undefined reference to `omap2_gpio_prepare_for_idle'
> ...
>
> Let's fix the issue by adding inline functions to the header.
> Note that we can now also remove the two unused functions for
> omap_set_gpio_debounce and omap_set_gpio_debounce_time.
>
> Then doing rmmod on the module produces further warnings
> because of missing exit related functions. Let's add those.
>
> And finally, we can make the Kconfig entry just a tristate
> option that's selected for omaps.
>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
Patch applied for v4.2.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] gpio: omap: Allow building as a loadable module
@ 2015-05-06 13:23 ` Linus Walleij
0 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2015-05-06 13:23 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 24, 2015 at 1:56 AM, Tony Lindgren <tony@atomide.com> wrote:
> We currently get all kinds of errors building the omap gpio driver
> as a module starting with:
>
> undefined reference to `omap2_gpio_resume_after_idle'
> undefined reference to `omap2_gpio_prepare_for_idle'
> ...
>
> Let's fix the issue by adding inline functions to the header.
> Note that we can now also remove the two unused functions for
> omap_set_gpio_debounce and omap_set_gpio_debounce_time.
>
> Then doing rmmod on the module produces further warnings
> because of missing exit related functions. Let's add those.
>
> And finally, we can make the Kconfig entry just a tristate
> option that's selected for omaps.
>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Grygorii Strashko <grygorii.strashko@linaro.org>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
Patch applied for v4.2.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-05-06 13:23 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-23 23:56 [PATCH] gpio: omap: Allow building as a loadable module Tony Lindgren
2015-04-23 23:56 ` Tony Lindgren
2015-04-24 14:59 ` Grygorii.Strashko@linaro.org
2015-04-24 14:59 ` Grygorii.Strashko@linaro.org
2015-04-24 15:40 ` santosh shilimkar
2015-04-24 15:40 ` santosh shilimkar
2015-04-24 16:11 ` Felipe Balbi
2015-04-24 16:11 ` Felipe Balbi
2015-04-24 16:22 ` Tony Lindgren
2015-04-24 16:22 ` Tony Lindgren
2015-05-06 13:23 ` Linus Walleij
2015-05-06 13:23 ` Linus Walleij
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.