memory: omap-gpmc: Allow module build
Roger Quadros
maintainerv2 cover memory: omap-gpmc: Allow module build
Hi,
Allow OMAP_GPMC config to be visible in menuconfig and buildable as a module.
Changelog:
v2:
- Allow building as a module
cheers,
-roger
Roger Quadros (2):
memory: omap-gpmc: Make OMAP_GPMC config visible and selectable
memory: omap-gpmc: Allow building as a module
drivers/memory/Kconfig | 4 ++-- drivers/memory/omap-gpmc.c | 44 +++++++++++++++++++++----------------- 2 files changed, 26 insertions(+), 22 deletions(-)
Signature · 1 line
2.17.1
Roger Quadros
maintainerPATCH v2 1/2 memory: omap-gpmc: Make OMAP_GPMC config visible and selectable
So far for armv7 TI platforms, GPMC was being selected by arch/arm/mach-* architecture Kconfig files.
For K3 platforms, GPMC is no longer required for basic boot and cannot be always enabled by default by mach- Kconfig.
We need a way for user (or board defconfig) to enable it if required so ake OMAP_GPMC Kconfig option always visible.
--- drivers/memory/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/memory/Kconfig +2 -2
@@ -103,8 +103,8 @@ config TI_EMIF temperature changes config OMAP_GPMC - bool "Texas Instruments OMAP SoC GPMC driver" if COMPILE_TEST - depends on OF_ADDRESS + bool "Texas Instruments OMAP SoC GPMC driver" + depends on OF_ADDRESS || COMPILE_TEST select GPIOLIB help This driver is for the General Purpose Memory Controller (GPMC)
Signature · 1 line
2.17.1
Roger Quadros
maintainerPATCH v2 2/2 memory: omap-gpmc: Allow building as a module
In reply to Roger QuadrosAllow OMAP_GPMC to be built as a module.
Remove redundant of_match_node() call before of_platform_default_populate() as the latter takes care of matching with of_default_bus_match_table.
Move compatible match table to the end where it is usually expected.
--- drivers/memory/Kconfig | 2 +- drivers/memory/omap-gpmc.c | 44 +++++++++++++++++++++----------------- 2 files changed, 25 insertions(+), 21 deletions(-)
drivers/memory/Kconfig +1 -1
@@ -103,7 +103,7 @@ config TI_EMIF temperature changes config OMAP_GPMC - bool "Texas Instruments OMAP SoC GPMC driver" + tristate "Texas Instruments OMAP SoC GPMC driver" depends on OF_ADDRESS || COMPILE_TEST select GPIOLIB help
drivers/memory/omap-gpmc.c +24 -20
77 lines not on this page · raw message
Signature · 1 line
2.17.1
Krzysztof Kozlowski
maintainerRe: [PATCH v2 2/2] memory: omap-gpmc: Allow building as a module
Quoted 5 lines · Roger Quadros
Allow
OMAP_GPMCto be built as a module.Remove redundant
of_match_node()call beforeof_platform_default_populate()as the latter takes care of matching withof_default_bus_match_table.
Split this part to separate commit, please. It does not look related to making it a module.
Quoted 98 lines
Move compatible match table to the end where it is usually expected.
Signed-off-by Roger Quadros <[email protected]>--- drivers/memory/Kconfig | 2 +- drivers/memory/omap-gpmc.c | 44 +++++++++++++++++++++----------------- 2 files changed, 25 insertions(+), 21 deletions(-)drivers/memory/Kconfig +1
-1@@ -103,7 +103,7 @@ config TI_EMIF temperature changes config OMAP_GPMC - bool "Texas Instruments OMAP SoC GPMC driver" + tristate "Texas Instruments OMAP SoC GPMC driver" depends on OF_ADDRESS || COMPILE_TEST select GPIOLIB helpdrivers/memory/omap-gpmc.c +19
-15@@ -12,6 +12,7 @@#include <linux/cpu_pm.h> #include <linux/irq.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/init.h> #include <linux/err.h> #include <linux/clk.h> @@ -1889,16 +1890,6 @@ int gpmc_cs_program_settings(int cs, struct gpmc_settings *p) }#ifdef CONFIG_OF -static const struct of_device_id gpmc_dt_ids[] = { - { .compatible ="ti,omap2420-gpmc" }, - { .compatible ="ti,omap2430-gpmc" }, - { .compatible ="ti,omap3430-gpmc" },/* omap3430 & omap3630 */ - { .compatible ="ti,omap4430-gpmc" },/* omap4430 & omap4460 & omap543x */ - { .compatible ="ti,am3352-gpmc" },/* am335x devices */ - { .compatible ="ti,am64-gpmc" }, - { } -}; -static void gpmc_cs_set_name (int cs,const char *name) {struct gpmc_cs_data *gpmc = &gpmc_cs[cs];@@ -2257,11 +2248,9 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,if (!of_platform_device_create (child,NULL , &pdev->dev)) goto err_child_fail; -/* is child a common bus? */ -if (of_match_node (of_default_bus_match_table, child)) -/* create children and other common bus children */ -if (of_platform_default_populate (child,NULL , &pdev->dev)) - goto err_child_fail; +/* create children and other common bus children */ +if (of_platform_default_populate (child,NULL , &pdev->dev)) + goto err_child_fail;return 0 ;@@ -2278,6 +2267,8 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,return ret; } +static const struct of_device_id gpmc_dt_ids[]; +static int gpmc_probe_dt (struct platform_device *pdev) {int ret;@@ -2644,6 +2635,19 @@ static int gpmc_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(gpmc_pm_ops, gpmc_suspend, gpmc_resume); +#ifdef CONFIG_OF +static const struct of_device_id gpmc_dt_ids[] = { + { .compatible ="ti,omap2420-gpmc" }, + { .compatible ="ti,omap2430-gpmc" }, + { .compatible ="ti,omap3430-gpmc" },/* omap3430 & omap3630 */ + { .compatible ="ti,omap4430-gpmc" },/* omap4430 & omap4460 & omap543x */ + { .compatible ="ti,am3352-gpmc" },/* am335x devices */ + { .compatible ="ti,am64-gpmc" }, + { } +}; +MODULE_DEVICE_TABLE (of, gpmc_dt_ids); +#endif +static struct platform_driver gpmc_driver = { .probe = gpmc_probe, .remove = gpmc_remove,@@ -2654,8 +2658,8 @@ static struct platform_driver gpmc_driver = { }, };
drivers/memory/omap-gpmc.c static struct platform_driver gpmc_driver = { · line 2664
Quoted 10 lines
drivers/memory/omap-gpmc.c +4
-5-static __init int gpmc_init (void ) -{ -return platform_driver_register (&gpmc_driver); -} -postcore_initcall (gpmc_init); +module_platform_driver (gpmc_driver); + +MODULE_DESCRIPTION ("Texas Instruments GPMC driver" ); +MODULE_ALIAS ("platform:" DEVICE_NAME );
Why do you need this alias?
drivers/memory/omap-gpmc.c static struct platform_driver gpmc_driver = { · line 2665
Quoted 1 line
drivers/memory/omap-gpmc.c +1
-0+MODULE_LICENSE ("GPL v2" );
Best regards,
Krzysztof
Roger Quadros
maintainerRe: [PATCH v2 2/2] memory: omap-gpmc: Allow building as a module
Hi Krzysztof,
Quoted 9 lines · Krzysztof Kozlowski
Quoted 5 lines · Roger Quadros
Allow
OMAP_GPMCto be built as a module.Remove redundant
of_match_node()call beforeof_platform_default_populate()as the latter takes care of matching withof_default_bus_match_table.Split this part to separate commit, please. It does not look related to making it a module.
Actually it is related. Without that change build fails as it cannot find symbol 'of_default_bus_match_table'
Maybe I'll mention it in commit log.
Quoted 100 lines
Quoted 100 lines
Move compatible match table to the end where it is usually expected.
Signed-off-by Roger Quadros <[email protected]>--- drivers/memory/Kconfig | 2 +- drivers/memory/omap-gpmc.c | 44 +++++++++++++++++++++----------------- 2 files changed, 25 insertions(+), 21 deletions(-)drivers/memory/Kconfig +1
-1@@ -103,7 +103,7 @@ config TI_EMIF temperature changes config OMAP_GPMC - bool "Texas Instruments OMAP SoC GPMC driver" + tristate "Texas Instruments OMAP SoC GPMC driver" depends on OF_ADDRESS || COMPILE_TEST select GPIOLIB helpdrivers/memory/omap-gpmc.c +19
-15@@ -12,6 +12,7 @@#include <linux/cpu_pm.h> #include <linux/irq.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/init.h> #include <linux/err.h> #include <linux/clk.h> @@ -1889,16 +1890,6 @@ int gpmc_cs_program_settings(int cs, struct gpmc_settings *p) }#ifdef CONFIG_OF -static const struct of_device_id gpmc_dt_ids[] = { - { .compatible ="ti,omap2420-gpmc" }, - { .compatible ="ti,omap2430-gpmc" }, - { .compatible ="ti,omap3430-gpmc" },/* omap3430 & omap3630 */ - { .compatible ="ti,omap4430-gpmc" },/* omap4430 & omap4460 & omap543x */ - { .compatible ="ti,am3352-gpmc" },/* am335x devices */ - { .compatible ="ti,am64-gpmc" }, - { } -}; -static void gpmc_cs_set_name (int cs,const char *name) {struct gpmc_cs_data *gpmc = &gpmc_cs[cs];@@ -2257,11 +2248,9 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,if (!of_platform_device_create (child,NULL , &pdev->dev)) goto err_child_fail; -/* is child a common bus? */ -if (of_match_node (of_default_bus_match_table, child)) -/* create children and other common bus children */ -if (of_platform_default_populate (child,NULL , &pdev->dev)) - goto err_child_fail; +/* create children and other common bus children */ +if (of_platform_default_populate (child,NULL , &pdev->dev)) + goto err_child_fail;return 0 ;@@ -2278,6 +2267,8 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,return ret; } +static const struct of_device_id gpmc_dt_ids[]; +static int gpmc_probe_dt (struct platform_device *pdev) {int ret;@@ -2644,6 +2635,19 @@ static int gpmc_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(gpmc_pm_ops, gpmc_suspend, gpmc_resume); +#ifdef CONFIG_OF +static const struct of_device_id gpmc_dt_ids[] = { + { .compatible ="ti,omap2420-gpmc" }, + { .compatible ="ti,omap2430-gpmc" }, + { .compatible ="ti,omap3430-gpmc" },/* omap3430 & omap3630 */ + { .compatible ="ti,omap4430-gpmc" },/* omap4430 & omap4460 & omap543x */ + { .compatible ="ti,am3352-gpmc" },/* am335x devices */ + { .compatible ="ti,am64-gpmc" }, + { } +}; +MODULE_DEVICE_TABLE (of, gpmc_dt_ids); +#endif +static struct platform_driver gpmc_driver = { .probe = gpmc_probe, .remove = gpmc_remove,@@ -2654,8 +2658,8 @@ static struct platform_driver gpmc_driver = { }, };
Quoted 11 lines
drivers/memory/omap-gpmc.c static struct platform_driver gpmc_driver = { · line 2664
Quoted 9 lines
drivers/memory/omap-gpmc.c +4
-5-static __init int gpmc_init (void ) -{ -return platform_driver_register (&gpmc_driver); -} -postcore_initcall (gpmc_init); +module_platform_driver (gpmc_driver); + +MODULE_DESCRIPTION ("Texas Instruments GPMC driver" ); +MODULE_ALIAS ("platform:" DEVICE_NAME );Why do you need this alias?
Not required. I'll remove it.
Quoted 6 lines
drivers/memory/omap-gpmc.c static struct platform_driver gpmc_driver = { · line 2665
Quoted 2 lines
drivers/memory/omap-gpmc.c +1
-0+MODULE_LICENSE ("GPL v2" );Best regards,
Krzysztof
--
cheers,
-roger
Krzysztof Kozlowski
maintainerRe: [PATCH v2 2/2] memory: omap-gpmc: Allow building as a module
Quoted 10 lines · Roger Quadros
Hi Krzysztof,
Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Roger Quadros
Allow
OMAP_GPMCto be built as a module.Remove redundant
of_match_node()call beforeof_platform_default_populate()as the latter takes care of matching withof_default_bus_match_table.
Quoted 5 lines
Quoted 2 lines
Split this part to separate commit, please. It does not look related to making it a module.
Actually it is related. Without that change build fails as it cannot find symbol '
of_default_bus_match_table'
Hm, because of missing EXPORT?
Then it is related although to me removal of redundant code still could be split to separate commit. But I do not insist, if you mention it in commit msg.
Best regards,
Krzysztof
Roger Quadros
maintainerRe: [PATCH v2 2/2] memory: omap-gpmc: Allow building as a module
Quoted 11 lines · Krzysztof Kozlowski
Quoted 10 lines · Roger Quadros
Hi Krzysztof,
Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Roger Quadros
Allow
OMAP_GPMCto be built as a module.Remove redundant
of_match_node()call beforeof_platform_default_populate()as the latter takes care of matching withof_default_bus_match_table.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Split this part to separate commit, please. It does not look related to making it a module.
Actually it is related. Without that change build fails as it cannot find symbol '
of_default_bus_match_table'Hm, because of missing EXPORT?
Yes, only module build fails. Built-in is fine.
Quoted 4 lines
Then it is related although to me removal of redundant code still could be split to separate commit. But I do not insist, if you mention it in commit msg.
OK. Thanks.
Quoted 4 lines
Best regards,
Krzysztof
--
cheers,
-roger