linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] drivers/pinctrl: remove truly orphaned module code
@ 2016-02-29 20:48 Paul Gortmaker
       [not found] ` <1456778924-20730-1-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Gortmaker @ 2016-02-29 20:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Antoine Tenart, Beniamino Galvani,
	Boris Brezillon, Carlo Caione, Chen-Yu Tsai, Geert Uytterhoeven,
	Hans de Goede, Hongzhou Yang, Laurent Pinchart, Linus Walleij,
	Masahiro Yamada, Matthias Brugger, Maxime Coquelin, Maxime Ripard,
	Patrice Chotard, Thomas Abraham, Tomasz Figa, Vishnu Patekar,
	linux-arm-kernel

This series of commits is a part of a larger project to ensure
people don't reference modular support functions in non-modular
code.  Overall there was roughly 5k lines of dead code in the
kernel due to this.  So far we've fixed several areas, like tty,
x86, net, ... and we continue to work on other areas.

There are several reasons to not use module support for code that
can never be built as a module, but the big ones are:

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

This group represents roughly 1/2 of the pinctrl commits I've got under
testing locally.  The commonality within this group is that there should
be zero runtime changes with this series, because none of the drivers
here deployed a ".remove" field which in turn would cause me to add the
".suppress_bind_attrs = true," to the driver struct.  Similarly there is
no change in the initcall ordering either.

So hopefully with that in mind it eases review.

I'm happy to have this go in via the maintainer's tree and reduce the
(large) number of patches I'm carrying locally.
---

Cc: Antoine Tenart <antoine.tenart@free-electrons.com>
Cc: Beniamino Galvani <b.galvani@gmail.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Carlo Caione <carlo@endlessm.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Hongzhou Yang <hongzhou.yang@mediatek.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Thomas Abraham <thomas.ab@samsung.com>
Cc: Tomasz Figa <tomasz.figa@gmail.com>
Cc: Vishnu Patekar <vishnupatekar0510@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-gpio@vger.kernel.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org


Paul Gortmaker (8):
  drivers/pinctrl: sunxi/pinctrl-sunxi.c does not need module.h
  drivers/pinctrl: make mediatek/pinctrl-mt6397 driver explicitly non-modular
  drivers/pinctrl: make meson/pinctrl-meson.c explicitly non-modular
  drivers/pinctrl: make sh-pfc/core.c explicitly non-modular
  drivers/pinctrl: make stm32/pinctrl-stm32f429.c explicitly non-modular
  drivers/pinctrl: make sunxi/pinctrl-sun[4-9]* explicitly non-modular
  drivers/pinctrl: make sunxi/pinctrl-sun9i-a80-r.c explicitly non-modular
  drivers/pinctrl: clean up samsung modular vs. non-modular distinctions

 drivers/pinctrl/mediatek/pinctrl-mt6397.c    | 10 ++--------
 drivers/pinctrl/meson/pinctrl-meson.c        |  8 +-------
 drivers/pinctrl/samsung/pinctrl-exynos.c     |  1 -
 drivers/pinctrl/samsung/pinctrl-exynos5440.c | 15 +++------------
 drivers/pinctrl/samsung/pinctrl-s3c24xx.c    |  2 +-
 drivers/pinctrl/samsung/pinctrl-s3c64xx.c    |  2 +-
 drivers/pinctrl/samsung/pinctrl-samsung.c    | 12 +-----------
 drivers/pinctrl/sh-pfc/core.c                | 18 ++++--------------
 drivers/pinctrl/stm32/pinctrl-stm32f429.c    |  9 +--------
 drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c    |  9 ++-------
 drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c   |  9 ++-------
 drivers/pinctrl/sunxi/pinctrl-sun5i-a13.c    |  9 ++-------
 drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c  | 10 ++--------
 drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c    |  9 ++-------
 drivers/pinctrl/sunxi/pinctrl-sun6i-a31s.c   |  9 ++-------
 drivers/pinctrl/sunxi/pinctrl-sun7i-a20.c    |  9 ++-------
 drivers/pinctrl/sunxi/pinctrl-sun8i-a23-r.c  | 11 ++---------
 drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c    | 10 ++--------
 drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c    |  9 ++-------
 drivers/pinctrl/sunxi/pinctrl-sun9i-a80-r.c  |  9 ++-------
 drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c    |  9 ++-------
 drivers/pinctrl/sunxi/pinctrl-sunxi.c        |  2 +-
 22 files changed, 39 insertions(+), 152 deletions(-)

-- 
2.6.1

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

* [PATCH 2/8] drivers/pinctrl: make mediatek/pinctrl-mt6397 driver explicitly non-modular
       [not found] ` <1456778924-20730-1-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
