Linux Samsung SOC development
 help / color / mirror / Atom feed
* [PATCH 0/6] memory: remove modular usage from non-modular drivers
@ 2016-06-17  0:37 Paul Gortmaker
  2016-06-17  0:37 ` [PATCH 5/6] memory: samsung/exynos-srom: make it explicitly non-modular Paul Gortmaker
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Gortmaker @ 2016-06-17  0:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Alexandre Belloni, Alexandre Courbot,
	Boris Brezillon, Ezequiel Garcia, Jason Cooper,
	Jean-Jacques Hiblot, Krzysztof Kozlowski, Kukjin Kim,
	Nicolas Ferre, Pankaj Dubey, Roger Quadros, Stephen Warren,
	Thierry Reding, Thomas Petazzoni, Tony Lindgren, linux-omap,
	linux-samsung-soc, linux-tegra

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 <alexandre.belloni@free-electrons.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Pankaj Dubey <pankaj.dubey@samsung.com>
Cc: Roger Quadros <rogerq@ti.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-tegra@vger.kernel.org

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(-)

-- 
2.8.4

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

* [PATCH 5/6] memory: samsung/exynos-srom: make it explicitly non-modular
  2016-06-17  0:37 [PATCH 0/6] memory: remove modular usage from non-modular drivers Paul Gortmaker
@ 2016-06-17  0:37 ` Paul Gortmaker
  2016-06-20  7:50   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Gortmaker @ 2016-06-17  0:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Pankaj Dubey, Kukjin Kim, Krzysztof Kozlowski,
	linux-samsung-soc

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 <pankaj.dubey@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: linux-samsung-soc@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/memory/samsung/exynos-srom.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/memory/samsung/exynos-srom.c b/drivers/memory/samsung/exynos-srom.c
index 96756fb4d6bd..b8904e33d3dd 100644
--- a/drivers/memory/samsung/exynos-srom.c
+++ b/drivers/memory/samsung/exynos-srom.c
@@ -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 <pankaj.dubey@samsung.com>");
-MODULE_DESCRIPTION("Exynos SROM Controller Driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(exynos_srom_driver);
-- 
2.8.4

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

* Re: [PATCH 5/6] memory: samsung/exynos-srom: make it explicitly non-modular
  2016-06-17  0:37 ` [PATCH 5/6] memory: samsung/exynos-srom: make it explicitly non-modular Paul Gortmaker
@ 2016-06-20  7:50   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2016-06-20  7:50 UTC (permalink / raw)
  To: Paul Gortmaker, linux-kernel; +Cc: Pankaj Dubey, Kukjin Kim, linux-samsung-soc

On 06/17/2016 02:37 AM, Paul Gortmaker wrote:
> 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 <pankaj.dubey@samsung.com>
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: linux-samsung-soc@vger.kernel.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  drivers/memory/samsung/exynos-srom.c | 21 +++------------------
>  1 file changed, 3 insertions(+), 18 deletions(-)

Thanks, applied for v4.8.

Best regards,
Krzysztof

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

end of thread, other threads:[~2016-06-20  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-17  0:37 [PATCH 0/6] memory: remove modular usage from non-modular drivers Paul Gortmaker
2016-06-17  0:37 ` [PATCH 5/6] memory: samsung/exynos-srom: make it explicitly non-modular Paul Gortmaker
2016-06-20  7:50   ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox