Skip to contentSkip to conversation

pinctrl: make non-modular drivers really non modular

PATCH In review Paul Gortmaker 8 participants 24 messages Jun 7, 2016 – Jun 13, 2016

Subsystems (9)
lore
Share & tools
lore
#8 lore raw

PATCH 4/9 pinctrl: lpc18xx: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_LPC18XX
bool "NXP LPC18XX/43XX SCU pinctrl driver"

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

---
 drivers/pinctrl/pinctrl-lpc18xx.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
drivers/pinctrl/pinctrl-lpc18xx.c +3 -17
index 8a931c7ba2ff..e053f1fa5512 100644
@@ -11,7 +11,7 @@
 #include <linux/bitops.h>
 #include <linux/clk.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/pinctrl/pinctrl.h>
@@ -1365,31 +1365,17 @@ static int lpc18xx_scu_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int lpc18xx_scu_remove(struct platform_device *pdev)
-{
-	struct lpc18xx_scu_data *scu = platform_get_drvdata(pdev);
-
-	clk_disable_unprepare(scu->clk);
-
-	return 0;
-}
-
 static const struct of_device_id lpc18xx_scu_match[] = {
 	{ .compatible = "nxp,lpc1850-scu" },
 	{},
 };
-MODULE_DEVICE_TABLE(of, lpc18xx_scu_match);
 
 static struct platform_driver lpc18xx_scu_driver = {
 	.probe		= lpc18xx_scu_probe,
-	.remove		= lpc18xx_scu_remove,
 	.driver = {
 		.name		= "lpc18xx-scu",
 		.of_match_table	= lpc18xx_scu_match,
+		.suppress_bind_attrs = true,
 	},
 };
-module_platform_driver(lpc18xx_scu_driver);
-
-MODULE_AUTHOR("Joachim Eastwood <[email protected]>");
-MODULE_DESCRIPTION("Pinctrl driver for NXP LPC18xx/43xx SCU");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(lpc18xx_scu_driver);
Signature · 1 line
2.8.0
#10 lore raw

PATCH 5/9 pinctrl: amd: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_AMD
bool "AMD GPIO pin control"

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

---
 drivers/pinctrl/pinctrl-amd.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)
drivers/pinctrl/pinctrl-amd.c +3 -20
index 634b4d30eefb..b466d70b9004 100644
@@ -13,7 +13,7 @@
 #include <linux/err.h>
 #include <linux/bug.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/compiler.h>
 #include <linux/types.h>
@@ -828,35 +828,18 @@ out2:
 	return ret;
 }
 
-static int amd_gpio_remove(struct platform_device *pdev)
-{
-	struct amd_gpio *gpio_dev;
-
-	gpio_dev = platform_get_drvdata(pdev);
-
-	gpiochip_remove(&gpio_dev->gc);
-
-	return 0;
-}
-
 static const struct acpi_device_id amd_gpio_acpi_match[] = {
 	{ "AMD0030", 0 },
 	{ "AMDI0030", 0},
 	{ },
 };
-MODULE_DEVICE_TABLE(acpi, amd_gpio_acpi_match);
 
 static struct platform_driver amd_gpio_driver = {
 	.driver		= {
 		.name	= "amd_gpio",
+		.suppress_bind_attrs = true,
 		.acpi_match_table = ACPI_PTR(amd_gpio_acpi_match),
 	},
 	.probe		= amd_gpio_probe,
-	.remove		= amd_gpio_remove,
 };
-
-module_platform_driver(amd_gpio_driver);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Ken Xue <[email protected]>, Jeff Wu <[email protected]>");
-MODULE_DESCRIPTION("AMD GPIO pinctrl driver");
+builtin_platform_driver(amd_gpio_driver);
Signature · 1 line
2.8.0
#12 lore raw

PATCH 6/9 pinctrl: palmas: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_PALMAS
bool "Pinctrl driver for the PALMAS Series MFD devices"

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

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

