Skip to contentSkip to conversation

reset: de-modularize the remaining reset drivers

PATCH Applied Paul Gortmaker 4 participants 9 messages Feb 8, 2017 – Feb 9, 2017

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

cover reset: de-modularize the remaining reset drivers

Recently, a new reset driver was added that used module stuff in a driver that was clearly non-modular[1]. With that in mind, it is probably wise to get the remaining patches I have locally for the existing reset drivers out the door, so we don't get any more future instances of a new driver copying the old error once again.

Paul.

---

[1] https://lkml.kernel.org/r/CAP=VYLqhAEKAdnO7skBU7V+NxbQqXs_UbOO0J1hYHmCq3aKQow at mail.gmail.com

Cc Alban Bedel <[email protected]>
Cc Carlo Caione <[email protected]>
Cc Damien Horsley <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc linux-amlogic at lists.infradead.org
Cc linux-oxnas at lists.tuxfamily.org
Cc Neil Armstrong <[email protected]>
Cc Philipp Zabel <[email protected]>

Paul Gortmaker (4):
reset: ath79: make it explicitly non-modular
reset: pistachio: make it explicitly non-modular
reset: meson: make it explicitly non-modular
reset: oxnas: make it explicitly non-modular

 drivers/reset/reset-ath79.c     | 27 ++++++++-------------------
 drivers/reset/reset-meson.c     | 12 ++++--------
 drivers/reset/reset-oxnas.c     |  6 ++----
 drivers/reset/reset-pistachio.c |  9 ++-------
 4 files changed, 16 insertions(+), 38 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/4 reset: ath79: make it explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/reset/Kconfig:config RESET_ATH79 drivers/reset/Kconfig: bool "AR71xx Reset 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 was (or is now) contained at the top of the file in the comments.

Cc Philipp Zabel <[email protected]>
Cc Alban Bedel <[email protected]>
---
 drivers/reset/reset-ath79.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)
drivers/reset/reset-ath79.c +8 -19
index 6b97631f5489..2674880e5492 100644
@@ -1,4 +1,7 @@
 /*
+ * AR71xx Reset Controller Driver
+ * Author: Alban Bedel
+ *
  * Copyright (C) 2015 Alban Bedel <[email protected]>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -13,7 +16,7 @@
  */
 
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
 #include <linux/reboot.h>
@@ -127,31 +130,17 @@ static int ath79_reset_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int ath79_reset_remove(struct platform_device *pdev)
-{
-	struct ath79_reset *ath79_reset = platform_get_drvdata(pdev);
-
-	unregister_restart_handler(&ath79_reset->restart_nb);
-
-	return 0;
-}
-
 static const struct of_device_id ath79_reset_dt_ids[] = {
 	{ .compatible = "qca,ar7100-reset", },
 	{ },
 };
-MODULE_DEVICE_TABLE(of, ath79_reset_dt_ids);
 
 static struct platform_driver ath79_reset_driver = {
 	.probe	= ath79_reset_probe,
-	.remove = ath79_reset_remove,
 	.driver = {
-		.name		= "ath79-reset",
-		.of_match_table	= ath79_reset_dt_ids,
+		.name			= "ath79-reset",
+		.of_match_table		= ath79_reset_dt_ids,
+		.suppress_bind_attrs	= true,
 	},
 };
-module_platform_driver(ath79_reset_driver);
-
-MODULE_AUTHOR("Alban Bedel <[email protected]>");
-MODULE_DESCRIPTION("AR71xx Reset Controller Driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(ath79_reset_driver);
Signature · 1 line
2.11.0
Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] reset: ath79: make it explicitly non-modular

Quoted 18 lines · On Tue, 7 Feb 2017 19:18:44 -0500 Paul Gortmaker…

The Kconfig currently controlling compilation of this code is:

drivers/reset/Kconfig:config RESET_ATH79 drivers/reset/Kconfig: bool "AR71xx Reset 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.

Quoted 8 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 Philipp Zabel <[email protected]>
Cc Alban Bedel <[email protected]>
#3 lore raw