@ 2016-02-29 20:48   ` Paul Gortmaker
       [not found]     ` <1456778924-20730-3-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
  2016-03-09  3:01     ` Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Gortmaker @ 2016-02-29 20:48 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA, Hongzhou Yang, Linus Walleij,
	Paul Gortmaker, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Matthias Brugger

The Kconfig for this driver is currently:

config PINCTRL_MT6397
        bool "Mediatek MT6397 pin control" if COMPILE_TEST && !MFD_MT6397

...meaning that it is currently 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 translates to device_initcall in the non-modular
case, 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.

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

Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Hongzhou Yang <hongzhou.yang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Signed-off-by: Paul Gortmaker <paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
---
 drivers/pinctrl/mediatek/pinctrl-mt6397.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6397.c b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
index f9751ae28e32..6eccb85c02cd 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt6397.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
@@ -12,7 +12,7 @@
  * GNU General Public License for more details.
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
@@ -55,7 +55,6 @@ static const struct of_device_id mt6397_pctrl_match[] = {
 	{ .compatible = "mediatek,mt6397-pinctrl", },
 	{ }
 };
-MODULE_DEVICE_TABLE(of, mt6397_pctrl_match);
 
 static struct platform_driver mtk_pinctrl_driver = {
 	.probe = mt6397_pinctrl_probe,
@@ -69,9 +68,4 @@ static int __init mtk_pinctrl_init(void)
 {
 	return platform_driver_register(&mtk_pinctrl_driver);
 }
-
-module_init(mtk_pinctrl_init);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("MediaTek MT6397 Pinctrl Driver");
-MODULE_AUTHOR("Hongzhou Yang <hongzhou.yang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>");
+device_initcall(mtk_pinctrl_init);
-- 
2.6.1

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

* Re: [PATCH 2/8] drivers/pinctrl: make mediatek/pinctrl-mt6397 driver explicitly non-modular
       [not found]     ` <1456778924-20730-3-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
@ 2016-03-01 20:02       ` Hongzhou Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Hongzhou Yang @ 2016-03-01 20:02 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: biao.huang-NuS5LvNUpcJWk0Htik3J/w, Linus Walleij,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Matthias Brugger,
	yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w,
	eddie.huang-NuS5LvNUpcJWk0Htik3J/w

On Mon, 2016-02-29 at 15:48 -0500, Paul Gortmaker wrote:
> The Kconfig for this driver is currently:
> 
> config PINCTRL_MT6397
>         bool "Mediatek MT6397 pin control" if COMPILE_TEST && !MFD_MT6397
> 
> ...meaning that it is currently 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 translates to device_initcall in the non-modular
> case, 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.
> 
> Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
> 
> Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Hongzhou Yang <hongzhou.yang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> Cc: linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
> ---
>  drivers/pinctrl/mediatek/pinctrl-mt6397.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6397.c b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> index f9751ae28e32..6eccb85c02cd 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> @@ -12,7 +12,7 @@
>   * GNU General Public License for more details.
>   */
>  
> -#include <linux/module.h>
> +#include <linux/init.h>
>  #include <linux/platform_device.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
> @@ -55,7 +55,6 @@ static const struct of_device_id mt6397_pctrl_match[] = {
>  	{ .compatible = "mediatek,mt6397-pinctrl", },
>  	{ }
>  };
> -MODULE_DEVICE_TABLE(of, mt6397_pctrl_match);
>  
>  static struct platform_driver mtk_pinctrl_driver = {
>  	.probe = mt6397_pinctrl_probe,
> @@ -69,9 +68,4 @@ static int __init mtk_pinctrl_init(void)
>  {
>  	return platform_driver_register(&mtk_pinctrl_driver);
>  }
> -
> -module_init(mtk_pinctrl_init);
> -
> -MODULE_LICENSE("GPL v2");
> -MODULE_DESCRIPTION("MediaTek MT6397 Pinctrl Driver");
> -MODULE_AUTHOR("Hongzhou Yang <hongzhou.yang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>");
> +device_initcall(mtk_pinctrl_init);


Acked-by: Hongzhou Yang <hongzhou.yang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>

Thanks,
Hongzhou

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

* Re: [PATCH 2/8] drivers/pinctrl: make mediatek/pinctrl-mt6397 driver explicitly non-modular
  2016-02-29 20:48   ` [PATCH 2/8] drivers/pinctrl: make mediatek/pinctrl-mt6397 driver explicitly non-modular Paul Gortmaker
       [not found]     ` <1456778924-20730-3-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
@ 2016-03-09  3:01     ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2016-03-09  3:01 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel@vger.kernel.org, Matthias Brugger, Hongzhou Yang,
	linux-gpio@vger.kernel.org,
	moderated list:ARM/Mediatek SoC support

On Tue, Mar 1, 2016 at 3:48 AM, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:

> The Kconfig for this driver is currently:
>
> config PINCTRL_MT6397
>         bool "Mediatek MT6397 pin control" if COMPILE_TEST && !MFD_MT6397
>
> ...meaning that it is currently 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 translates to device_initcall in the non-modular
> case, 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.
>
> Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: Hongzhou Yang <hongzhou.yang@mediatek.com>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-mediatek@lists.infradead.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Patch applied with Honzhou's ACK.

Yours,
Linus Walleij

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

end of thread, other threads:[~2016-03-09  3:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-29 20:48 [PATCH 0/8] drivers/pinctrl: remove truly orphaned module code Paul Gortmaker
     [not found] ` <1456778924-20730-1-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2016-02-29 20:48   ` [PATCH 2/8] drivers/pinctrl: make mediatek/pinctrl-mt6397 driver explicitly non-modular Paul Gortmaker
     [not found]     ` <1456778924-20730-3-git-send-email-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2016-03-01 20:02       ` Hongzhou Yang
2016-03-09  3:01     ` Linus Walleij

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