Skip to contentSkip to conversation

memory: remove modular usage from non-modular drivers

PATCH Applied Paul Gortmaker 6 participants 14 messages Jun 17, 2016 – Jun 21, 2016

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover memory: remove modular usage from non-modular drivers

It seems that drivers/memory/ doesn't have a single maintainer, so please feel free to pick up just one or two patches from this as appropriate.

For anyone new to the underlying goal of this cleanup, we are trying to not use module support for code that can never be built as a module since:

(1) it is easy to accidentally write unused module_exit and remove code
(2) it can be misleading when reading the source, thinking it can be modular when the Makefile and/or Kconfig prohibit it
(3) it requires the include of the module.h header file which in turn includes nearly everything else, thus adding to CPP overhead.
(4) it gets copied/replicated into other code and spreads like weeds.

Changes seen here cover the following categories:

-just replacement of modular macros with their non-modular
equivalents that CPP would have inserted anyway

-the removal of including module.h ; replaced with init.h
as required based on whether the file already had it.

-the removal of any/all unused/orphaned __exit functions
that would never be called/exercised.

-the removal of any ".remove" functions that were hooked into
the driver struct. This ".remove" function would of
course not be called from the __exit function since that was never run. However in theory, someone could have triggered it via sysfs unbind, even though there isn't a sensible use case for doing so. So to cover that possibility, we've also disabled sysfs unbind in these drivers.

There are no initcall level changes here; everything continues to use the level of initcall it had before. So no risk of regressions from that exists here.

Build tested for several different key arch on a recent linux-next tree to ensure no silly typos crept in.

FAQ: Why not make it tristate?
------------------------------
Upon detecting a non-modular driver making modular references, I don't immediately convert them to tristate, since it increases functionality that I can't readily test, and it may not have a sensible use case (e.g. in the case of core arch support relating to timer ticks or similar.) So instead the modular references are removed w/o changing the existing functionality by default.

However there is no reason the original author or an interested user with the capability to test can't nominate a driver to be tristate either as the original intent, or as a functional and tested use case.

Paul.
---

Cc Alexandre Belloni <[email protected]>
Cc Alexandre Courbot <[email protected]>
Cc Boris Brezillon <[email protected]>
Cc Ezequiel Garcia <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Jean-Jacques Hiblot <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Pankaj Dubey <[email protected]>
Cc Roger Quadros <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Tony Lindgren <[email protected]>

Paul Gortmaker (6):
memory: atmel-sdramc: make it explicitly non-modular
memory: mvebu-devbus: make it explicitly non-modular
memory: omap-gpmc: make it explicitly non-modular
memory: tegra20-mc: make it explicitly non-modular
memory: samsung/exynos-srom: make it explicitly non-modular
memory: atmel-ebi: make it explicitly non-modular

 drivers/memory/atmel-ebi.c           |  9 ++-------
 drivers/memory/atmel-sdramc.c        | 11 ++++-------
 drivers/memory/mvebu-devbus.c        | 11 ++++-------
 drivers/memory/omap-gpmc.c           | 10 ----------
 drivers/memory/samsung/exynos-srom.c | 21 +++------------------
 drivers/memory/tegra20-mc.c          | 11 ++++-------
 6 files changed, 17 insertions(+), 56 deletions(-)
Signature · 1 line
2.8.4
#1 lore raw

PATCH 1/6 memory: atmel-sdramc: make it explicitly non-modular

The Kconfig for this option is currently:

config ATMEL_SDRAMC
bool "Atmel (Multi-port DDR-)SDRAM Controller"

...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modularity, so that when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. An alternate init level might be worth considering at a later date.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments.

Cc Alexandre Belloni <[email protected]>
Cc Nicolas Ferre <[email protected]>
---
 drivers/memory/atmel-sdramc.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/memory/atmel-sdramc.c +4 -7