PATCH 2/4 reset: pistachio: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/reset/Kconfig:config RESET_PISTACHIO drivers/reset/Kconfig: bool "Pistachio Reset Driver" if COMPILE_TEST

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

Lets remove the couple traces of modular infrastructure use, 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 <[email protected]>
Cc Damien Horsley <[email protected]>
---
 drivers/reset/reset-pistachio.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/reset/reset-pistachio.c +2 -7
index bbc4c06dd33b..11d651b44e81 100644
@@ -10,7 +10,7 @@
  * version 2, as published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
@@ -128,7 +128,6 @@ static const struct of_device_id pistachio_reset_dt_ids[] = {
 	 { .compatible = "img,pistachio-reset", },
 	 { /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, pistachio_reset_dt_ids);
 
 static struct platform_driver pistachio_reset_driver = {
 	.probe	= pistachio_reset_probe,
@@ -137,8 +136,4 @@ static struct platform_driver pistachio_reset_driver = {
 		.of_match_table	= pistachio_reset_dt_ids,
 	},
 };
-module_platform_driver(pistachio_reset_driver);
-
-MODULE_AUTHOR("Damien Horsley <[email protected]>");
-MODULE_DESCRIPTION("Pistacho Reset Controller Driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(pistachio_reset_driver);
Signature · 1 line
2.11.0
#4 lore raw

PATCH 3/4 reset: meson: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

arch/arm/mach-meson/Kconfig:menuconfig ARCH_MESON
arch/arm/mach-meson/Kconfig: bool "Amlogic Meson SoCs"

arch/arm64/Kconfig.platforms:config ARCH_MESON
arch/arm64/Kconfig.platforms: bool "Amlogic Platforms"

...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 <[email protected]>
Cc Carlo Caione <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc linux-amlogic at lists.infradead.org
Cc Neil Armstrong <[email protected]>
---
 drivers/reset/reset-meson.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/reset/reset-meson.c +4 -8
index c32f11a30c5f..a8b915eb8b58 100644
@@ -1,4 +1,6 @@
 /*
+ * Amlogic Meson Reset Controller driver
+ *
  * This file is provided under a dual BSD/GPLv2 license.  When using or
  * redistributing this file, you may do so under either license.
  *
@@ -53,7 +55,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include <linux/err.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
@@ -95,7 +97,6 @@ static const struct of_device_id meson_reset_dt_ids[] = {
 	 { .compatible = "amlogic,meson-gxbb-reset", },
 	 { /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, meson_reset_dt_ids);
 
 static int meson_reset_probe(struct platform_device *pdev)
 {
@@ -128,9 +129,4 @@ static struct platform_driver meson_reset_driver = {
 		.of_match_table	= meson_reset_dt_ids,
 	},
 };
-
-module_platform_driver(meson_reset_driver);
-
-MODULE_AUTHOR("Neil Armstrong <[email protected]>");
-MODULE_DESCRIPTION("Amlogic Meson Reset Controller driver");
-MODULE_LICENSE("Dual BSD/GPL");
+builtin_platform_driver(meson_reset_driver);
Signature · 1 line
2.11.0
Acked-by on v1 3/4
#5 lore raw

Re: [PATCH 3/4] reset: meson: make it explicitly non-modular

Quoted 62 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

arch/arm/mach-meson/Kconfig:menuconfig ARCH_MESON
arch/arm/mach-meson/Kconfig: bool "Amlogic Meson SoCs"

arch/arm64/Kconfig.platforms:config ARCH_MESON
arch/arm64/Kconfig.platforms: bool "Amlogic Platforms"

...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 <[email protected]>
Cc Carlo Caione <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc linux-amlogic at lists.infradead.org
Cc Neil Armstrong <[email protected]>
---
 drivers/reset/reset-meson.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/reset/reset-meson.c +3 -2
index c32f11a30c5f..a8b915eb8b58 100644
@@ -1,4 +1,6 @@
 /*
+ * Amlogic Meson Reset Controller driver
+ *
  * This file is provided under a dual BSD/GPLv2 license.  When using or
  * redistributing this file, you may do so under either license.
  *
@@ -53,7 +55,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include <linux/err.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
@@ -95,7 +97,6 @@ static const struct of_device_id meson_reset_dt_ids[] = {
 	 { .compatible = "amlogic,meson-gxbb-reset", },
 	 { /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, meson_reset_dt_ids);
 
 static int meson_reset_probe(struct platform_device *pdev)
 {

drivers/reset/reset-meson.c static struct platform_driver meson_reset_driver = { · line 132

Quoted 10 lines
drivers/reset/reset-meson.c +1 -6
@@ -128,9 +129,4 @@ static struct platform_driver meson_reset_driver = {
 		.of_match_table	= meson_reset_dt_ids,
 	},
 };
-
-module_platform_driver(meson_reset_driver);
-
-MODULE_AUTHOR("Neil Armstrong <[email protected]>");
-MODULE_DESCRIPTION("Amlogic Meson Reset Controller driver");
-MODULE_LICENSE("Dual BSD/GPL");
+builtin_platform_driver(meson_reset_driver);
#6 lore raw

PATCH 4/4 reset: oxnas: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/reset/Kconfig:config RESET_OXNAS
drivers/reset/Kconfig: bool

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

Lets remove the couple traces of modular infrastructure use, 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.

---
 drivers/reset/reset-oxnas.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/reset/reset-oxnas.c +2 -4
index 0d9036dea010..cf5b9742b86e 100644
@@ -18,7 +18,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/err.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
@@ -83,7 +83,6 @@ static const struct of_device_id oxnas_reset_dt_ids[] = {
 	 { .compatible = "oxsemi,ox820-reset", },
 	 { /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, oxnas_reset_dt_ids);
 
 static int oxnas_reset_probe(struct platform_device *pdev)
 {
@@ -123,5 +122,4 @@ static struct platform_driver oxnas_reset_driver = {
 		.of_match_table	= oxnas_reset_dt_ids,
 	},
 };
-
-module_platform_driver(oxnas_reset_driver);
+builtin_platform_driver(oxnas_reset_driver);
Signature · 1 line
2.11.0
Acked-by on v1 4/4
#7 lore raw

Re: [PATCH 4/4] reset: oxnas: make it explicitly non-modular

Quoted 47 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/reset/Kconfig:config RESET_OXNAS
drivers/reset/Kconfig: bool

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

Lets remove the couple traces of modular infrastructure use, 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.

---
 drivers/reset/reset-oxnas.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/reset/reset-oxnas.c +1 -2
index 0d9036dea010..cf5b9742b86e 100644
@@ -18,7 +18,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include <linux/err.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
@@ -83,7 +83,6 @@ static const struct of_device_id oxnas_reset_dt_ids[] = {
 	 { .compatible = "oxsemi,ox820-reset", },
 	 { /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, oxnas_reset_dt_ids);
 
 static int oxnas_reset_probe(struct platform_device *pdev)
 {

drivers/reset/reset-oxnas.c static struct platform_driver oxnas_reset_driver = { · line 125

Quoted 6 lines
drivers/reset/reset-oxnas.c +1 -2
@@ -123,5 +122,4 @@ static struct platform_driver oxnas_reset_driver = {
 		.of_match_table	= oxnas_reset_dt_ids,
 	},
 };
-
-module_platform_driver(oxnas_reset_driver);
+builtin_platform_driver(oxnas_reset_driver);
maintainer Applied
#8 lore raw
In reply to Paul Gortmaker

Hi Paul,

Quoted 5 lines · Paul Gortmaker

Recently, a new reset driver was added that used module stuff in a driver that was clearly non-modular[1]. With that in mind, it is probably wise to get the remaining patches I have locally for the existing reset drivers out the door, so we don't get any more future instances of a new driver copying the old error once again.

Applied, much appreciated.
I'll wait a bit for the remaining authors' Acked-by:s and then push them out.

regards
Philipp