---
 drivers/pinctrl/pinctrl-palmas.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/pinctrl/pinctrl-palmas.c +2 -8
index 8edb3f8c72c8..3def8805a882 100644
@@ -21,7 +21,7 @@
  */
 
 #include <linux/delay.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/mfd/palmas.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -1059,10 +1059,4 @@ static struct platform_driver palmas_pinctrl_driver = {
 	},
 	.probe = palmas_pinctrl_probe,
 };
-
-module_platform_driver(palmas_pinctrl_driver);
-
-MODULE_DESCRIPTION("Palmas pin control driver");
-MODULE_AUTHOR("Laxman Dewangan<[email protected]>");
-MODULE_ALIAS("platform:palmas-pinctrl");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(palmas_pinctrl_driver);
Signature · 1 line
2.8.0
#14 lore raw

PATCH 7/9 pinctrl: zynq: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_ZYNQ
bool "Pinctrl driver for Xilinx Zynq"

...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 is already contained at the top of the file in the comments.

Cc Linus Walleij <[email protected]>
Cc Michal Simek <[email protected]>
Cc "Sören Brinkmann" <[email protected]>
---
 drivers/pinctrl/pinctrl-zynq.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/pinctrl/pinctrl-zynq.c +1 -12
index 8fdc60c5aeaf..7afdbede6823 100644
@@ -20,7 +20,7 @@
  */
 #include <linux/io.h>
 #include <linux/mfd/syscon.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pinctrl/pinctrl.h>
@@ -1210,7 +1210,6 @@ static const struct of_device_id zynq_pinctrl_of_match[] = {
 	{ .compatible = "xlnx,pinctrl-zynq" },
 	{ }
 };
-MODULE_DEVICE_TABLE(of, zynq_pinctrl_of_match);
 
 static struct platform_driver zynq_pinctrl_driver = {
 	.driver = {
@@ -1225,13 +1224,3 @@ static int __init zynq_pinctrl_init(void)
 	return platform_driver_register(&zynq_pinctrl_driver);
 }
 arch_initcall(zynq_pinctrl_init);
-
-static void __exit zynq_pinctrl_exit(void)
-{
-	platform_driver_unregister(&zynq_pinctrl_driver);
-}
-module_exit(zynq_pinctrl_exit);
-
-MODULE_AUTHOR("Sören Brinkmann <[email protected]>");
-MODULE_DESCRIPTION("Xilinx Zynq pinctrl driver");
-MODULE_LICENSE("GPL");
Signature · 1 line
2.8.0
#21 lore raw

PATCH 9/9 pinctrl: at91-pio4: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/Kconfig:config PINCTRL_AT91PIO4
drivers/pinctrl/Kconfig: bool "AT91 PIO4 pinctrl driver"

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

---
 drivers/pinctrl/pinctrl-at91-pio4.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)
drivers/pinctrl/pinctrl-at91-pio4.c +3 -19
index a025b40d246b..4438dca85c1c 100644
@@ -20,7 +20,7 @@
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pinctrl/pinconf.h>
@@ -879,7 +879,6 @@ static const struct of_device_id atmel_pctrl_of_match[] = {
 		/* sentinel */
 	}
 };
-MODULE_DEVICE_TABLE(of, atmel_pctrl_of_match);
 
 static int atmel_pinctrl_probe(struct platform_device *pdev)
 {
@@ -1074,28 +1073,13 @@ clk_prepare_enable_error:
 	return ret;
 }
 
-int atmel_pinctrl_remove(struct platform_device *pdev)
-{
-	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
-
-	irq_domain_remove(atmel_pioctrl->irq_domain);
-	clk_disable_unprepare(atmel_pioctrl->clk);
-	gpiochip_remove(atmel_pioctrl->gpio_chip);
-
-	return 0;
-}
-
 static struct platform_driver atmel_pinctrl_driver = {
 	.driver = {
 		.name = "pinctrl-at91-pio4",
 		.of_match_table = atmel_pctrl_of_match,
 		.pm = &atmel_pctrl_pm_ops,
+		.suppress_bind_attrs = true,
 	},
 	.probe = atmel_pinctrl_probe,
-	.remove = atmel_pinctrl_remove,
 };