index a3ebc8a87479..53a341f3b305 100644
@@ -1,6 +1,8 @@
 /*
  * Atmel (Multi-port DDR-)SDRAM Controller driver
  *
+ * Author: Alexandre Belloni <[email protected]>
+ *
  * Copyright (C) 2014 Atmel
  *
  * This program is free software: you can redistribute it and/or modify
@@ -20,7 +22,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
 
@@ -48,7 +50,6 @@ static const struct of_device_id atmel_ramc_of_match[] = {
 	{ .compatible = "atmel,sama5d3-ddramc", .data = &sama5d3_caps, },
 	{},
 };
-MODULE_DEVICE_TABLE(of, atmel_ramc_of_match);
 
 static int atmel_ramc_probe(struct platform_device *pdev)
 {
@@ -90,8 +91,4 @@ static int __init atmel_ramc_init(void)
 {
 	return platform_driver_register(&atmel_ramc_driver);
 }
-module_init(atmel_ramc_init);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Alexandre Belloni <[email protected]>");
-MODULE_DESCRIPTION("Atmel (Multi-port DDR-)SDRAM Controller");
+device_initcall(atmel_ramc_init);
Signature · 1 line
2.8.4
Acked-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] memory: atmel-sdramc: make it explicitly non-modular

Quoted 13 lines · Paul Gortmaker

The Kconfig for this option is currently:

config ATMEL_SDRAMC
bool "Atmel (Multi-port DDR-)SDRAM Controller"

...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modularity, so that when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. An alternate init level might be worth considering at a later date.

Quoted 7 lines

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments.

Cc Alexandre Belloni <[email protected]>
Cc Nicolas Ferre <[email protected]>
Quoted 46 lines
---
 drivers/memory/atmel-sdramc.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/memory/atmel-sdramc.c +4 -7
index a3ebc8a87479..53a341f3b305 100644
@@ -1,6 +1,8 @@
 /*
  * Atmel (Multi-port DDR-)SDRAM Controller driver
  *
+ * Author: Alexandre Belloni <[email protected]>
+ *
  * Copyright (C) 2014 Atmel
  *
  * This program is free software: you can redistribute it and/or modify
@@ -20,7 +22,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
 
@@ -48,7 +50,6 @@ static const struct of_device_id atmel_ramc_of_match[] = {
 	{ .compatible = "atmel,sama5d3-ddramc", .data = &sama5d3_caps, },
 	{},
 };
-MODULE_DEVICE_TABLE(of, atmel_ramc_of_match);
 
 static int atmel_ramc_probe(struct platform_device *pdev)
 {
@@ -90,8 +91,4 @@ static int __init atmel_ramc_init(void)
 {
 	return platform_driver_register(&atmel_ramc_driver);
 }
-module_init(atmel_ramc_init);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Alexandre Belloni <[email protected]>");
-MODULE_DESCRIPTION("Atmel (Multi-port DDR-)SDRAM Controller");
+device_initcall(atmel_ramc_init);
Signature · 1 line
Nicolas Ferre
#3 lore raw

Re: [PATCH 1/6] memory: atmel-sdramc: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 18 lines · Paul Gortmaker

The Kconfig for this option is currently:

config ATMEL_SDRAMC
bool "Atmel (Multi-port DDR-)SDRAM Controller"

...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modularity, so that when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. An alternate init level might be worth considering at a later date.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments.

Quoted 7 lines
Cc Alexandre Belloni <[email protected]>
Cc Nicolas Ferre <[email protected]>
---
 drivers/memory/atmel-sdramc.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 2/6 memory: mvebu-devbus: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig for this option is currently:

config MVEBU_DEVBUS
bool "Marvell EBU Device Bus Controller"

...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modularity, so that when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. An alternate init level might be worth considering at a later date.

We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments.

Cc Ezequiel Garcia <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Jason Cooper <[email protected]>
---
 drivers/memory/mvebu-devbus.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/memory/mvebu-devbus.c +4 -7
index 24852812fd44..543eeec47bd1 100644
@@ -2,6 +2,8 @@
  * Marvell EBU SoC Device Bus Controller
  * (memory controller for NOR/NAND/SRAM/FPGA devices)
  *
+ * Author: Ezequiel Garcia <[email protected]>
+ *
  * Copyright (C) 2013-2014 Marvell
  *
  * This program is free software: you can redistribute it and/or modify
@@ -19,7 +21,7 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/io.h>
@@ -340,7 +342,6 @@ static const struct of_device_id mvebu_devbus_of_match[] = {
 	{ .compatible = "marvell,orion-devbus" },
 	{},
 };
-MODULE_DEVICE_TABLE(of, mvebu_devbus_of_match);
 
 static struct platform_driver mvebu_devbus_driver = {
 	.probe		= mvebu_devbus_probe,
@@ -354,8 +355,4 @@ static int __init mvebu_devbus_init(void)
 {
 	return platform_driver_register(&mvebu_devbus_driver);
 }
-module_init(mvebu_devbus_init);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Ezequiel Garcia <[email protected]>");
-MODULE_DESCRIPTION("Marvell EBU SoC Device Bus controller");
+device_initcall(mvebu_devbus_init);
Signature · 1 line
2.8.4
#5 lore raw

PATCH 3/6 memory: omap-gpmc: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/memory/Kconfig:config OMAP_GPMC
drivers/memory/Kconfig: bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We don't replace module.h with init.h since the file already has that.

---
 drivers/memory/omap-gpmc.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/memory/omap-gpmc.c +0 -10
index af4884ba6b7c..827832ac0b8c 100644
@@ -20,7 +20,6 @@
 #include <linux/ioport.h>
 #include <linux/spinlock.h>
 #include <linux/io.h>
-#include <linux/module.h>
 #include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
 #include <linux/irqdomain.h>
@@ -1807,7 +1806,6 @@ static const struct of_device_id gpmc_dt_ids[] = {
 	{ .compatible = "ti,am3352-gpmc" },	/* am335x devices */
 	{ }
 };
