Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1415637 > unrolled thread

[PATCH 0/9] pinctrl: make non-modular drivers really non modular

Started byPaul Gortmaker <paul.gortmaker@windriver.com>
First post2016-06-07 04:50 +0200
Last post2016-06-07 04:50 +0200
Articles 12 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/9] pinctrl: make non-modular drivers really non modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-06-07 04:50 +0200
    [PATCH 8/9] pinctrl: digicolor: make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-06-07 04:50 +0200
      Re: [PATCH 8/9] pinctrl: digicolor: make it explicitly non-modular Baruch Siach <baruch@tkos.co.il> - 2016-06-07 08:20 +0200
    [PATCH 7/9] pinctrl: zynq: make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-06-07 04:50 +0200
      Re: [PATCH 7/9] pinctrl: zynq: make it explicitly non-modular Sören Brinkmann <soren.brinkmann@xilinx.com> - 2016-06-07 05:00 +0200
      Re: [PATCH 7/9] pinctrl: zynq: make it explicitly non-modular Michal Simek <michal.simek@xilinx.com> - 2016-06-07 10:00 +0200
    [PATCH 3/9] pinctrl: at91: make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-06-07 04:50 +0200
    [PATCH 2/9] pinctrl: baytrail: make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-06-07 04:50 +0200
      Re: [PATCH 2/9] pinctrl: baytrail: make it explicitly non-modular Mika Westerberg <mika.westerberg@linux.intel.com> - 2016-06-09 16:20 +0200
    [PATCH 1/9] pinctrl: as3722: make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-06-07 04:50 +0200
      Re: [PATCH 1/9] pinctrl: as3722: make it explicitly non-modular Laxman Dewangan <ldewangan@nvidia.com> - 2016-06-07 08:50 +0200
    [PATCH 4/9] pinctrl: lpc18xx: make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-06-07 04:50 +0200

#1415637 — [PATCH 0/9] pinctrl: make non-modular drivers really non modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-06-07 04:50 +0200
Subject[PATCH 0/9] pinctrl: make non-modular drivers really non modular
Message-ID<rHffz-5aj-3@gated-at.bofh.it>
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 <baruch@tkos.co.il>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Jeff Wu <Jeff.Wu@amd.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: Ken Xue <Ken.Xue@amd.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Ludovic Desroches <ludovic.desroches@atmel.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Cc: linux-gpio@vger.kernel.org

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

-- 
2.8.0

[toc] | [next] | [standalone]


#1415639 — [PATCH 8/9] pinctrl: digicolor: make it explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-06-07 04:50 +0200
Subject[PATCH 8/9] pinctrl: digicolor: make it explicitly non-modular
Message-ID<rHffz-5aj-9@gated-at.bofh.it>
In reply to#1415637
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.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pinctrl/pinctrl-digicolor.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-digicolor.c b/drivers/pinctrl/pinctrl-digicolor.c
index c8073d442dcb..aba3da5ee844 100644
--- a/drivers/pinctrl/pinctrl-digicolor.c
+++ b/drivers/pinctrl/pinctrl-digicolor.c
@@ -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);
-- 
2.8.0

[toc] | [prev] | [next] | [standalone]


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

FromBaruch Siach <baruch@tkos.co.il>
Date2016-06-07 08:20 +0200
SubjectRe: [PATCH 8/9] pinctrl: digicolor: make it explicitly non-modular
Message-ID<rHiwO-7rh-5@gated-at.bofh.it>
In reply to#1415639
Hi Paul,

On Mon, Jun 06, 2016 at 10:43:07PM -0400, Paul Gortmaker wrote:
> 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.
> 
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Baruch Siach <baruch@tkos.co.il>
> Cc: linux-gpio@vger.kernel.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

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:

Acked-by: Baruch Siach <baruch@tkos.co.il>

baruch

> ---
>  drivers/pinctrl/pinctrl-digicolor.c | 16 +++-------------
>  1 file changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-digicolor.c b/drivers/pinctrl/pinctrl-digicolor.c
> index c8073d442dcb..aba3da5ee844 100644
> --- a/drivers/pinctrl/pinctrl-digicolor.c
> +++ b/drivers/pinctrl/pinctrl-digicolor.c
> @@ -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);
> -- 
> 2.8.0
> 

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

[toc] | [prev] | [next] | [standalone]


#1415640 — [PATCH 7/9] pinctrl: zynq: make it explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-06-07 04:50 +0200
Subject[PATCH 7/9] pinctrl: zynq: make it explicitly non-modular
Message-ID<rHffz-5aj-15@gated-at.bofh.it>
In reply to#1415637
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 <linus.walleij@linaro.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pinctrl/pinctrl-zynq.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-zynq.c b/drivers/pinctrl/pinctrl-zynq.c
index 8fdc60c5aeaf..7afdbede6823 100644
--- a/drivers/pinctrl/pinctrl-zynq.c
+++ b/drivers/pinctrl/pinctrl-zynq.c
@@ -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 <soren.brinkmann@xilinx.com>");
-MODULE_DESCRIPTION("Xilinx Zynq pinctrl driver");
-MODULE_LICENSE("GPL");
-- 
2.8.0

[toc] | [prev] | [next] | [standalone]


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

