linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] reset: make non-modular drivers really non modular
@ 2016-06-13 18:03 Paul Gortmaker
  2016-06-13 18:03 ` [PATCH 1/5] reset: berlin: make it explicitly non-modular Paul Gortmaker
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-13 18:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Antoine Tenart, Joachim Eastwood,
	Masahiro Yamada, Maxime Ripard, Michal Simek, Moritz Fischer,
	Philipp Zabel, Sebastian Hesselbarth, Sören Brinkmann,
	Steffen Trumtrar

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.

Fortunately the reset dir is in pretty good shape, and there are only
five instances of non-modular code using modular funcionality/macros.

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 ".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 the driver.

Recently several of these drivers got removal of the ".remove" fcns
via other changes, so only one remains for which that happens here.

There are no initcall level changes here; everything was at the level
of device_initcall and remains so, by using the builtin equivalents.

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

If there is a desire for any of these to be modular, we can definitely
consider that, but by default the changes here keep the code consistent
with existing behaviour and do not expand functionality into the modular
realm that I can't run time test.

Paul.

---

Cc: Antoine Tenart <antoine.tenart@free-electrons.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Moritz Fischer <moritz.fischer@ettus.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>


Paul Gortmaker (5):
  reset: berlin: make it explicitly non-modular
  reset: socfpga: make it explicitly non-modular
  reset: sunxi: make it explicitly non-modular
  reset: zynq: make it explicitly non-modular
  reset: lpc18xx: make it explicitly non-modular

 drivers/reset/reset-berlin.c  | 12 ++++--------
 drivers/reset/reset-lpc18xx.c | 32 +++++---------------------------
 drivers/reset/reset-socfpga.c | 10 ++++------
 drivers/reset/reset-sunxi.c   |  9 ++-------
 drivers/reset/reset-zynq.c    | 10 ++++------
 5 files changed, 19 insertions(+), 54 deletions(-)

-- 
2.8.4

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

* [PATCH 1/5] reset: berlin: make it explicitly non-modular
  2016-06-13 18:03 [PATCH 0/5] reset: make non-modular drivers really non modular Paul Gortmaker
@ 2016-06-13 18:03 ` Paul Gortmaker
  2016-06-13 18:03 ` [PATCH 2/5] reset: socfpga: " Paul Gortmaker
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-13 18:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Philipp Zabel, Antoine Tenart, Sebastian Hesselbarth

The Kconfig currently controlling compilation of this code is:

arch/arm/mach:berlin/Kconfig:menuconfig ARCH_BERLIN
arch/arm/mach:berlin/Kconfig:   bool "Marvell Berlin SoCs" if ARCH_MULTI_V7

or

arch/arm64/Kconfig.platforms:config ARCH_BERLIN
arch/arm64/Kconfig.platforms:   bool "Marvell Berlin SoC Family"

...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_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
was (or is now) contained at the top of the file in the comments.

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Antoine Tenart <antoine.tenart@free-electrons.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/reset/reset-berlin.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/reset/reset-berlin.c b/drivers/reset/reset-berlin.c
index 369f3917fd8e..371197bbd055 100644
--- a/drivers/reset/reset-berlin.c
+++ b/drivers/reset/reset-berlin.c
@@ -1,6 +1,8 @@
 /*
  * Copyright (C) 2014 Marvell Technology Group Ltd.
  *
+ * Marvell Berlin reset driver
+ *
  * Antoine Tenart <antoine.tenart@free-electrons.com>
  * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
  *
@@ -12,7 +14,7 @@
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/mfd/syscon.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
@@ -91,7 +93,6 @@ static const struct of_device_id berlin_reset_dt_match[] = {
 	{ .compatible = "marvell,berlin2-reset" },
 	{ },
 };
-MODULE_DEVICE_TABLE(of, berlin_reset_dt_match);
 
 static struct platform_driver berlin_reset_driver = {
 	.probe	= berlin2_reset_probe,
@@ -100,9 +101,4 @@ static struct platform_driver berlin_reset_driver = {
 		.of_match_table = berlin_reset_dt_match,
 	},
 };
-module_platform_driver(berlin_reset_driver);
-
-MODULE_AUTHOR("Antoine Tenart <antoine.tenart@free-electrons.com>");
-MODULE_AUTHOR("Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>");
-MODULE_DESCRIPTION("Marvell Berlin reset driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(berlin_reset_driver);
-- 
2.8.4

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

* [PATCH 2/5] reset: socfpga: make it explicitly non-modular
  2016-06-13 18:03 [PATCH 0/5] reset: make non-modular drivers really non modular Paul Gortmaker
  2016-06-13 18:03 ` [PATCH 1/5] reset: berlin: make it explicitly non-modular Paul Gortmaker