-MODULE_DEVICE_TABLE(of, gpmc_dt_ids);
 
 /**
  * gpmc_read_settings_dt - read gpmc settings from device-tree
@@ -2437,15 +2435,7 @@ static __init int gpmc_init(void)
 {
 	return platform_driver_register(&gpmc_driver);
 }
-
-static __exit void gpmc_exit(void)
-{
-	platform_driver_unregister(&gpmc_driver);
-
-}
-
 postcore_initcall(gpmc_init);
-module_exit(gpmc_exit);
 
 static struct omap3_gpmc_regs gpmc_context;
 
Signature · 1 line
2.8.4
#6 lore raw

Re: [PATCH 3/6] memory: omap-gpmc: make it explicitly non-modular

Hi Paul,

Quoted 13 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/memory/Kconfig:config OMAP_GPMC
drivers/memory/Kconfig: bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering remains unchanged with this commit.

Quoted 8 lines

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We don't replace module.h with init.h since the file already has that.

Looks fine to me. omap-gpmc.c be a module till code from arch/arm/mach-omap2/ stops calling directly into it.

I will queue this up for v4.8. Thanks.

Quoted 31 lines
---
 drivers/memory/omap-gpmc.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/memory/omap-gpmc.c +0 -4
index af4884ba6b7c..827832ac0b8c 100644
@@ -20,7 +20,6 @@
 #include <linux/ioport.h>
 #include <linux/spinlock.h>
 #include <linux/io.h>
-#include <linux/module.h>
 #include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
 #include <linux/irqdomain.h>
@@ -1807,7 +1806,6 @@ static const struct of_device_id gpmc_dt_ids[] = {
 	{ .compatible = "ti,am3352-gpmc" },	/* am335x devices */
 	{ }
 };
-MODULE_DEVICE_TABLE(of, gpmc_dt_ids);
 
 /**
  * gpmc_read_settings_dt - read gpmc settings from device-tree
@@ -2437,15 +2435,7 @@ static __init int gpmc_init(void)
 {
 	return platform_driver_register(&gpmc_driver);
 }
-
-static __exit void gpmc_exit(void)

drivers/memory/omap-gpmc.c static __init int gpmc_init(void) · line 2441

Quoted 10 lines
drivers/memory/omap-gpmc.c +0 -6
-{
-	platform_driver_unregister(&gpmc_driver);
-
-}
-
 postcore_initcall(gpmc_init);
-module_exit(gpmc_exit);
 
 static struct omap3_gpmc_regs gpmc_context;
 

--
cheers,
-roger

#7 lore raw

PATCH 4/6 memory: tegra20-mc: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/memory/Kconfig:config TEGRA20_MC drivers/memory/Kconfig: bool "Tegra20 Memory Controller(MC) driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple of traces of modular references, so that when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.

Also note that MODULE_ALIAS is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments.

Cc Stephen Warren <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Alexandre Courbot <[email protected]>
Cc Hiroshi DOYU <[email protected]>
---
 drivers/memory/tegra20-mc.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/memory/tegra20-mc.c +4 -7
index cc309a05289a..098f1b4dd4b7 100644
@@ -1,6 +1,8 @@
 /*
  * Tegra20 Memory Controller
  *
+ * Author: Hiroshi DOYU <[email protected]>
+ *
  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -19,7 +21,7 @@
 
 #include <linux/err.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/ratelimit.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
@@ -246,9 +248,4 @@ static struct platform_driver tegra20_mc_driver = {
 		.of_match_table = tegra20_mc_of_match,
 	},
 };
-module_platform_driver(tegra20_mc_driver);
-
-MODULE_AUTHOR("Hiroshi DOYU <[email protected]>");
-MODULE_DESCRIPTION("Tegra20 MC driver");
-MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:" DRV_NAME);
+builtin_platform_driver(tegra20_mc_driver);
Signature · 1 line
2.8.4
#8 lore raw

PATCH 5/6 memory: samsung/exynos-srom: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

memory/samsung/Kconfig:config EXYNOS_SROM memory/samsung/Kconfig: bool "Exynos SROM controller driver" if COMPILE_TEST

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.

Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Cc Pankaj Dubey <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
---
 drivers/memory/samsung/exynos-srom.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)
drivers/memory/samsung/exynos-srom.c +3 -18
index 96756fb4d6bd..b8904e33d3dd 100644
@@ -11,7 +11,7 @@
  */
 
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_platform.h>
@@ -159,16 +159,6 @@ static int exynos_srom_probe(struct platform_device *pdev)
 	return of_platform_populate(np, NULL, NULL, dev);
 }
 