FromSören Brinkmann <soren.brinkmann@xilinx.com>
Date2016-06-07 05:00 +0200
SubjectRe: [PATCH 7/9] pinctrl: zynq: make it explicitly non-modular
Message-ID<rHfpf-5dv-3@gated-at.bofh.it>
In reply to#1415640
On Mon, 2016-06-06 at 22:43:06 -0400, Paul Gortmaker wrote:
> 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 <linus.walleij@linaro.org>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
> Cc: linux-gpio@vger.kernel.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: "Sören Brinkmann" <soren.brinkmann@xilinx.com>

	Sören

[toc] | [prev] | [next] | [standalone]


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

FromMichal Simek <michal.simek@xilinx.com>
Date2016-06-07 10:00 +0200
SubjectRe: [PATCH 7/9] pinctrl: zynq: make it explicitly non-modular
Message-ID<rHk5A-8fO-21@gated-at.bofh.it>
In reply to#1415640
On 7.6.2016 04:43, Paul Gortmaker wrote:
> 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 <linus.walleij@linaro.org>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
> Cc: linux-gpio@vger.kernel.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  drivers/pinctrl/pinctrl-zynq.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-zynq.c b/drivers/pinctrl/pinctrl-zynq.c
> index 8fdc60c5aeaf..7afdbede6823 100644
> --- a/drivers/pinctrl/pinctrl-zynq.c
> +++ b/drivers/pinctrl/pinctrl-zynq.c
> @@ -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 <soren.brinkmann@xilinx.com>");
> -MODULE_DESCRIPTION("Xilinx Zynq pinctrl driver");
> -MODULE_LICENSE("GPL");
> 

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

Thanks,
Michal

[toc] | [prev] | [next] | [standalone]


#1415641 — [PATCH 3/9] pinctrl: at91: make it explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-06-07 04:50 +0200
Subject[PATCH 3/9] pinctrl: at91: make it explicitly non-modular
Message-ID<rHffz-5aj-11@gated-at.bofh.it>
In reply to#1415637
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 <plagnioj@jcrosoft.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pinctrl/pinctrl-at91.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index b7c0d6f7c046..cb9a0849b8ba 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -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 <plagnioj@jcrosoft.com>");
-MODULE_DESCRIPTION("Atmel AT91 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.0

[toc] | [prev] | [next] | [standalone]


#1415642 — [PATCH 2/9] pinctrl: baytrail: make it explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-06-07 04:50 +0200
Subject[PATCH 2/9] pinctrl: baytrail: make it explicitly non-modular
Message-ID<rHffz-5aj-19@gated-at.bofh.it>
In reply to#1415637
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 <mika.westerberg@linux.intel.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 677a811b3a6f..b2df03e9e431 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -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);
-- 
2.8.0

[toc] | [prev] | [next] | [standalone]


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

FromMika Westerberg <mika.westerberg@linux.intel.com>
Date2016-06-09 16:20 +0200
SubjectRe: [PATCH 2/9] pinctrl: baytrail: make it explicitly non-modular
Message-ID<rI8Yq-7uB-19@gated-at.bofh.it>
In reply to#1415642
On Mon, Jun 06, 2016 at 10:43:01PM -0400, Paul Gortmaker wrote:
> 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 <mika.westerberg@linux.intel.com>

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

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

[toc] | [prev] | [next] | [standalone]


#1415643 — [PATCH 1/9] pinctrl: as3722: make it explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-06-07 04:50 +0200
Subject[PATCH 1/9] pinctrl: as3722: make it explicitly non-modular
Message-ID<rHffz-5aj-21@gated-at.bofh.it>
In reply to#1415637
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.

Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pinctrl/pinctrl-as3722.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c
index 4e9fe7854e8a..fb4f5372ab04 100644
--- a/drivers/pinctrl/pinctrl-as3722.c
+++ b/drivers/pinctrl/pinctrl-as3722.c
@@ -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<ldewangan@nvidia.com>");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(as3722_pinctrl_driver);
-- 
2.8.0

[toc] | [prev] | [next] | [standalone]


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

FromLaxman Dewangan <ldewangan@nvidia.com>
Date2016-06-07 08:50 +0200
SubjectRe: [PATCH 1/9] pinctrl: as3722: make it explicitly non-modular
Message-ID<rHiZP-7Do-15@gated-at.bofh.it>
In reply to#1415643
On Tuesday 07 June 2016 08:13 AM, Paul Gortmaker wrote:
> 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.
>
> Cc: Laxman Dewangan <ldewangan@nvidia.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-gpio@vger.kernel.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>


I will say lets make the driver as tristate.

tristate "Pinctrl and GPIO driver for ams AS3722 PMIC"

[toc] | [prev] | [next] | [standalone]


#1415644 — [PATCH 4/9] pinctrl: lpc18xx: make it explicitly non-modular

FromPaul Gortmaker <paul.gortmaker@windriver.com>
Date2016-06-07 04:50 +0200
Subject[PATCH 4/9] pinctrl: lpc18xx: make it explicitly non-modular
Message-ID<rHffz-5aj-17@gated-at.bofh.it>
In reply to#1415637
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.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pinctrl/pinctrl-lpc18xx.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-lpc18xx.c b/drivers/pinctrl/pinctrl-lpc18xx.c
index 8a931c7ba2ff..e053f1fa5512 100644
--- a/drivers/pinctrl/pinctrl-lpc18xx.c
+++ b/drivers/pinctrl/pinctrl-lpc18xx.c
@@ -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 <manabian@gmail.com>");
-MODULE_DESCRIPTION("Pinctrl driver for NXP LPC18xx/43xx SCU");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(lpc18xx_scu_driver);
-- 
2.8.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web