-module_platform_driver(atmel_pinctrl_driver);
-
-MODULE_AUTHOR(Ludovic Desroches <[email protected]>);
-MODULE_DESCRIPTION("Atmel PIO4 pinctrl driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(atmel_pinctrl_driver);
Signature · 1 line
2.8.0
#1 lore raw

PATCH 1/9 pinctrl: as3722: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_AS3722
bool "Pinctrl and GPIO driver for ams AS3722 PMIC"

...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_ALIAS and MODULE_DEVICE_TABLE are a no-op for non-modular code and hence both are removed.

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

---
 drivers/pinctrl/pinctrl-as3722.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
drivers/pinctrl/pinctrl-as3722.c +3 -17
index 4e9fe7854e8a..fb4f5372ab04 100644
@@ -23,7 +23,7 @@
 #include <linux/delay.h>
 #include <linux/gpio.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/mfd/as3722.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -599,31 +599,17 @@ fail_range_add:
 	return ret;
 }
 
-static int as3722_pinctrl_remove(struct platform_device *pdev)
-{
-	struct as3722_pctrl_info *as_pci = platform_get_drvdata(pdev);
-
-	gpiochip_remove(&as_pci->gpio_chip);
-	return 0;
-}
-
 static const struct of_device_id as3722_pinctrl_of_match[] = {
 	{ .compatible = "ams,as3722-pinctrl", },
 	{ },
 };
-MODULE_DEVICE_TABLE(of, as3722_pinctrl_of_match);
 
 static struct platform_driver as3722_pinctrl_driver = {
 	.driver = {
 		.name = "as3722-pinctrl",
+		.suppress_bind_attrs = true,
 		.of_match_table = as3722_pinctrl_of_match,
 	},
 	.probe = as3722_pinctrl_probe,
-	.remove = as3722_pinctrl_remove,
 };
-module_platform_driver(as3722_pinctrl_driver);
-
-MODULE_ALIAS("platform:as3722-pinctrl");
-MODULE_DESCRIPTION("AS3722 pin control and GPIO driver");
-MODULE_AUTHOR("Laxman Dewangan<[email protected]>");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(as3722_pinctrl_driver);
Signature · 1 line
2.8.0
#3 lore raw

PATCH 2/9 pinctrl: baytrail: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_BAYTRAIL
bool "Intel Baytrail GPIO pin control"