-static int exynos_srom_remove(struct platform_device *pdev)
-{
-	struct exynos_srom *srom = platform_get_drvdata(pdev);
-
-	kfree(srom->reg_offset);
-	iounmap(srom->reg_base);
-
-	return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static void exynos_srom_save(void __iomem *base,
 				    struct exynos_srom_reg_dump *rd,
@@ -211,21 +201,16 @@ static const struct of_device_id of_exynos_srom_ids[] = {
 	},
 	{},
 };
-MODULE_DEVICE_TABLE(of, of_exynos_srom_ids);
 
 static SIMPLE_DEV_PM_OPS(exynos_srom_pm_ops, exynos_srom_suspend, exynos_srom_resume);
 
 static struct platform_driver exynos_srom_driver = {
 	.probe = exynos_srom_probe,
-	.remove = exynos_srom_remove,
 	.driver = {
 		.name = "exynos-srom",
 		.of_match_table = of_exynos_srom_ids,
 		.pm = &exynos_srom_pm_ops,
+		.suppress_bind_attrs = true,
 	},
 };
-module_platform_driver(exynos_srom_driver);
-
-MODULE_AUTHOR("Pankaj Dubey <[email protected]>");
-MODULE_DESCRIPTION("Exynos SROM Controller Driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(exynos_srom_driver);
Signature · 1 line
2.8.4
#9 lore raw

Re: [PATCH 5/6] memory: samsung/exynos-srom: make it explicitly non-modular

Quoted 23 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

memory/samsung/Kconfig:config EXYNOS_SROM memory/samsung/Kconfig: bool "Exynos SROM controller driver" if COMPILE_TEST

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.

Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Quoted 8 lines
Cc Pankaj Dubey <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
---
 drivers/memory/samsung/exynos-srom.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

Thanks, applied for v4.8.

Best regards,
Krzysztof

#10 lore raw

PATCH 6/6 memory: atmel-ebi: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/memory/Kconfig:config ATMEL_EBI
drivers/memory/Kconfig: bool "Atmel EBI driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few remaining modular references, so that when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Cc Boris Brezillon <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Jean-Jacques Hiblot <[email protected]>
Cc Nicolas Ferre <[email protected]>
---
 drivers/memory/atmel-ebi.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/memory/atmel-ebi.c +2 -7
index 17d9d3f60f20..f87ad6f5d2dc 100644
@@ -14,7 +14,7 @@
 #include <linux/mfd/syscon.h>
 #include <linux/mfd/syscon/atmel-matrix.h>
 #include <linux/mfd/syscon/atmel-smc.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of_device.h>
 #include <linux/regmap.h>
 
@@ -648,7 +648,6 @@ static const struct of_device_id at91_ebi_id_table[] = {
 	},
 	{ /* sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, at91_ebi_id_table);
 
 static int at91_ebi_dev_disable(struct at91_ebi *ebi, struct device_node *np)
 {
@@ -764,8 +763,4 @@ static struct platform_driver at91_ebi_driver = {
 		.of_match_table	= at91_ebi_id_table,
 	},
 };
-module_platform_driver_probe(at91_ebi_driver, at91_ebi_probe);
-
-MODULE_AUTHOR("Jean-Jacques Hiblot <[email protected]>");
-MODULE_DESCRIPTION("Atmel EBI driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver_probe(at91_ebi_driver, at91_ebi_probe);
Signature · 1 line
2.8.4
Acked-by on v1 6/6
#11 lore raw

Re: [PATCH 6/6] memory: atmel-ebi: make it explicitly non-modular

Quoted 16 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/memory/Kconfig:config ATMEL_EBI
drivers/memory/Kconfig: bool "Atmel EBI driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few remaining modular references, so that when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Quoted 7 lines

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Cc Boris Brezillon <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Jean-Jacques Hiblot <[email protected]>
Cc Nicolas Ferre <[email protected]>

We'll have to take the two atmel-related drivers through our git trees and arm-soc.

Thanks Paul. Bye.

Quoted 37 lines
---
 drivers/memory/atmel-ebi.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/memory/atmel-ebi.c +2 -7
index 17d9d3f60f20..f87ad6f5d2dc 100644
@@ -14,7 +14,7 @@
 #include <linux/mfd/syscon.h>
 #include <linux/mfd/syscon/atmel-matrix.h>
 #include <linux/mfd/syscon/atmel-smc.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of_device.h>
 #include <linux/regmap.h>
 
@@ -648,7 +648,6 @@ static const struct of_device_id at91_ebi_id_table[] = {
 	},
 	{ /* sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, at91_ebi_id_table);
 
 static int at91_ebi_dev_disable(struct at91_ebi *ebi, struct device_node *np)
 {
@@ -764,8 +763,4 @@ static struct platform_driver at91_ebi_driver = {
 		.of_match_table	= at91_ebi_id_table,
 	},
 };
-module_platform_driver_probe(at91_ebi_driver, at91_ebi_probe);
-
-MODULE_AUTHOR("Jean-Jacques Hiblot <[email protected]>");
-MODULE_DESCRIPTION("Atmel EBI driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver_probe(at91_ebi_driver, at91_ebi_probe);
Signature · 1 line
Nicolas Ferre
#12 lore raw

Re: [PATCH 6/6] memory: atmel-ebi: make it explicitly non-modular

Quoted 22 lines · On Fri, 17 Jun 2016 09:35:42 +0200 Nicolas Ferre <[email protected]>…
Quoted 21 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/memory/Kconfig:config ATMEL_EBI
drivers/memory/Kconfig: bool "Atmel EBI driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few remaining modular references, so that when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Quoted 6 lines
Quoted 4 lines
Cc Boris Brezillon <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Jean-Jacques Hiblot <[email protected]>
Cc Nicolas Ferre <[email protected]>
Quoted 45 lines

We'll have to take the two atmel-related drivers through our git trees and arm-soc.

Thanks Paul. Bye.

Quoted 37 lines
---
 drivers/memory/atmel-ebi.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/memory/atmel-ebi.c +2 -7
index 17d9d3f60f20..f87ad6f5d2dc 100644
@@ -14,7 +14,7 @@
 #include <linux/mfd/syscon.h>
 #include <linux/mfd/syscon/atmel-matrix.h>
 #include <linux/mfd/syscon/atmel-smc.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of_device.h>
 #include <linux/regmap.h>
 
@@ -648,7 +648,6 @@ static const struct of_device_id
 at91_ebi_id_table[] = { },
 	{ /* sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, at91_ebi_id_table);
 
 static int at91_ebi_dev_disable(struct at91_ebi *ebi, struct
 device_node *np) {
@@ -764,8 +763,4 @@ static struct platform_driver at91_ebi_driver =
 { .of_match_table	= at91_ebi_id_table,
 	},
 };
-module_platform_driver_probe(at91_ebi_driver, at91_ebi_probe);
-
-MODULE_AUTHOR("Jean-Jacques Hiblot <[email protected]>");
-MODULE_DESCRIPTION("Atmel EBI driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver_probe(at91_ebi_driver, at91_ebi_probe);
#13 lore raw

Re: [PATCH 6/6] memory: atmel-ebi: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 19 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/memory/Kconfig:config ATMEL_EBI
drivers/memory/Kconfig: bool "Atmel EBI driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few remaining modular references, so that when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Quoted 9 lines
Cc Boris Brezillon <[email protected]>
Cc Alexandre Belloni <[email protected]>
Cc Jean-Jacques Hiblot <[email protected]>
Cc Nicolas Ferre <[email protected]>
---
 drivers/memory/atmel-ebi.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Applied, thanks.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com