@ 2016-06-13 18:03 ` Paul Gortmaker
  2016-06-13 18:03 ` [PATCH 3/5] reset: sunxi: " Paul Gortmaker
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-13 18:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Steffen Trumtrar, Masahiro Yamada, Philipp Zabel

The Kconfig currently controlling compilation of this code is:

arch/arm/mach:socfpga/Kconfig:menuconfig ARCH_SOCFPGA
arch/arm/mach:socfpga/Kconfig:  bool "Altera SOCFPGA family" if ARCH_MULTI_V7

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

Lets remove the small amount of modular evidence that remains, 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.

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: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/reset/reset-socfpga.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
index 12add9b0fa49..153a5a02abf8 100644
--- a/drivers/reset/reset-socfpga.c
+++ b/drivers/reset/reset-socfpga.c
@@ -1,4 +1,6 @@
 /*
+ * Socfpga Reset Controller Driver
+ *
  * Copyright 2014 Steffen Trumtrar <s.trumtrar@pengutronix.de>
  *
  * based on
@@ -16,7 +18,7 @@
 
 #include <linux/err.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
@@ -149,8 +151,4 @@ static struct platform_driver socfpga_reset_driver = {
 		.of_match_table	= socfpga_reset_dt_ids,
 	},
 };
-module_platform_driver(socfpga_reset_driver);
-
-MODULE_AUTHOR("Steffen Trumtrar <s.trumtrar@pengutronix.de");
-MODULE_DESCRIPTION("Socfpga Reset Controller Driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(socfpga_reset_driver);
-- 
2.8.4

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

* [PATCH 3/5] reset: sunxi: make it explicitly non-modular
  2016-06-13 18:03 [PATCH 0/5] reset: make non-modular drivers really non modular Paul Gortmaker
  2016-06-13 18:03 ` [PATCH 1/5] reset: berlin: make it explicitly non-modular Paul Gortmaker
  2016-06-13 18:03 ` [PATCH 2/5] reset: socfpga: " Paul Gortmaker
@ 2016-06-13 18:03 ` Paul Gortmaker
  2016-06-13 18:03 ` [PATCH 4/5] reset: zynq: " Paul Gortmaker
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-13 18:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Gortmaker, Philipp Zabel, Maxime Ripard

The Kconfig currently controlling compilation of this code is:

arch/arm/mach:sunxi/Kconfig:menuconfig ARCH_SUNXI
arch/arm/mach:sunxi/Kconfig:    bool "Allwinner SoCs" if ARCH_MULTI_V7

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

Lets remove the few remaining traces of modular macro usage, 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: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/reset/reset-sunxi.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/reset/reset-sunxi.c b/drivers/reset/reset-sunxi.c
index 3080190b3f90..b44f6b5f87b6 100644
--- a/drivers/reset/reset-sunxi.c
+++ b/drivers/reset/reset-sunxi.c
@@ -13,7 +13,7 @@
 
 #include <linux/err.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
@@ -142,7 +142,6 @@ static const struct of_device_id sunxi_reset_dt_ids[] = {
 	 { .compatible = "allwinner,sun6i-a31-clock-reset", },
 	 { /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, sunxi_reset_dt_ids);
 
 static int sunxi_reset_probe(struct platform_device *pdev)
 {
@@ -175,8 +174,4 @@ static struct platform_driver sunxi_reset_driver = {
 		.of_match_table	= sunxi_reset_dt_ids,
 	},
 };
-module_platform_driver(sunxi_reset_driver);
-
-MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com");
-MODULE_DESCRIPTION("Allwinner SoCs Reset Controller Driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(sunxi_reset_driver);
-- 
2.8.4

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

* [PATCH 4/5] reset: zynq: make it explicitly non-modular
  2016-06-13 18:03 [PATCH 0/5] reset: make non-modular drivers really non modular Paul Gortmaker
                   ` (2 preceding siblings ...)
  2016-06-13 18:03 ` [PATCH 3/5] reset: sunxi: " Paul Gortmaker
@ 2016-06-13 18:03 ` Paul Gortmaker
  2016-06-13 19:15   ` Moritz Fischer
  2016-06-14  5:57   ` Michal Simek
  2016-06-13 18:03 ` [PATCH 5/5] reset: lpc18xx: " Paul Gortmaker
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-13 18:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Philipp Zabel, Michal Simek,
	Sören Brinkmann, Moritz Fischer

The Makefile/Kconfig currently controlling compilation of this code is:

drivers/reset/Makefile:obj-$(CONFIG_ARCH_ZYNQ) += reset-zynq.o
arch/arm/mach:zynq/Kconfig:config ARCH_ZYNQ
arch/arm/mach:zynq/Kconfig:     bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7

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

Lets remove the few remaining traces of modular macro usage, 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.

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: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Cc: Moritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/reset/reset-zynq.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/reset/reset-zynq.c b/drivers/reset/reset-zynq.c
index 138f2f205662..87a4e355578f 100644
--- a/drivers/reset/reset-zynq.c
+++ b/drivers/reset/reset-zynq.c
@@ -3,6 +3,8 @@
  *
  * Xilinx Zynq Reset controller driver
  *
+ * Author: Moritz Fischer <moritz.fischer@ettus.com>
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; version 2 of the License.
@@ -15,7 +17,7 @@
 
 #include <linux/err.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/mfd/syscon.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
@@ -137,8 +139,4 @@ static struct platform_driver zynq_reset_driver = {
 		.of_match_table	= zynq_reset_dt_ids,
 	},
 };
-module_platform_driver(zynq_reset_driver);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Moritz Fischer <moritz.fischer@ettus.com>");
-MODULE_DESCRIPTION("Zynq Reset Controller Driver");
+builtin_platform_driver(zynq_reset_driver);
-- 
2.8.4

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

* [PATCH 5/5] reset: lpc18xx: make it explicitly non-modular
  2016-06-13 18:03 [PATCH 0/5] reset: make non-modular drivers really non modular Paul Gortmaker
                   ` (3 preceding siblings ...)
  2016-06-13 18:03 ` [PATCH 4/5] reset: zynq: " Paul Gortmaker
@ 2016-06-13 18:03 ` Paul Gortmaker
  2016-09-05 22:25 ` [PATCH 0/5] reset: make non-modular drivers really non modular Paul Gortmaker
  2016-10-22 21:48 ` Paul Gortmaker
  6 siblings, 0 replies; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-13 18:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Gortmaker, Philipp Zabel, Joachim Eastwood

The Kconfig currently controlling compilation of this code is:

arch/arm/Kconfig:config ARCH_LPC18XX
arch/arm/Kconfig:       bool "NXP LPC18xx/LPC43xx"

...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: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/reset/reset-lpc18xx.c | 32 +++++---------------------------
 1 file changed, 5 insertions(+), 27 deletions(-)

diff --git a/drivers/reset/reset-lpc18xx.c b/drivers/reset/reset-lpc18xx.c
index 54cca0055171..a62ad52e262b 100644
--- a/drivers/reset/reset-lpc18xx.c
+++ b/drivers/reset/reset-lpc18xx.c
@@ -13,7 +13,7 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/reboot.h>
@@ -218,39 +218,17 @@ dis_clk_reg:
 	return ret;
 }
 
-static int lpc18xx_rgu_remove(struct platform_device *pdev)
-{
-	struct lpc18xx_rgu_data *rc = platform_get_drvdata(pdev);
-	int ret;
-
-	ret = unregister_restart_handler(&rc->restart_nb);
-	if (ret)
-		dev_warn(&pdev->dev, "failed to unregister restart handler\n");
-
-	reset_controller_unregister(&rc->rcdev);
-
-	clk_disable_unprepare(rc->clk_delay);
-	clk_disable_unprepare(rc->clk_reg);
-
-	return 0;
-}
-
 static const struct of_device_id lpc18xx_rgu_match[] = {
 	{ .compatible = "nxp,lpc1850-rgu" },
 	{ }
 };
-MODULE_DEVICE_TABLE(of, lpc18xx_rgu_match);
 
 static struct platform_driver lpc18xx_rgu_driver = {
 	.probe	= lpc18xx_rgu_probe,
-	.remove	= lpc18xx_rgu_remove,
 	.driver	= {
-		.name		= "lpc18xx-reset",
-		.of_match_table	= lpc18xx_rgu_match,
+		.name			= "lpc18xx-reset",
+		.of_match_table		= lpc18xx_rgu_match,
+		.suppress_bind_attrs	= true,
 	},
 };
-module_platform_driver(lpc18xx_rgu_driver);
-
-MODULE_AUTHOR("Joachim Eastwood <manabian@gmail.com>");
-MODULE_DESCRIPTION("Reset driver for LPC18xx/43xx RGU");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(lpc18xx_rgu_driver);
-- 
2.8.4

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

* Re: [PATCH 4/5] reset: zynq: make it explicitly non-modular
  2016-06-13 18:03 ` [PATCH 4/5] reset: zynq: " Paul Gortmaker
@ 2016-06-13 19:15   ` Moritz Fischer
  2016-06-14  5:57   ` Michal Simek
  1 sibling, 0 replies; 11+ messages in thread
From: Moritz Fischer @ 2016-06-13 19:15 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: Linux Kernel Mailing List, Philipp Zabel, Michal Simek,
	Sören Brinkmann

Hi Paul,

On Mon, Jun 13, 2016 at 11:03 AM, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:
> The Makefile/Kconfig currently controlling compilation of this code is:
>
> drivers/reset/Makefile:obj-$(CONFIG_ARCH_ZYNQ) += reset-zynq.o
> arch/arm/mach:zynq/Kconfig:config ARCH_ZYNQ
> arch/arm/mach:zynq/Kconfig:     bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7
>
> ...meaning that it currently is not being built as a module by anyone.
>
> Lets remove the few remaining traces of modular macro usage, 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.
>
> 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: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
> Cc: Moritz Fischer <moritz.fischer@ettus.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Acked-By: Moritz Fischer <moritz.fischer@ettus.com>

Thanks,

Moritz

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

* Re: [PATCH 4/5] reset: zynq: make it explicitly non-modular
  2016-06-13 18:03 ` [PATCH 4/5] reset: zynq: " Paul Gortmaker
  2016-06-13 19:15   ` Moritz Fischer
@ 2016-06-14  5:57   ` Michal Simek
  1 sibling, 0 replies; 11+ messages in thread
From: Michal Simek @ 2016-06-14  5:57 UTC (permalink / raw)
  To: Paul Gortmaker, linux-kernel
  Cc: Philipp Zabel, Michal Simek, Sören Brinkmann, Moritz Fischer

On 13.6.2016 20:03, Paul Gortmaker wrote:
> The Makefile/Kconfig currently controlling compilation of this code is:
> 
> drivers/reset/Makefile:obj-$(CONFIG_ARCH_ZYNQ) += reset-zynq.o
> arch/arm/mach:zynq/Kconfig:config ARCH_ZYNQ
> arch/arm/mach:zynq/Kconfig:     bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7
> 
> ...meaning that it currently is not being built as a module by anyone.
> 
> Lets remove the few remaining traces of modular macro usage, 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.
> 
> 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: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
> Cc: Moritz Fischer <moritz.fischer@ettus.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  drivers/reset/reset-zynq.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/reset/reset-zynq.c b/drivers/reset/reset-zynq.c
> index 138f2f205662..87a4e355578f 100644
> --- a/drivers/reset/reset-zynq.c
> +++ b/drivers/reset/reset-zynq.c
> @@ -3,6 +3,8 @@
>   *
>   * Xilinx Zynq Reset controller driver
>   *
> + * Author: Moritz Fischer <moritz.fischer@ettus.com>
> + *
>   * This program is free software; you can redistribute it and/or modify
>   * it under the terms of the GNU General Public License as published by
>   * the Free Software Foundation; version 2 of the License.
> @@ -15,7 +17,7 @@
>  
>  #include <linux/err.h>
>  #include <linux/io.h>
> -#include <linux/module.h>
> +#include <linux/init.h>
>  #include <linux/mfd/syscon.h>
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
> @@ -137,8 +139,4 @@ static struct platform_driver zynq_reset_driver = {
>  		.of_match_table	= zynq_reset_dt_ids,
>  	},
>  };
> -module_platform_driver(zynq_reset_driver);
> -
> -MODULE_LICENSE("GPL v2");
> -MODULE_AUTHOR("Moritz Fischer <moritz.fischer@ettus.com>");
> -MODULE_DESCRIPTION("Zynq Reset Controller Driver");
> +builtin_platform_driver(zynq_reset_driver);
> 

Acked-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal

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

* Re: [PATCH 0/5] reset: make non-modular drivers really non modular
  2016-06-13 18:03 [PATCH 0/5] reset: make non-modular drivers really non modular Paul Gortmaker
                   ` (4 preceding siblings ...)
  2016-06-13 18:03 ` [PATCH 5/5] reset: lpc18xx: " Paul Gortmaker
@ 2016-09-05 22:25 ` Paul Gortmaker
  2016-10-22 21:48 ` Paul Gortmaker
  6 siblings, 0 replies; 11+ messages in thread
From: Paul Gortmaker @ 2016-09-05 22:25 UTC (permalink / raw)
  To: linux-kernel, Philipp Zabel
  Cc: Antoine Tenart, Joachim Eastwood, Masahiro Yamada, Maxime Ripard,
	Michal Simek, Moritz Fischer, Sebastian Hesselbarth,
	Sören Brinkmann, Steffen Trumtrar

[[PATCH 0/5] reset: make non-modular drivers really non modular] On 13/06/2016 (Mon 14:03) Paul Gortmaker wrote:

> 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:

Hi Phillip,

Wondering what the status of these patches is, since I didn't see them
in this recent merge in linux-next now that it has restarted again:

  ----------------------
  commit 7d3ef43f1f99d4250ff120c8965b3e5cd81b3c71
  Merge: 2b97f10b3896 cddb4800162e
  Author: Arnd Bergmann <arnd@arndb.de>
  Date:   Fri Sep 2 18:29:04 2016 +0200

    Merge tag 'reset-for-4.9' of git://git.pengutronix.de/git/pza/linux into next/drivers
    
    Merge "Reset controller changes for v4.9" from Philipp Zabel:
  ----------------------

I believe there are at least two new instances in the reset drivers
since these original five were sent to you back in June.

The V1 didn't get any change requests, just some acks.  Do you want a
resend with the additional commits, and the Ack'd by from V1 added?

Thanks,
Paul.
--

> 
>  (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.
> 
> Fortunately the reset dir is in pretty good shape, and there are only
> five instances of non-modular code using modular funcionality/macros.
> 
> 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 ".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 the driver.
> 
> Recently several of these drivers got removal of the ".remove" fcns
> via other changes, so only one remains for which that happens here.
> 
> There are no initcall level changes here; everything was at the level
> of device_initcall and remains so, by using the builtin equivalents.
> 
> Build tested for several different key arch on a recent linux-next
> tree to ensure no silly typos crept in.
> 
> If there is a desire for any of these to be modular, we can definitely
> consider that, but by default the changes here keep the code consistent
> with existing behaviour and do not expand functionality into the modular
> realm that I can't run time test.
> 
> Paul.
> 
> ---
> 
> Cc: Antoine Tenart <antoine.tenart@free-electrons.com>
> Cc: Joachim Eastwood <manabian@gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Moritz Fischer <moritz.fischer@ettus.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
> Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> 
> 
> Paul Gortmaker (5):
>   reset: berlin: make it explicitly non-modular
>   reset: socfpga: make it explicitly non-modular
>   reset: sunxi: make it explicitly non-modular
>   reset: zynq: make it explicitly non-modular
>   reset: lpc18xx: make it explicitly non-modular
> 
>  drivers/reset/reset-berlin.c  | 12 ++++--------
>  drivers/reset/reset-lpc18xx.c | 32 +++++---------------------------
>  drivers/reset/reset-socfpga.c | 10 ++++------
>  drivers/reset/reset-sunxi.c   |  9 ++-------
>  drivers/reset/reset-zynq.c    | 10 ++++------
>  5 files changed, 19 insertions(+), 54 deletions(-)
> 
> -- 
> 2.8.4
> 

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

* Re: [PATCH 0/5] reset: make non-modular drivers really non modular
  2016-06-13 18:03 [PATCH 0/5] reset: make non-modular drivers really non modular Paul Gortmaker
                   ` (5 preceding siblings ...)
  2016-09-05 22:25 ` [PATCH 0/5] reset: make non-modular drivers really non modular Paul Gortmaker
@ 2016-10-22 21:48 ` Paul Gortmaker
  2016-10-24  8:56   ` Philipp Zabel
  6 siblings, 1 reply; 11+ messages in thread
From: Paul Gortmaker @ 2016-10-22 21:48 UTC (permalink / raw)
  To: linux-kernel, Philipp Zabel
  Cc: Antoine Tenart, Joachim Eastwood, Masahiro Yamada, Maxime Ripard,
	Michal Simek, Moritz Fischer, Philipp Zabel,
	Sebastian Hesselbarth, Sören Brinkmann, Steffen Trumtrar

[[PATCH 0/5] reset: make non-modular drivers really non modular] On 13/06/2016 (Mon 14:03) Paul Gortmaker wrote:

> 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:

Hi Philipp,

I sent this several months ago, and aside from a couple Ack'd by, there
was no negative feedback or similar.

Since then there have been two more drivers added with the same issue.

	reset-make-ath79-explicitly-non-modular.patch
	reset-pistachio-make-it-explicitly-non-modular.patch

Should I assume that the original send has fallen through the cracks and
resend with the two new patches, or do you still have the original five
in a queue somewhere?

I'd like to merge as many of these as I can via their respective
maintainers vs. trying to send them to Linus directly.

Thanks,
Paul.
--

> 
>  (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.
> 
> Fortunately the reset dir is in pretty good shape, and there are only
> five instances of non-modular code using modular funcionality/macros.
> 
> 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 ".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 the driver.
> 
> Recently several of these drivers got removal of the ".remove" fcns
> via other changes, so only one remains for which that happens here.
> 
> There are no initcall level changes here; everything was at the level
> of device_initcall and remains so, by using the builtin equivalents.
> 
> Build tested for several different key arch on a recent linux-next
> tree to ensure no silly typos crept in.
> 
> If there is a desire for any of these to be modular, we can definitely
> consider that, but by default the changes here keep the code consistent
> with existing behaviour and do not expand functionality into the modular
> realm that I can't run time test.
> 
> Paul.
> 
> ---
> 
> Cc: Antoine Tenart <antoine.tenart@free-electrons.com>
> Cc: Joachim Eastwood <manabian@gmail.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Moritz Fischer <moritz.fischer@ettus.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
> Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> 
> 
> Paul Gortmaker (5):
>   reset: berlin: make it explicitly non-modular
>   reset: socfpga: make it explicitly non-modular
>   reset: sunxi: make it explicitly non-modular
>   reset: zynq: make it explicitly non-modular
>   reset: lpc18xx: make it explicitly non-modular
> 
>  drivers/reset/reset-berlin.c  | 12 ++++--------
>  drivers/reset/reset-lpc18xx.c | 32 +++++---------------------------
>  drivers/reset/reset-socfpga.c | 10 ++++------
>  drivers/reset/reset-sunxi.c   |  9 ++-------
>  drivers/reset/reset-zynq.c    | 10 ++++------
>  5 files changed, 19 insertions(+), 54 deletions(-)
> 
> -- 
> 2.8.4
> 

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

* Re: [PATCH 0/5] reset: make non-modular drivers really non modular
  2016-10-22 21:48 ` Paul Gortmaker
@ 2016-10-24  8:56   ` Philipp Zabel
  0 siblings, 0 replies; 11+ messages in thread
From: Philipp Zabel @ 2016-10-24  8:56 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Antoine Tenart, Joachim Eastwood, Masahiro Yamada,
	Maxime Ripard, Michal Simek, Moritz Fischer,
	Sebastian Hesselbarth, Sören Brinkmann, Steffen Trumtrar

Hi Paul,

Am Samstag, den 22.10.2016, 17:48 -0400 schrieb Paul Gortmaker:
> [[PATCH 0/5] reset: make non-modular drivers really non modular] On 13/06/2016 (Mon 14:03) Paul Gortmaker wrote:
> 
> > 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:
> 
> Hi Philipp,
> 
> I sent this several months ago, and aside from a couple Ack'd by, there
> was no negative feedback or similar.
> 
> Since then there have been two more drivers added with the same issue.
> 
> 	reset-make-ath79-explicitly-non-modular.patch
> 	reset-pistachio-make-it-explicitly-non-modular.patch
> 
> Should I assume that the original send has fallen through the cracks and
> resend with the two new patches, or do you still have the original five
> in a queue somewhere?

thanks for the reminder. I had them stashed away because I wanted to see
whether the introduction of per-driver Kconfig options would change some
of them to become modular. That wasn't the case, so I have pushed your
patches to the reset/next branch now, with fixed up commit messages.

> I'd like to merge as many of these as I can via their respective
> maintainers vs. trying to send them to Linus directly.
> 
> Thanks,
> Paul.

regards
Philipp

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

end of thread, other threads:[~2016-10-24  8:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-13 18:03 [PATCH 0/5] reset: make non-modular drivers really non modular Paul Gortmaker
2016-06-13 18:03 ` [PATCH 1/5] reset: berlin: make it explicitly non-modular Paul Gortmaker
2016-06-13 18:03 ` [PATCH 2/5] reset: socfpga: " Paul Gortmaker
2016-06-13 18:03 ` [PATCH 3/5] reset: sunxi: " Paul Gortmaker
2016-06-13 18:03 ` [PATCH 4/5] reset: zynq: " Paul Gortmaker
2016-06-13 19:15   ` Moritz Fischer
2016-06-14  5:57   ` Michal Simek
2016-06-13 18:03 ` [PATCH 5/5] reset: lpc18xx: " Paul Gortmaker
2016-09-05 22:25 ` [PATCH 0/5] reset: make non-modular drivers really non modular Paul Gortmaker
2016-10-22 21:48 ` Paul Gortmaker
2016-10-24  8:56   ` Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).