...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_init() was already not in use in this driver, we don't have any concerns with init ordering changes here.

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 Mika Westerberg <[email protected]>
Cc Heikki Krogerus <[email protected]>
Cc Linus Walleij <[email protected]>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)
drivers/pinctrl/intel/pinctrl-baytrail.c +4 -21
index 677a811b3a6f..b2df03e9e431 100644
@@ -15,7 +15,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/bitops.h>
@@ -1822,17 +1821,6 @@ static int byt_pinctrl_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int byt_pinctrl_remove(struct platform_device *pdev)
-{
-	struct byt_gpio *vg = platform_get_drvdata(pdev);
-
-	pm_runtime_disable(&pdev->dev);
-	gpiochip_remove(&vg->chip);
-	pinctrl_unregister(vg->pctl_dev);
-
-	return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int byt_gpio_suspend(struct device *dev)
 {
@@ -1930,10 +1918,11 @@ static const struct dev_pm_ops byt_gpio_pm_ops = {
 
 static struct platform_driver byt_gpio_driver = {
 	.probe          = byt_pinctrl_probe,
-	.remove         = byt_pinctrl_remove,
 	.driver         = {
-		.name   = "byt_gpio",
-		.pm	= &byt_gpio_pm_ops,
+		.name			= "byt_gpio",
+		.pm			= &byt_gpio_pm_ops,
+		.suppress_bind_attrs	= true,
+
 		.acpi_match_table = ACPI_PTR(byt_gpio_acpi_match),
 	},
 };
@@ -1943,9 +1932,3 @@ static int __init byt_gpio_init(void)
 	return platform_driver_register(&byt_gpio_driver);
 }
 subsys_initcall(byt_gpio_init);
-
-static void __exit byt_gpio_exit(void)
-{
-	platform_driver_unregister(&byt_gpio_driver);
-}
-module_exit(byt_gpio_exit);
Signature · 1 line
2.8.0
#0 lore raw

cover pinctrl: make non-modular drivers really non modular

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.

Similar to what was done for GPIO, I'd divided up the the audit of modular usage in non-modular pinctrl drivers into reasonable batch sizes to hopefully ease review.

This batch deals with individual standalone drivers that are nearly all in the top level directory.

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 was at the level of device_initcall and remains so, by using the builtin equivalents.

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

Paul.
---

Cc Baruch Siach <[email protected]>
Cc Heikki Krogerus <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Jeff Wu <[email protected]>
Cc Joachim Eastwood <[email protected]>
Cc Ken Xue <[email protected]>
Cc Laxman Dewangan <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Ludovic Desroches <[email protected]>
Cc Michal Simek <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc "Sören Brinkmann" <[email protected]>

Paul Gortmaker (9):
pinctrl: as3722: make it explicitly non-modular
pinctrl: baytrail: make it explicitly non-modular
pinctrl: at91: make it explicitly non-modular
pinctrl: lpc18xx: make it explicitly non-modular
pinctrl: amd: make it explicitly non-modular
pinctrl: palmas: make it explicitly non-modular
pinctrl: zynq: make it explicitly non-modular
pinctrl: digicolor: make it explicitly non-modular
pinctrl: at91-pio4: make it explicitly non-modular

 drivers/pinctrl/intel/pinctrl-baytrail.c | 25 ++++---------------------
 drivers/pinctrl/pinctrl-amd.c            | 23 +++--------------------
 drivers/pinctrl/pinctrl-as3722.c         | 20 +++-----------------
 drivers/pinctrl/pinctrl-at91-pio4.c      | 22 +++-------------------
 drivers/pinctrl/pinctrl-at91.c           | 11 -----------
 drivers/pinctrl/pinctrl-digicolor.c      | 16 +++-------------
 drivers/pinctrl/pinctrl-lpc18xx.c        | 20 +++-----------------
 drivers/pinctrl/pinctrl-palmas.c         | 10 ++--------
 drivers/pinctrl/pinctrl-zynq.c           | 13 +------------
 9 files changed, 22 insertions(+), 138 deletions(-)
Signature · 6 lines
2.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#17 lore raw

PATCH 8/9 pinctrl: digicolor: make it explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/Kconfig:config PINCTRL_DIGICOLOR
drivers/pinctrl/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.

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.

---
 drivers/pinctrl/pinctrl-digicolor.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/pinctrl/pinctrl-digicolor.c +3 -13
index c8073d442dcb..aba3da5ee844 100644
@@ -15,7 +15,7 @@
  * - Pin pad configuration (pull up/down, strength)
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -337,27 +337,17 @@ static int dc_pinctrl_probe(struct platform_device *pdev)
 	return dc_gpiochip_add(pmap, pdev->dev.of_node);
 }
 
-static int dc_pinctrl_remove(struct platform_device *pdev)
-{
-	struct dc_pinmap *pmap = platform_get_drvdata(pdev);
-
-	gpiochip_remove(&pmap->chip);
-
-	return 0;
-}
-
 static const struct of_device_id dc_pinctrl_ids[] = {
 	{ .compatible = "cnxt,cx92755-pinctrl" },
 	{ /* sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, dc_pinctrl_ids);
 
 static struct platform_driver dc_pinctrl_driver = {
 	.driver = {
 		.name = DRIVER_NAME,
 		.of_match_table = dc_pinctrl_ids,
+		.suppress_bind_attrs = true,
 	},
 	.probe = dc_pinctrl_probe,
-	.remove = dc_pinctrl_remove,
 };
-module_platform_driver(dc_pinctrl_driver);
+builtin_platform_driver(dc_pinctrl_driver);
Signature · 1 line
2.8.0
#6 lore raw

PATCH 3/9 pinctrl: at91: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/Kconfig:config PINCTRL_AT91
drivers/pinctrl/Kconfig: bool "AT91 pinctrl driver"

...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 being used in this driver, we don't need to be concerned with initcall ordering changes when removing it.

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 Jean-Christophe Plagniol-Villard <[email protected]>
Cc Linus Walleij <[email protected]>
---
 drivers/pinctrl/pinctrl-at91.c | 11 -----------
 1 file changed, 11 deletions(-)
drivers/pinctrl/pinctrl-at91.c +0 -11
index b7c0d6f7c046..cb9a0849b8ba 100644
@@ -9,7 +9,6 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/init.h>
-#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_address.h>
@@ -1818,13 +1817,3 @@ static int __init at91_pinctrl_init(void)
 	return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
 }
 arch_initcall(at91_pinctrl_init);
-
-static void __exit at91_pinctrl_exit(void)
-{
-	platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
-}
-
-module_exit(at91_pinctrl_exit);
-MODULE_AUTHOR("Jean-Christophe PLAGNIOL-VILLARD <[email protected]>");
-MODULE_DESCRIPTION("Atmel AT91 pinctrl driver");
-MODULE_LICENSE("GPL v2");
Signature · 1 line
2.8.0
Acked-by on v1 7/9
#15 lore raw

Re: [PATCH 7/9] pinctrl: zynq: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 16 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_ZYNQ
bool "Pinctrl driver for Xilinx Zynq"

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

Quoted 8 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 Linus Walleij <[email protected]>
Cc Michal Simek <[email protected]>
Cc "Sören Brinkmann" <[email protected]>

Sören

maintainer Acked-by on v1 8/9
#18 lore raw

Re: [PATCH 8/9] pinctrl: digicolor: make it explicitly non-modular

In reply to Paul Gortmaker

Hi Paul,

Quoted 18 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/Kconfig:config PINCTRL_DIGICOLOR
drivers/pinctrl/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.

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 6 lines

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

Thanks. In addition to that you can also revert 8b2b3dcb343b (pinctrl:
digicolor: add missing platform_set_drvdata() call) that is currently in the linux-pinctrl tree. Other then that:

baruch

Quoted 50 lines
---
 drivers/pinctrl/pinctrl-digicolor.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/pinctrl/pinctrl-digicolor.c +3 -13
index c8073d442dcb..aba3da5ee844 100644
@@ -15,7 +15,7 @@
  * - Pin pad configuration (pull up/down, strength)
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -337,27 +337,17 @@ static int dc_pinctrl_probe(struct platform_device *pdev)
 	return dc_gpiochip_add(pmap, pdev->dev.of_node);
 }
 
-static int dc_pinctrl_remove(struct platform_device *pdev)
-{
-	struct dc_pinmap *pmap = platform_get_drvdata(pdev);
-
-	gpiochip_remove(&pmap->chip);
-
-	return 0;
-}
-
 static const struct of_device_id dc_pinctrl_ids[] = {
 	{ .compatible = "cnxt,cx92755-pinctrl" },
 	{ /* sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, dc_pinctrl_ids);
 
 static struct platform_driver dc_pinctrl_driver = {
 	.driver = {
 		.name = DRIVER_NAME,
 		.of_match_table = dc_pinctrl_ids,
+		.suppress_bind_attrs = true,
 	},
 	.probe = dc_pinctrl_probe,
-	.remove = dc_pinctrl_remove,
 };
-module_platform_driver(dc_pinctrl_driver);
+builtin_platform_driver(dc_pinctrl_driver);
Signature · 1 line
2.8.0
Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -
#13 lore raw

Re: [PATCH 6/9] pinctrl: palmas: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 14 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_PALMAS
bool "Pinctrl driver for the PALMAS Series MFD devices"

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

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.

Let's make the driver as tristate.

tristate "Pinctrl driver for the PALMAS Series MFD devices"

#2 lore raw

Re: [PATCH 1/9] pinctrl: as3722: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 21 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_AS3722
bool "Pinctrl and GPIO driver for ams AS3722 PMIC"

...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_ALIAS and MODULE_DEVICE_TABLE are a no-op for non-modular code and hence both are removed.

Quoted 8 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.

I will say lets make the driver as tristate.

tristate "Pinctrl and GPIO driver for ams AS3722 PMIC"

Acked-by on v1 7/9
#16 lore raw

Re: [PATCH 7/9] pinctrl: zynq: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 54 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_ZYNQ
bool "Pinctrl driver for Xilinx Zynq"

...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 is already contained at the top of the file in the comments.

Cc Linus Walleij <[email protected]>
Cc Michal Simek <[email protected]>
Cc "Sören Brinkmann" <[email protected]>
---
 drivers/pinctrl/pinctrl-zynq.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/pinctrl/pinctrl-zynq.c +1 -2
index 8fdc60c5aeaf..7afdbede6823 100644
@@ -20,7 +20,7 @@
  */
 #include <linux/io.h>
 #include <linux/mfd/syscon.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pinctrl/pinctrl.h>
@@ -1210,7 +1210,6 @@ static const struct of_device_id zynq_pinctrl_of_match[] = {
 	{ .compatible = "xlnx,pinctrl-zynq" },
 	{ }
 };
-MODULE_DEVICE_TABLE(of, zynq_pinctrl_of_match);
 
 static struct platform_driver zynq_pinctrl_driver = {
 	.driver = {
@@ -1225,13 +1224,3 @@ static int __init zynq_pinctrl_init(void)
 	return platform_driver_register(&zynq_pinctrl_driver);
 }
 arch_initcall(zynq_pinctrl_init);

drivers/pinctrl/pinctrl-zynq.c static int __init zynq_pinctrl_init(void) · line 1237

Quoted 10 lines
drivers/pinctrl/pinctrl-zynq.c +0 -10
-
-static void __exit zynq_pinctrl_exit(void)
-{
-	platform_driver_unregister(&zynq_pinctrl_driver);
-}
-module_exit(zynq_pinctrl_exit);
-
-MODULE_AUTHOR("Sören Brinkmann <[email protected]>");
-MODULE_DESCRIPTION("Xilinx Zynq pinctrl driver");
-MODULE_LICENSE("GPL");

Thanks,
Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by on v1 9/9
#22 lore raw

Re: [PATCH 9/9] pinctrl: at91-pio4: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 20 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/Kconfig:config PINCTRL_AT91PIO4
drivers/pinctrl/Kconfig: bool "AT91 PIO4 pinctrl driver"

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

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.

Thanks for cleaning this stuff.

Quoted 59 lines
---
 drivers/pinctrl/pinctrl-at91-pio4.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)
drivers/pinctrl/pinctrl-at91-pio4.c +3 -19
index a025b40d246b..4438dca85c1c 100644
@@ -20,7 +20,7 @@
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pinctrl/pinconf.h>
@@ -879,7 +879,6 @@ static const struct of_device_id atmel_pctrl_of_match[] = {
 		/* sentinel */
 	}
 };
-MODULE_DEVICE_TABLE(of, atmel_pctrl_of_match);
 
 static int atmel_pinctrl_probe(struct platform_device *pdev)
 {
@@ -1074,28 +1073,13 @@ clk_prepare_enable_error:
 	return ret;
 }
 
-int atmel_pinctrl_remove(struct platform_device *pdev)
-{
-	struct atmel_pioctrl *atmel_pioctrl = platform_get_drvdata(pdev);
-
-	irq_domain_remove(atmel_pioctrl->irq_domain);
-	clk_disable_unprepare(atmel_pioctrl->clk);
-	gpiochip_remove(atmel_pioctrl->gpio_chip);
-
-	return 0;
-}
-
 static struct platform_driver atmel_pinctrl_driver = {
 	.driver = {
 		.name = "pinctrl-at91-pio4",
 		.of_match_table = atmel_pctrl_of_match,
 		.pm = &atmel_pctrl_pm_ops,
+		.suppress_bind_attrs = true,
 	},
 	.probe = atmel_pinctrl_probe,
-	.remove = atmel_pinctrl_remove,
 };
-module_platform_driver(atmel_pinctrl_driver);
-
-MODULE_AUTHOR(Ludovic Desroches <[email protected]>);
-MODULE_DESCRIPTION("Atmel PIO4 pinctrl driver");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(atmel_pinctrl_driver);
Signature · 1 line
2.8.0
maintainer Acked-by on v1 2/9
#4 lore raw

Re: [PATCH 2/9] pinctrl: baytrail: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 17 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_BAYTRAIL
bool "Intel Baytrail GPIO pin control"

...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_init() was already not in use in this driver, we don't have any concerns with init ordering changes here.

Quoted 6 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 is already contained at the top of the file in the comments.

Cc Mika Westerberg <[email protected]>

Yeah, probably good thing to do. No objections from me.

#5 lore raw

Re: [PATCH 2/9] pinctrl: baytrail: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 19 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_BAYTRAIL
bool "Intel Baytrail GPIO pin control"

...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_init() was already not in use in this driver, we don't have any concerns with init ordering changes here.

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

Quoted 8 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 Mika Westerberg <[email protected]>
Cc Heikki Krogerus <[email protected]>
Cc Linus Walleij <[email protected]>

Patch applied with Mika's ACK.

Yours,
Linus Walleij

#7 lore raw

Re: [PATCH 3/9] pinctrl: at91: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 13 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/Kconfig:config PINCTRL_AT91
drivers/pinctrl/Kconfig: bool "AT91 pinctrl driver"

...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 being used in this driver, we don't need to be concerned with initcall ordering changes when removing it.

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 Jean-Christophe Plagniol-Villard <[email protected]>
Cc Linus Walleij <[email protected]>

Patch applied.

Yours,
Linus Walleij

#9 lore raw

Re: [PATCH 4/9] pinctrl: lpc18xx: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 20 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_LPC18XX
bool "NXP LPC18XX/43XX SCU pinctrl driver"

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

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.

Patch applied.

Yours,
Linus Walleij

#11 lore raw

Re: [PATCH 5/9] pinctrl: amd: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 20 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

config PINCTRL_AMD
bool "AMD GPIO pin control"

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

Quoted 8 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.

Patch applied.

Yours,
Linus Walleij

#20 lore raw

Re: [PATCH 8/9] pinctrl: digicolor: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 18 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/Kconfig:config PINCTRL_DIGICOLOR
drivers/pinctrl/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.

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 6 lines

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

Patch applied with Baruch's ACK.

Yours,
Linus Walleij

#19 lore raw

Re: [PATCH 8/9] pinctrl: digicolor: make it explicitly non-modular

In reply to Baruch Siach
Quoted 3 lines · Baruch Siach

Thanks. In addition to that you can also revert 8b2b3dcb343b (pinctrl:
digicolor: add missing platform_set_drvdata() call) that is currently in the linux-pinctrl tree.

That must be discussed in the context of the offending patch, not in this mail trail.

Yours,
Linus Walleij

#23 lore raw

Re: [PATCH 9/9] pinctrl: at91-pio4: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 20 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/Kconfig:config PINCTRL_AT91PIO4
drivers/pinctrl/Kconfig: bool "AT91 PIO4 pinctrl driver"

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

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.

Patch applied with Ludovic's ACK.

Yours,
Linus Walleij