pinctrl: bcm/samsung/tegra: make bool code non-modular
Subsystems (8)
cover pinctrl: bcm/samsung/tegra: make bool code non-modular
This is the last of the pinctrl cleanups I have in my queue. So hopefully once these are in and any current but out-of-tree drivers are submitted, there won't be any more examples of non-modular code using modular infrastructure for people to inadvertently copy off of.
Nothing really new here -- if the Kconfig and/or the Makefile does not allow building the code as modular, then we don't need to be using module_xyz() functions and/or MODULE_XYZ macros.
Here we audit and remove such instances in three subdirectories of the pinctrl subsystem: bcm, samsung, and tegra, which allows us to have a positive net removal of unused code as per the diffstat.
Rather than do one commit per driver, we take advantage of the fact that the drivers are grouped already and bundle the changes per family, since the changes are not really deeply technical.
Build tested for allmodconfig on linux-next for arm, arm64; also explicitly compiled each file for both arch to ensure nobody got missed on the allmodconfig. (there are missing renesas_sdhi syms in today's linux-next arm but that is not caused by these changes.)
Linus - thanks for your patience in merging all these to date.
Paul.
---
Paul Gortmaker (3):
pinctrl: samsung: clean up modular vs. non-modular distinctions
pinctrl: tegra: clean up modular vs. non-modular distinctions
pinctrl: bcm: clean up modular vs. non-modular distinctions
drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 16 ++++++++-------- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 20 +++----------------- drivers/pinctrl/bcm/pinctrl-cygnus-mux.c | 11 +++++------ 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 | 13 +------------ drivers/pinctrl/tegra/pinctrl-tegra.c | 1 - drivers/pinctrl/tegra/pinctrl-tegra114.c | 11 ++++------- drivers/pinctrl/tegra/pinctrl-tegra124.c | 11 ++++------- drivers/pinctrl/tegra/pinctrl-tegra20.c | 11 ++++------- drivers/pinctrl/tegra/pinctrl-tegra210.c | 9 ++------- drivers/pinctrl/tegra/pinctrl-tegra30.c | 11 ++++------- 14 files changed, 40 insertions(+), 94 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/3 pinctrl: samsung: clean up modular vs. non-modular distinctions
Fixups here tend to be more all over the map vs. some of the other repeated/systematic ones we've seen elsewhere.
We remove module.h from code that isn't doing anything modular at all; if they have __init sections, then replace it with init.h
A couple drivers have module_exit() code that is essentially orphaned, and so we remove that.
There are no module_init replacements, so we have no concerns wrt. initcall ordering changes as per some of the other cleanups.
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.
--- 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 | 13 +------------ 5 files changed, 6 insertions(+), 27 deletions(-)
drivers/pinctrl/samsung/pinctrl-exynos.c +0 -1
@@ -18,7 +18,6 @@* external gpio and wakeup interrupt support. */ -#include <linux/module.h> #include <linux/device.h> #include <linux/interrupt.h> #include <linux/irqdomain.h>
drivers/pinctrl/samsung/pinctrl-exynos5440.c +3 -12
@@ -1,6 +1,8 @@/* * pin-controller/pin-mux/pin-config/gpio-driver for Samsung's EXYNOS5440 SoC. * +* Author: Thomas Abraham <[email protected]> +* * Copyright (c) 2012 Samsung Electronics Co., Ltd. * http://www.samsung.com *
@@ -10,7 +12,7 @@* (at your option) any later version. */ -#include <linux/module.h> +#include <linux/init.h> #include <linux/platform_device.h> #include <linux/io.h> #include <linux/slab.h>
@@ -991,7 +993,6 @@ static const struct of_device_id exynos5440_pinctrl_dt_match[] = { { .compatible = "samsung,exynos5440-pinctrl" }, {}, }; -MODULE_DEVICE_TABLE (of, exynos5440_pinctrl_dt_match);static struct platform_driver exynos5440_pinctrl_driver = { .probe = exynos5440_pinctrl_probe,
@@ -1007,13 +1008,3 @@ static int __init exynos5440_pinctrl_drv_register(void)return platform_driver_register (&exynos5440_pinctrl_driver); }postcore_initcall (exynos5440_pinctrl_drv_register); - -static void __exit exynos5440_pinctrl_drv_unregister(void) -{ -platform_driver_unregister (&exynos5440_pinctrl_driver); -} -module_exit (exynos5440_pinctrl_drv_unregister); - -MODULE_AUTHOR ("Thomas Abraham <[email protected]>" ); -MODULE_DESCRIPTION ("Samsung EXYNOS5440 SoC pinctrl driver" ); -MODULE_LICENSE ("GPL v2" );
drivers/pinctrl/samsung/pinctrl-s3c24xx.c +1 -1
@@ -13,7 +13,7 @@* external gpio and wakeup interrupt support. */ -#include <linux/module.h> +#include <linux/init.h> #include <linux/device.h> #include <linux/interrupt.h> #include <linux/irqdomain.h>
drivers/pinctrl/samsung/pinctrl-s3c64xx.c +1 -1
@@ -15,7 +15,7 @@* external gpio and wakeup interrupt support. */ -#include <linux/module.h> +#include <linux/init.h> #include <linux/device.h> #include <linux/interrupt.h> #include <linux/irqdomain.h>
drivers/pinctrl/samsung/pinctrl-samsung.c +1 -12
@@ -20,7 +20,7 @@* and wakeup interrupts can be hooked to. */ -#include <linux/module.h> +#include <linux/init.h> #include <linux/platform_device.h> #include <linux/io.h> #include <linux/slab.h>
@@ -1221,7 +1221,6 @@ static const struct of_device_id samsung_pinctrl_dt_match[] = {#endif {}, }; -MODULE_DEVICE_TABLE (of, samsung_pinctrl_dt_match);static const struct dev_pm_ops samsung_pinctrl_pm_ops = { SET_LATE_SYSTEM_SLEEP_PM_OPS(samsung_pinctrl_suspend,
@@ -1243,13 +1242,3 @@ static int __init samsung_pinctrl_drv_register(void)return platform_driver_register (&samsung_pinctrl_driver); }postcore_initcall (samsung_pinctrl_drv_register); - -static void __exit samsung_pinctrl_drv_unregister(void) -{ -platform_driver_unregister (&samsung_pinctrl_driver); -} -module_exit (samsung_pinctrl_drv_unregister); - -MODULE_AUTHOR ("Thomas Abraham <[email protected]>" ); -MODULE_DESCRIPTION ("Samsung pinctrl driver" ); -MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.11.0
Re: [PATCH 1/3] pinctrl: samsung: clean up modular vs. non-modular distinctions
Quoted 17 lines · Paul Gortmaker
Fixups here tend to be more all over the map vs. some of the other repeated/systematic ones we've seen elsewhere.
We remove
module.hfrom code that isn't doing anything modular at all; if they have__initsections, then replace it withinit.hA couple drivers have
module_exit()code that is essentially orphaned, and so we remove that.There are no
module_initreplacements, so we have no concerns wrt. initcall ordering changes as per some of the other cleanups.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.We also delete the
MODULE_LICENSEtag etc. since all that information was (or is now) contained at the top of the file in the comments.
Quoted 7 lines
Cc Tomasz Figa <[email protected]>Cc Thomas Abraham <[email protected]>Cc Linus Walleij <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
These are quite old entries of maintainers. I guess you add Cc-entries once per git commit but no problem - I have it from the lists.
Thanks, applied.
Best regards,
Krzysztof
Re: [PATCH 1/3] pinctrl: samsung: clean up modular vs. non-modular distinctions
Quoted 27 lines · [Re: [PATCH 1/3] pinctrl: samsung: clean up modular vs. non-modular…
Quoted 17 lines · Paul Gortmaker
Fixups here tend to be more all over the map vs. some of the other repeated/systematic ones we've seen elsewhere.
We remove
module.hfrom code that isn't doing anything modular at all; if they have__initsections, then replace it withinit.hA couple drivers have
module_exit()code that is essentially orphaned, and so we remove that.There are no
module_initreplacements, so we have no concerns wrt. initcall ordering changes as per some of the other cleanups.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.We also delete the
MODULE_LICENSEtag etc. since all that information was (or is now) contained at the top of the file in the comments.Quoted 7 lines
Cc Tomasz Figa <[email protected]>Cc Thomas Abraham <[email protected]>Cc Linus Walleij <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Quoted 2 lines
These are quite old entries of maintainers. I guess you add Cc-entries once per git commit but no problem - I have it from the lists.
Actually what happend is it got sent quite some time ago, but Linus didn't merge it because he wanted some Acks[1] and a resend. Shortly after Sylwester provided an ack.
So with that in mind, I decided to restart with the most simple pinctrl patches 1st, and hence it took a while to finally get back to this one in the final series. But I didn't want to change an ack'd patch.
Not that it matters, but just in case you were curious.
Thanks,
Paul.
[1] https://marc.info/?l=linux-kernel&m=145803185919692&w=2
Quoted 4 lines
Thanks, applied.
Best regards, Krzysztof
Re: [PATCH 1/3] pinctrl: samsung: clean up modular vs. non-modular distinctions
In reply to Paul GortmakerQuoted 17 lines · Paul Gortmaker
Fixups here tend to be more all over the map vs. some of the other repeated/systematic ones we've seen elsewhere.
We remove
module.hfrom code that isn't doing anything modular at all; if they have__initsections, then replace it withinit.hA couple drivers have
module_exit()code that is essentially orphaned, and so we remove that.There are no
module_initreplacements, so we have no concerns wrt. initcall ordering changes as per some of the other cleanups.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.We also delete the
MODULE_LICENSEtag etc. since all that information was (or is now) contained at the top of the file in the comments.
Quoted 7 lines
Cc Tomasz Figa <[email protected]>Cc Thomas Abraham <[email protected]>Cc Linus Walleij <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Krzysztof is sub-submainter for the Samsung stuff in pinctrl so I leave it to him to figure out how to bend, twist and merge this, then I will get the result back from him with a pull request.
It looks good to me though.
Yours,
Linus Walleij
PATCH 2/3 pinctrl: tegra: clean up modular vs. non-modular distinctions
In reply to Paul GortmakerNone of the Kconfigs for any of these drivers are tristate, meaning that they currently are not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that when reading the drivers there is no doubt they are builtin-only. All drivers get similar changes, so they are handled in batch.
We remove module.h from code that isn't doing anything modular at all; if they have __init sections, then replace it with init.h.
A couple drivers have module_exit() code that is essentially orphaned, and so we remove that.
Quite a few bool drivers (hence non-modular) are converted over to to builtin_platform_driver().
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.
--- drivers/pinctrl/tegra/pinctrl-tegra.c | 1 - drivers/pinctrl/tegra/pinctrl-tegra114.c | 11 ++++------- drivers/pinctrl/tegra/pinctrl-tegra124.c | 11 ++++------- drivers/pinctrl/tegra/pinctrl-tegra20.c | 11 ++++------- drivers/pinctrl/tegra/pinctrl-tegra210.c | 9 ++------- drivers/pinctrl/tegra/pinctrl-tegra30.c | 11 ++++------- 6 files changed, 18 insertions(+), 36 deletions(-)
drivers/pinctrl/tegra/pinctrl-tegra.c +0 -1
@@ -21,7 +21,6 @@#include <linux/err.h> #include <linux/init.h> #include <linux/io.h> -#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/machine.h>
drivers/pinctrl/tegra/pinctrl-tegra114.c +4 -7
@@ -1,6 +1,8 @@/* * Pinctrl data for the NVIDIA Tegra114 pinmux * +* Author: Pritesh Raithatha <[email protected]> +* * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it
@@ -13,7 +15,7 @@* more details. */ -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/pinctrl.h>
@@ -1857,7 +1859,6 @@ static const struct of_device_id tegra114_pinctrl_of_match[] = { { .compatible = "nvidia,tegra114-pinmux", }, { }, }; -MODULE_DEVICE_TABLE (of, tegra114_pinctrl_of_match);static struct platform_driver tegra114_pinctrl_driver = { .driver = {
@@ -1866,8 +1867,4 @@ static struct platform_driver tegra114_pinctrl_driver = { }, .probe = tegra114_pinctrl_probe, }; -module_platform_driver (tegra114_pinctrl_driver); - -MODULE_AUTHOR ("Pritesh Raithatha <[email protected]>" ); -MODULE_DESCRIPTION ("NVIDIA Tegra114 pinctrl driver" ); -MODULE_LICENSE ("GPL v2" ); +builtin_platform_driver (tegra114_pinctrl_driver);
drivers/pinctrl/tegra/pinctrl-tegra124.c +4 -7
@@ -1,6 +1,8 @@/* * Pinctrl data for the NVIDIA Tegra124 pinmux * +* Author: Ashwini Ghuge <[email protected]> +* * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it
@@ -13,7 +15,7 @@* more details. */ -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/pinctrl.h>
@@ -2069,7 +2071,6 @@ static const struct of_device_id tegra124_pinctrl_of_match[] = { { .compatible = "nvidia,tegra124-pinmux", }, { }, }; -MODULE_DEVICE_TABLE (of, tegra124_pinctrl_of_match);static struct platform_driver tegra124_pinctrl_driver = { .driver = {
@@ -2078,8 +2079,4 @@ static struct platform_driver tegra124_pinctrl_driver = { }, .probe = tegra124_pinctrl_probe, }; -module_platform_driver (tegra124_pinctrl_driver); - -MODULE_AUTHOR ("Ashwini Ghuge <[email protected]>" ); -MODULE_DESCRIPTION ("NVIDIA Tegra124 pinctrl driver" ); -MODULE_LICENSE ("GPL v2" ); +builtin_platform_driver (tegra124_pinctrl_driver);
drivers/pinctrl/tegra/pinctrl-tegra20.c +4 -7
@@ -1,6 +1,8 @@/* * Pinctrl data for the NVIDIA Tegra20 pinmux * +* Author: Stephen Warren <[email protected]> +* * Copyright (c) 2011-2012, NVIDIA CORPORATION. All rights reserved. * * Derived from code:
@@ -17,7 +19,7 @@* more details. */ -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/pinctrl.h>
@@ -2246,9 +2248,4 @@ static struct platform_driver tegra20_pinctrl_driver = { }, .probe = tegra20_pinctrl_probe, }; -module_platform_driver (tegra20_pinctrl_driver); - -MODULE_AUTHOR ("Stephen Warren <[email protected]>" ); -MODULE_DESCRIPTION ("NVIDIA Tegra20 pinctrl driver" ); -MODULE_LICENSE ("GPL v2" ); -MODULE_DEVICE_TABLE (of, tegra20_pinctrl_of_match); +builtin_platform_driver (tegra20_pinctrl_driver);
drivers/pinctrl/tegra/pinctrl-tegra210.c +2 -7
@@ -13,7 +13,7 @@* more details. */ -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/pinctrl.h>
@@ -1573,7 +1573,6 @@ static const struct of_device_id tegra210_pinctrl_of_match[] = { { .compatible = "nvidia,tegra210-pinmux", }, { }, }; -MODULE_DEVICE_TABLE (of, tegra210_pinctrl_of_match);static struct platform_driver tegra210_pinctrl_driver = { .driver = {
@@ -1582,8 +1581,4 @@ static struct platform_driver tegra210_pinctrl_driver = { }, .probe = tegra210_pinctrl_probe, }; -module_platform_driver (tegra210_pinctrl_driver); - -MODULE_AUTHOR ("NVIDIA" ); -MODULE_DESCRIPTION ("NVIDIA Tegra210 pinctrl driver" ); -MODULE_LICENSE ("GPL v2" ); +builtin_platform_driver (tegra210_pinctrl_driver);
drivers/pinctrl/tegra/pinctrl-tegra30.c +4 -7
@@ -1,6 +1,8 @@/* * Pinctrl data for the NVIDIA Tegra30 pinmux * +* Author: Stephen Warren <[email protected]> +* * Copyright (c) 2011-2012, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it
@@ -13,7 +15,7 @@* more details. */ -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/pinctrl.h>
@@ -2492,7 +2494,6 @@ static const struct of_device_id tegra30_pinctrl_of_match[] = { { .compatible = "nvidia,tegra30-pinmux", }, { }, }; -MODULE_DEVICE_TABLE (of, tegra30_pinctrl_of_match);static struct platform_driver tegra30_pinctrl_driver = { .driver = {
@@ -2501,8 +2502,4 @@ static struct platform_driver tegra30_pinctrl_driver = { }, .probe = tegra30_pinctrl_probe, }; -module_platform_driver (tegra30_pinctrl_driver); - -MODULE_AUTHOR ("Stephen Warren <[email protected]>" ); -MODULE_DESCRIPTION ("NVIDIA Tegra30 pinctrl driver" ); -MODULE_LICENSE ("GPL v2" ); +builtin_platform_driver (tegra30_pinctrl_driver);
Signature · 1 line
2.11.0
Re: [PATCH 2/3] pinctrl: tegra: clean up modular vs. non-modular distinctions
Quoted 25 lines · Paul Gortmaker
None of the Kconfigs for any of these drivers are tristate, meaning that they currently are not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that when reading the drivers there is no doubt they are builtin-only. All drivers get similar changes, so they are handled in batch.
We remove
module.hfrom code that isn't doing anything modular at all; if they have__initsections, then replace it withinit.h.A couple drivers have
module_exit()code that is essentially orphaned, and so we remove that.Quite a few bool drivers (hence non-modular) are converted over to to
builtin_platform_driver().Since
module_platform_driver()uses the same init level priority asbuiltin_platform_driver()the init ordering remains unchanged with this commit.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.We also delete the
MODULE_LICENSEtag etc. since all that information was (or is now) contained at the top of the file in the comments.
Quoted 9 lines
Cc Linus Walleij <[email protected]>Cc Stephen Warren <[email protected]>Cc Thierry Reding <[email protected]>Cc Alexandre Courbot <[email protected]>Cc Pritesh Raithatha <[email protected]>Cc Ashwini Ghuge <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 3/3 pinctrl: bcm: clean up modular vs. non-modular distinctions
In reply to Paul GortmakerFixups here tend to be more of a conglomerate of some of the other repeated/systematic ones we've seen in the earlier pinctrl cleanups.
We remove module.h from code that isn't doing anything modular at all; if they have __init sections, then replace it with init.h
One driver has a .remove that would be dispatched on module_exit, and as that code is essentially orphaned, so we remove it. In case anyone was previously doing the (pointless) unbind to get to that function, we disable unbind for this one driver as well.
A couple bool drivers (hence non-modular) are converted over to to builtin_platform_driver().
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.
--- drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 16 ++++++++-------- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 20 +++----------------- drivers/pinctrl/bcm/pinctrl-cygnus-mux.c | 11 +++++------ 3 files changed, 16 insertions(+), 31 deletions(-)
drivers/pinctrl/bcm/pinctrl-bcm281xx.c +8 -8
@@ -1,4 +1,10 @@/* +* Broadcom BCM281xx pinctrl driver +* +* Author(s): +* Sherman Yin <[email protected]> +* Broadcom Corporation <[email protected]> +* * Copyright (C) 2013 Broadcom Corporation * * This program is free software; you can redistribute it and/or
@@ -12,7 +18,7 @@*/ #include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/pinctrl.h>
@@ -1444,10 +1450,4 @@ static struct platform_driver bcm281xx_pinctrl_driver = { .of_match_table = bcm281xx_pinctrl_of_match, }, }; - -module_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe); - -MODULE_AUTHOR ("Broadcom Corporation <[email protected]>" ); -MODULE_AUTHOR ("Sherman Yin <[email protected]>" ); -MODULE_DESCRIPTION ("Broadcom BCM281xx pinctrl driver" ); -MODULE_LICENSE ("GPL v2" ); +builtin_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe);
drivers/pinctrl/bcm/pinctrl-bcm2835.c +3 -17
@@ -27,7 +27,7 @@#include <linux/io.h> #include <linux/irq.h> #include <linux/irqdesc.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of_address.h> #include <linux/of.h> #include <linux/of_irq.h>
@@ -1075,31 +1075,17 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)return 0 ; } -static int bcm2835_pinctrl_remove (struct platform_device *pdev) -{ -struct bcm2835_pinctrl *pc =platform_get_drvdata (pdev); - -gpiochip_remove (&pc->gpio_chip); - -return 0 ; -} -static const struct of_device_id bcm2835_pinctrl_match[] = { { .compatible ="brcm,bcm2835-gpio" }, {} }; -MODULE_DEVICE_TABLE (of, bcm2835_pinctrl_match);static struct platform_driver bcm2835_pinctrl_driver = { .probe = bcm2835_pinctrl_probe, - .remove = bcm2835_pinctrl_remove, .driver = { .name =MODULE_NAME , .of_match_table = bcm2835_pinctrl_match, + .suppress_bind_attrs = true, }, }; -module_platform_driver (bcm2835_pinctrl_driver); - -MODULE_AUTHOR ("Chris Boot, Simon Arlott, Stephen Warren" ); -MODULE_DESCRIPTION ("BCM2835 Pin control driver" ); -MODULE_LICENSE ("GPL" ); +builtin_platform_driver (bcm2835_pinctrl_driver);
drivers/pinctrl/bcm/pinctrl-cygnus-mux.c +5 -6
@@ -1,4 +1,8 @@ -/* Copyright (C) 2014-2015 Broadcom Corporation +/* +* Broadcom Cygnus IOMUX driver +* +* Author: Ray Jui <[email protected]> +* Copyright (C) 2014-2015 Broadcom Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as
@@ -17,7 +21,6 @@#include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> #include <linux/of.h> #include <linux/slab.h> #include <linux/platform_device.h>
@@ -1016,7 +1019,3 @@ static int __init cygnus_pinmux_init(void)return platform_driver_register (&cygnus_pinmux_driver); }arch_initcall (cygnus_pinmux_init); - -MODULE_AUTHOR ("Ray Jui <[email protected]>" ); -MODULE_DESCRIPTION ("Broadcom Cygnus IOMUX driver" ); -MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.11.0
Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions
Quoted 39 lines
Paul Gortmaker <[email protected]> hat am 22. Mai 2017 um 22:56 geschrieben:
Fixups here tend to be more of a conglomerate of some of the other repeated/systematic ones we've seen in the earlier pinctrl cleanups.
We remove
module.hfrom code that isn't doing anything modular at all; if they have__initsections, then replace it withinit.hOne driver has a .remove that would be dispatched on
module_exit, and as that code is essentially orphaned, so we remove it. In case anyone was previously doing the (pointless) unbind to get to that function, we disable unbind for this one driver as well.A couple bool drivers (hence non-modular) are converted over to to
builtin_platform_driver().Since
module_platform_driver()uses the same init level priority asbuiltin_platform_driver()the init ordering remains unchanged with this commit.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.We also delete the
MODULE_LICENSEtag etc. since all that information was (or is now) contained at the top of the file in the comments.Cc Eric Anholt <[email protected]>Cc Florian Fainelli <[email protected]>Cc Jon Mason <[email protected]>Cc Linus Walleij <[email protected]>Cc Ray Jui <[email protected]>Cc Scott Branden <[email protected]>Cc Stefan Wahren <[email protected]>Cc Sherman Yin <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Quoted 3 lines
--- drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 16 ++++++++-------- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 20 +++-----------------
for pinctrl-bcm2835
Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions
In reply to Paul GortmakerHi Paul,
Some comments - leave our file headers intact. If you want to add a new comment do so after the existing file header in another comment. But, I don't think any of that information is needed by us.
Quoted 46 lines · Paul Gortmaker
Fixups here tend to be more of a conglomerate of some of the other repeated/systematic ones we've seen in the earlier pinctrl cleanups.
We remove
module.hfrom code that isn't doing anything modular at all; if they have__initsections, then replace it withinit.hOne driver has a .remove that would be dispatched on
module_exit, and as that code is essentially orphaned, so we remove it. In case anyone was previously doing the (pointless) unbind to get to that function, we disable unbind for this one driver as well.A couple bool drivers (hence non-modular) are converted over to to
builtin_platform_driver().Since
module_platform_driver()uses the same init level priority asbuiltin_platform_driver()the init ordering remains unchanged with this commit.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.We also delete the
MODULE_LICENSEtag etc. since all that information was (or is now) contained at the top of the file in the comments.Cc Eric Anholt <[email protected]>Cc Florian Fainelli <[email protected]>Cc Jon Mason <[email protected]>Cc Linus Walleij <[email protected]>Cc Ray Jui <[email protected]>Cc Scott Branden <[email protected]>Cc Stefan Wahren <[email protected]>Cc Sherman Yin <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>--- drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 16 ++++++++-------- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 20 +++----------------- drivers/pinctrl/bcm/pinctrl-cygnus-mux.c | 11 +++++------ 3 files changed, 16 insertions(+), 31 deletions(-)drivers/pinctrl/bcm/pinctrl-bcm281xx.c +0
-0
drivers/pinctrl/bcm/pinctrl-bcm281xx.c line 7
Quoted 7 lines
drivers/pinctrl/bcm/pinctrl-bcm281xx.c +6
-0@@ -1,4 +1,10 @@/* +* Broadcom BCM281xx pinctrl driver +* +* Author(s): +* Sherman Yin <[email protected]> +* Broadcom Corporation <[email protected]> +*
Please do not add anything to the header above - leave it as is.
Quoted 13 lines
drivers/pinctrl/bcm/pinctrl-bcm281xx.c +1
-1* Copyright (C) 2013 Broadcom Corporation * * This program is free software; you can redistribute it and/or @@ -12,7 +18,7 @@*/ #include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/pinctrl.h>
drivers/pinctrl/bcm/pinctrl-bcm281xx.c static struct platform_driver bcm281xx_pinctrl_driver = { · line 1453
Quoted 10 lines
drivers/pinctrl/bcm/pinctrl-bcm281xx.c +0
-7@@ -1444,10 +1450,4 @@ static struct platform_driver bcm281xx_pinctrl_driver = { .of_match_table = bcm281xx_pinctrl_of_match, }, }; - -module_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe); - -MODULE_AUTHOR ("Broadcom Corporation <[email protected]>" ); -MODULE_AUTHOR ("Sherman Yin <[email protected]>" ); -MODULE_DESCRIPTION ("Broadcom BCM281xx pinctrl driver" ); -MODULE_LICENSE ("GPL v2" );
Fine to remove this if it's not need any more.
Quoted 53 lines
drivers/pinctrl/bcm/pinctrl-bcm281xx.c +1
-0+builtin_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe);drivers/pinctrl/bcm/pinctrl-bcm2835.c +3
-17@@ -27,7 +27,7 @@#include <linux/io.h> #include <linux/irq.h> #include <linux/irqdesc.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of_address.h> #include <linux/of.h> #include <linux/of_irq.h> @@ -1075,31 +1075,17 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)return 0 ; } -static int bcm2835_pinctrl_remove (struct platform_device *pdev) -{ -struct bcm2835_pinctrl *pc =platform_get_drvdata (pdev); - -gpiochip_remove (&pc->gpio_chip); - -return 0 ; -} -static const struct of_device_id bcm2835_pinctrl_match[] = { { .compatible ="brcm,bcm2835-gpio" }, {} }; -MODULE_DEVICE_TABLE (of, bcm2835_pinctrl_match);static struct platform_driver bcm2835_pinctrl_driver = { .probe = bcm2835_pinctrl_probe, - .remove = bcm2835_pinctrl_remove, .driver = { .name =MODULE_NAME , .of_match_table = bcm2835_pinctrl_match, + .suppress_bind_attrs = true, }, }; -module_platform_driver (bcm2835_pinctrl_driver); - -MODULE_AUTHOR ("Chris Boot, Simon Arlott, Stephen Warren" ); -MODULE_DESCRIPTION ("BCM2835 Pin control driver" ); -MODULE_LICENSE ("GPL" ); +builtin_platform_driver (bcm2835_pinctrl_driver);drivers/pinctrl/bcm/pinctrl-cygnus-mux.c +0
-0
drivers/pinctrl/bcm/pinctrl-cygnus-mux.c line 5
Quoted 6 lines
drivers/pinctrl/bcm/pinctrl-cygnus-mux.c +5
-1@@ -1,4 +1,8 @@ -/* Copyright (C) 2014-2015 Broadcom Corporation +/* +* Broadcom Cygnus IOMUX driver +* +* Author: Ray Jui <[email protected]> +* Copyright (C) 2014-2015 Broadcom Corporation
Please do not add any of the above to the file header.
Quoted 12 lines
drivers/pinctrl/bcm/pinctrl-cygnus-mux.c +0
-1* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -17,7 +21,6 @@#include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> #include <linux/of.h> #include <linux/slab.h> #include <linux/platform_device.h>
drivers/pinctrl/bcm/pinctrl-cygnus-mux.c static int __init cygnus_pinmux_init(void) · line 1022
Quoted 7 lines
drivers/pinctrl/bcm/pinctrl-cygnus-mux.c +0
-4@@ -1016,7 +1019,3 @@ static int __init cygnus_pinmux_init(void)return platform_driver_register (&cygnus_pinmux_driver); }arch_initcall (cygnus_pinmux_init); - -MODULE_AUTHOR ("Ray Jui <[email protected]>" ); -MODULE_DESCRIPTION ("Broadcom Cygnus IOMUX driver" ); -MODULE_LICENSE ("GPL v2" );
Fine with this modification.
Thanks,
scott
Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions
Quoted 5 lines · [Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions]…
Hi Paul,
Some comments - leave our file headers intact. If you want to add a new comment do so after the existing file header in another comment. But, I don't think any of that information is needed by us.
OK, no problem, if that is what is desired for your driver. I just normally move the author information from the bottom of the file to the top of the file. As a lot of the linux driver work was (is?) done for kudos and not for career, I can't just delete author information. That would not be fair to most of those contributors.
It hasn't been a problem before in all of the other similar commits I've made, but I can imagine a tool that does a check on the comment block on the top of a file and complains if it changes, or similar.
Would you prefer something like this instead? It leaves your header completely untouched, and still gives credit to the original author, and those lines are also untouched.
I've not re-done build coverage on this yet, but let me know if this is what you'd prefer.
Thanks,
Paul
--
From 3f8bf38bcdbf38484182222965aac2748cc1d5cd Mon Sep 17 00:00:00 2001
From: Paul Gortmaker <[email protected]>
Date: Mon, 31 Aug 2015 17:35:47 -0400
Subject: [PATCH] pinctrl: bcm: clean up modular vs. non-modular distinctions
Fixups here tend to be more of a conglomerate of some of the other repeated/systematic ones we've seen in the earlier pinctrl cleanups.
We remove module.h from code that isn't doing anything modular at all; if they have __init sections, then replace it with init.h
One driver has a .remove that would be dispatched on module_exit, and as that code is essentially orphaned, so we remove it. In case anyone was previously doing the (pointless) unbind to get to that function, we disable unbind for this one driver as well.
A couple bool drivers (hence non-modular) are converted over to to builtin_platform_driver().
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 leave the MODULE_AUTHOR and MODULE_LICENSE tag etc. at the bottom of the file since Broadcom would prefer the comment block at the top of the file remain unchanged. We just use CPP to take it out of the picture with an #if 0 / #endif instead.
--- drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 7 ++++--- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 18 +++++------------- drivers/pinctrl/bcm/pinctrl-cygnus-mux.c | 3 ++- 3 files changed, 11 insertions(+), 17 deletions(-)
drivers/pinctrl/bcm/pinctrl-bcm281xx.c +4 -3
@@ -12,7 +12,7 @@*/ #include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/pinctrl.h>
@@ -1444,10 +1444,11 @@ static struct platform_driver bcm281xx_pinctrl_driver = { .of_match_table = bcm281xx_pinctrl_of_match, }, }; +builtin_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe); -module_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe); - +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Broadcom Corporation <[email protected]>" );MODULE_AUTHOR ("Sherman Yin <[email protected]>" );MODULE_DESCRIPTION ("Broadcom BCM281xx pinctrl driver" );MODULE_LICENSE ("GPL v2" ); +#endif
drivers/pinctrl/bcm/pinctrl-bcm2835.c +5 -13
@@ -27,7 +27,7 @@#include <linux/io.h> #include <linux/irq.h> #include <linux/irqdesc.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of_address.h> #include <linux/of.h> #include <linux/of_irq.h>
@@ -1075,31 +1075,23 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)return 0 ; } -static int bcm2835_pinctrl_remove (struct platform_device *pdev) -{ -struct bcm2835_pinctrl *pc =platform_get_drvdata (pdev); - -gpiochip_remove (&pc->gpio_chip); - -return 0 ; -} -static const struct of_device_id bcm2835_pinctrl_match[] = { { .compatible ="brcm,bcm2835-gpio" }, {} }; -MODULE_DEVICE_TABLE (of, bcm2835_pinctrl_match);static struct platform_driver bcm2835_pinctrl_driver = { .probe = bcm2835_pinctrl_probe, - .remove = bcm2835_pinctrl_remove, .driver = { .name =MODULE_NAME , .of_match_table = bcm2835_pinctrl_match, + .suppress_bind_attrs = true, }, }; -module_platform_driver (bcm2835_pinctrl_driver); +builtin_platform_driver (bcm2835_pinctrl_driver); +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Chris Boot, Simon Arlott, Stephen Warren" );MODULE_DESCRIPTION ("BCM2835 Pin control driver" );MODULE_LICENSE ("GPL" ); +#endif
drivers/pinctrl/bcm/pinctrl-cygnus-mux.c +2 -1
@@ -17,7 +17,6 @@#include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> #include <linux/of.h> #include <linux/slab.h> #include <linux/platform_device.h>
@@ -1017,6 +1016,8 @@ static int __init cygnus_pinmux_init(void) }arch_initcall (cygnus_pinmux_init); +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Ray Jui <[email protected]>" );MODULE_DESCRIPTION ("Broadcom Cygnus IOMUX driver" );MODULE_LICENSE ("GPL v2" ); +#endif
Signature · 1 line
2.11.0
Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions
Quoted 14 lines · Paul Gortmaker
Quoted 5 lines · [Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions]…
Hi Paul,
Some comments - leave our file headers intact. If you want to add a new comment do so after the existing file header in another comment. But, I don't think any of that information is needed by us.
OK, no problem, if that is what is desired for your driver. I just normally move the author information from the bottom of the file to the top of the file. As a lot of the linux driver work was (is?) done for kudos and not for career, I can't just delete author information. That would not be fair to most of those contributors.
Quoted 7 lines
It hasn't been a problem before in all of the other similar commits I've made, but I can imagine a tool that does a check on the comment block on the top of a file and complains if it changes, or similar.
Would you prefer something like this instead? It leaves your header completely untouched, and still gives credit to the original author, and those lines are also untouched.
This looks horrible, sorry. Scott, what's the matter with moving the authors listed in MODULE_AUTHOR() into the header?
If it was up to me, I would just remove the MODULE_* parts and if I need to look up the author, git log is my friend.
Quoted 154 lines
I've not re-done build coverage on this yet, but let me know if this is what you'd prefer.
Thanks,
Paul
--From
3f8bf38bcdbf38484182222965aac2748cc1d5cdMon Sep 17 00:00:00 2001
From: Paul Gortmaker <[email protected]>
Date: Mon, 31 Aug 2015 17:35:47 -0400
Subject: [PATCH] pinctrl: bcm: clean up modular vs. non-modular distinctionsFixups here tend to be more of a conglomerate of some of the other repeated/systematic ones we've seen in the earlier pinctrl cleanups.
We remove
module.hfrom code that isn't doing anything modular at all; if they have__initsections, then replace it withinit.hOne driver has a .remove that would be dispatched on
module_exit, and as that code is essentially orphaned, so we remove it. In case anyone was previously doing the (pointless) unbind to get to that function, we disable unbind for this one driver as well.A couple bool drivers (hence non-modular) are converted over to to
builtin_platform_driver().Since
module_platform_driver()uses the same init level priority asbuiltin_platform_driver()the init ordering remains unchanged with this commit.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.We leave the
MODULE_AUTHORandMODULE_LICENSEtag etc. at the bottom of the file since Broadcom would prefer the comment block at the top of the file remain unchanged. We just use CPP to take it out of the picture with an #if 0 / #endif instead.Cc Eric Anholt <[email protected]>Cc Florian Fainelli <[email protected]>Cc Jon Mason <[email protected]>Cc Linus Walleij <[email protected]>Cc Ray Jui <[email protected]>Cc Scott Branden <[email protected]>Cc Stefan Wahren <[email protected]>Cc Sherman Yin <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>--- drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 7 ++++--- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 18 +++++------------- drivers/pinctrl/bcm/pinctrl-cygnus-mux.c | 3 ++- 3 files changed, 11 insertions(+), 17 deletions(-)drivers/pinctrl/bcm/pinctrl-bcm281xx.c +4
-3@@ -12,7 +12,7 @@*/ #include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/pinctrl.h> @@ -1444,10 +1444,11 @@ static struct platform_driver bcm281xx_pinctrl_driver = { .of_match_table = bcm281xx_pinctrl_of_match, }, }; +builtin_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe); -module_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe); - +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Broadcom Corporation <[email protected]>" );MODULE_AUTHOR ("Sherman Yin <[email protected]>" );MODULE_DESCRIPTION ("Broadcom BCM281xx pinctrl driver" );MODULE_LICENSE ("GPL v2" ); +#endif drivers/pinctrl/bcm/pinctrl-bcm2835.c +5
-13@@ -27,7 +27,7 @@#include <linux/io.h> #include <linux/irq.h> #include <linux/irqdesc.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of_address.h> #include <linux/of.h> #include <linux/of_irq.h> @@ -1075,31 +1075,23 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)return 0 ; } -static int bcm2835_pinctrl_remove (struct platform_device *pdev) -{ -struct bcm2835_pinctrl *pc =platform_get_drvdata (pdev); - -gpiochip_remove (&pc->gpio_chip); - -return 0 ; -} -static const struct of_device_id bcm2835_pinctrl_match[] = { { .compatible ="brcm,bcm2835-gpio" }, {} }; -MODULE_DEVICE_TABLE (of, bcm2835_pinctrl_match);static struct platform_driver bcm2835_pinctrl_driver = { .probe = bcm2835_pinctrl_probe, - .remove = bcm2835_pinctrl_remove, .driver = { .name =MODULE_NAME , .of_match_table = bcm2835_pinctrl_match, + .suppress_bind_attrs = true, }, }; -module_platform_driver (bcm2835_pinctrl_driver); +builtin_platform_driver (bcm2835_pinctrl_driver); +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Chris Boot, Simon Arlott, Stephen Warren" );MODULE_DESCRIPTION ("BCM2835 Pin control driver" );MODULE_LICENSE ("GPL" ); +#endif drivers/pinctrl/bcm/pinctrl-cygnus-mux.c +2
-1@@ -17,7 +17,6 @@#include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> #include <linux/of.h> #include <linux/slab.h> #include <linux/platform_device.h> @@ -1017,6 +1016,8 @@ static int __init cygnus_pinmux_init(void) }arch_initcall (cygnus_pinmux_init); +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Ray Jui <[email protected]>" );MODULE_DESCRIPTION ("Broadcom Cygnus IOMUX driver" );MODULE_LICENSE ("GPL v2" ); +#endif
Signature · 1 line
Florian
Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions
Quoted 18 lines · Florian Fainelli
Quoted 17 lines · Paul Gortmaker
Quoted 5 lines · [Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions]…
Hi Paul,
Some comments - leave our file headers intact. If you want to add a new comment do so after the existing file header in another comment. But, I don't think any of that information is needed by us.
OK, no problem, if that is what is desired for your driver. I just normally move the author information from the bottom of the file to the top of the file. As a lot of the linux driver work was (is?) done for kudos and not for career, I can't just delete author information. That would not be fair to most of those contributors.
It hasn't been a problem before in all of the other similar commits I've made, but I can imagine a tool that does a check on the comment block on the top of a file and complains if it changes, or similar.
Quoted 5 lines
Quoted 3 lines
Would you prefer something like this instead? It leaves your header completely untouched, and still gives credit to the original author, and those lines are also untouched.
This looks horrible, sorry. Scott, what's the matter with moving the authors listed in
MODULE_AUTHOR()into the header?
We have tools for scanning headers. Mucking with the headers is not desirable as tools may need to change. Just place additional comments in new comments blocks.
Quoted 158 lines
If it was up to me, I would just remove the MODULE_* parts and if I need to look up the author, git log is my friend.
Quoted 153 lines
I've not re-done build coverage on this yet, but let me know if this is what you'd prefer.
Thanks,
Paul
--From
3f8bf38bcdbf38484182222965aac2748cc1d5cdMon Sep 17 00:00:00 2001
From: Paul Gortmaker <[email protected]>
Date: Mon, 31 Aug 2015 17:35:47 -0400
Subject: [PATCH] pinctrl: bcm: clean up modular vs. non-modular distinctionsFixups here tend to be more of a conglomerate of some of the other repeated/systematic ones we've seen in the earlier pinctrl cleanups.
We remove
module.hfrom code that isn't doing anything modular at all; if they have__initsections, then replace it withinit.hOne driver has a .remove that would be dispatched on
module_exit, and as that code is essentially orphaned, so we remove it. In case anyone was previously doing the (pointless) unbind to get to that function, we disable unbind for this one driver as well.A couple bool drivers (hence non-modular) are converted over to to
builtin_platform_driver().Since
module_platform_driver()uses the same init level priority asbuiltin_platform_driver()the init ordering remains unchanged with this commit.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.We leave the
MODULE_AUTHORandMODULE_LICENSEtag etc. at the bottom of the file since Broadcom would prefer the comment block at the top of the file remain unchanged. We just use CPP to take it out of the picture with an #if 0 / #endif instead.Cc Eric Anholt <[email protected]>Cc Florian Fainelli <[email protected]>Cc Jon Mason <[email protected]>Cc Linus Walleij <[email protected]>Cc Ray Jui <[email protected]>Cc Scott Branden <[email protected]>Cc Stefan Wahren <[email protected]>Cc Sherman Yin <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>--- drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 7 ++++--- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 18 +++++------------- drivers/pinctrl/bcm/pinctrl-cygnus-mux.c | 3 ++- 3 files changed, 11 insertions(+), 17 deletions(-)drivers/pinctrl/bcm/pinctrl-bcm281xx.c +4
-3@@ -12,7 +12,7 @@*/ #include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/pinctrl.h> @@ -1444,10 +1444,11 @@ static struct platform_driver bcm281xx_pinctrl_driver = { .of_match_table = bcm281xx_pinctrl_of_match, }, }; +builtin_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe); -module_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe); - +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Broadcom Corporation <[email protected]>" );MODULE_AUTHOR ("Sherman Yin <[email protected]>" );MODULE_DESCRIPTION ("Broadcom BCM281xx pinctrl driver" );MODULE_LICENSE ("GPL v2" ); +#endif drivers/pinctrl/bcm/pinctrl-bcm2835.c +5
-13@@ -27,7 +27,7 @@#include <linux/io.h> #include <linux/irq.h> #include <linux/irqdesc.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of_address.h> #include <linux/of.h> #include <linux/of_irq.h> @@ -1075,31 +1075,23 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)return 0 ; } -static int bcm2835_pinctrl_remove (struct platform_device *pdev) -{ -struct bcm2835_pinctrl *pc =platform_get_drvdata (pdev); - -gpiochip_remove (&pc->gpio_chip); - -return 0 ; -} -static const struct of_device_id bcm2835_pinctrl_match[] = { { .compatible ="brcm,bcm2835-gpio" }, {} }; -MODULE_DEVICE_TABLE (of, bcm2835_pinctrl_match);static struct platform_driver bcm2835_pinctrl_driver = { .probe = bcm2835_pinctrl_probe, - .remove = bcm2835_pinctrl_remove, .driver = { .name =MODULE_NAME , .of_match_table = bcm2835_pinctrl_match, + .suppress_bind_attrs = true, }, }; -module_platform_driver (bcm2835_pinctrl_driver); +builtin_platform_driver (bcm2835_pinctrl_driver); +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Chris Boot, Simon Arlott, Stephen Warren" );MODULE_DESCRIPTION ("BCM2835 Pin control driver" );MODULE_LICENSE ("GPL" ); +#endif drivers/pinctrl/bcm/pinctrl-cygnus-mux.c +2
-1@@ -17,7 +17,6 @@#include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> #include <linux/of.h> #include <linux/slab.h> #include <linux/platform_device.h> @@ -1017,6 +1016,8 @@ static int __init cygnus_pinmux_init(void) }arch_initcall (cygnus_pinmux_init); +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Ray Jui <[email protected]>" );MODULE_DESCRIPTION ("Broadcom Cygnus IOMUX driver" );MODULE_LICENSE ("GPL v2" ); +#endif
Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions
Quoted 24 lines · Scott Branden
Quoted 21 lines · Florian Fainelli
Quoted 20 lines · Paul Gortmaker
[Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular
Quoted 7 lines · distinctions] On 23/05/2017 (Tue 15:15) Scott Branden wrote:
Hi Paul,
Some comments - leave our file headers intact. If you want to add a new
comment do so after the existing file header in another comment. But, I
don't think any of that information is needed by us.OK, no problem, if that is what is desired for your driver. I just normally move the author information from the bottom of the file to the top of the file. As a lot of the linux driver work was (is?) done for kudos and not for career, I can't just delete author information. That would not be fair to most of those contributors.
It hasn't been a problem before in all of the other similar commits I've made, but I can imagine a tool that does a check on the comment block on the top of a file and complains if it changes, or similar.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Would you prefer something like this instead? It leaves your header completely untouched, and still gives credit to the original author, and those lines are also untouched.
This looks horrible, sorry. Scott, what's the matter with moving the authors listed in
MODULE_AUTHOR()into the header?We have tools for scanning headers. Mucking with the headers is not desirable as tools may need to change. Just place additional comments in new comments blocks.
That's a pretty moot explanation. These tools will have to deal with random changes being done to the kernel as the project keeps seeing more changes.
Plus, you may get Paul to do what you him to do here and not put anything in the header, but there is no guarantee someone else won't be doing it, and even if you are CC'd on the patches, what if you are not, and what if you can't defend this "breaks our tools" position, does not scale to me.
If it's an internal tool, it can certainly be fixed, if it's coming from an external vendor, I'd be seriously concerned if their scanning/logic started to break in 4.13 because Paul's patches got included...
At any rate, I'd just drop the MODULE_AUTHOR() altogether, we can use the SCM to tell us who did what exactly in a much more powerful way (like line by line).
Signature · 1 line
Florian
Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions
In reply to Paul GortmakerHi Paul,
Quoted 13 lines · Paul Gortmaker
Quoted 5 lines · [Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions]…
Hi Paul,
Some comments - leave our file headers intact. If you want to add a new comment do so after the existing file header in another comment. But, I don't think any of that information is needed by us.
OK, no problem, if that is what is desired for your driver. I just normally move the author information from the bottom of the file to the top of the file. As a lot of the linux driver work was (is?) done for kudos and not for career, I can't just delete author information. That would not be fair to most of those contributors.
Quoted 7 lines
It hasn't been a problem before in all of the other similar commits I've made, but I can imagine a tool that does a check on the comment block on the top of a file and complains if it changes, or similar.
Would you prefer something like this instead? It leaves your header completely untouched, and still gives credit to the original author, and those lines are also untouched.
I don't think you should add #if 0 in the code either. Otherwise a search for stale code in #if 0's will have these searches come up.
How about just a regular style comment giving kudos to the author if you so desire. Just move your original comment into a new comment block after the header.
Quoted 153 lines
I've not re-done build coverage on this yet, but let me know if this is what you'd prefer.
Thanks,
Paul
--From
3f8bf38bcdbf38484182222965aac2748cc1d5cdMon Sep 17 00:00:00 2001
From: Paul Gortmaker <[email protected]>
Date: Mon, 31 Aug 2015 17:35:47 -0400
Subject: [PATCH] pinctrl: bcm: clean up modular vs. non-modular distinctionsFixups here tend to be more of a conglomerate of some of the other repeated/systematic ones we've seen in the earlier pinctrl cleanups.
We remove
module.hfrom code that isn't doing anything modular at all; if they have__initsections, then replace it withinit.hOne driver has a .remove that would be dispatched on
module_exit, and as that code is essentially orphaned, so we remove it. In case anyone was previously doing the (pointless) unbind to get to that function, we disable unbind for this one driver as well.A couple bool drivers (hence non-modular) are converted over to to
builtin_platform_driver().Since
module_platform_driver()uses the same init level priority asbuiltin_platform_driver()the init ordering remains unchanged with this commit.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.We leave the
MODULE_AUTHORandMODULE_LICENSEtag etc. at the bottom of the file since Broadcom would prefer the comment block at the top of the file remain unchanged. We just use CPP to take it out of the picture with an #if 0 / #endif instead.Cc Eric Anholt <[email protected]>Cc Florian Fainelli <[email protected]>Cc Jon Mason <[email protected]>Cc Linus Walleij <[email protected]>Cc Ray Jui <[email protected]>Cc Scott Branden <[email protected]>Cc Stefan Wahren <[email protected]>Cc Sherman Yin <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>--- drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 7 ++++--- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 18 +++++------------- drivers/pinctrl/bcm/pinctrl-cygnus-mux.c | 3 ++- 3 files changed, 11 insertions(+), 17 deletions(-)drivers/pinctrl/bcm/pinctrl-bcm281xx.c +4
-3@@ -12,7 +12,7 @@*/ #include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/platform_device.h> #include <linux/pinctrl/pinctrl.h> @@ -1444,10 +1444,11 @@ static struct platform_driver bcm281xx_pinctrl_driver = { .of_match_table = bcm281xx_pinctrl_of_match, }, }; +builtin_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe); -module_platform_driver_probe (bcm281xx_pinctrl_driver, bcm281xx_pinctrl_probe); - +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Broadcom Corporation <[email protected]>" );MODULE_AUTHOR ("Sherman Yin <[email protected]>" );MODULE_DESCRIPTION ("Broadcom BCM281xx pinctrl driver" );MODULE_LICENSE ("GPL v2" ); +#endif drivers/pinctrl/bcm/pinctrl-bcm2835.c +5
-13@@ -27,7 +27,7 @@#include <linux/io.h> #include <linux/irq.h> #include <linux/irqdesc.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of_address.h> #include <linux/of.h> #include <linux/of_irq.h> @@ -1075,31 +1075,23 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)return 0 ; } -static int bcm2835_pinctrl_remove (struct platform_device *pdev) -{ -struct bcm2835_pinctrl *pc =platform_get_drvdata (pdev); - -gpiochip_remove (&pc->gpio_chip); - -return 0 ; -} -static const struct of_device_id bcm2835_pinctrl_match[] = { { .compatible ="brcm,bcm2835-gpio" }, {} }; -MODULE_DEVICE_TABLE (of, bcm2835_pinctrl_match);static struct platform_driver bcm2835_pinctrl_driver = { .probe = bcm2835_pinctrl_probe, - .remove = bcm2835_pinctrl_remove, .driver = { .name =MODULE_NAME , .of_match_table = bcm2835_pinctrl_match, + .suppress_bind_attrs = true, }, }; -module_platform_driver (bcm2835_pinctrl_driver); +builtin_platform_driver (bcm2835_pinctrl_driver); +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Chris Boot, Simon Arlott, Stephen Warren" );MODULE_DESCRIPTION ("BCM2835 Pin control driver" );MODULE_LICENSE ("GPL" ); +#endif drivers/pinctrl/bcm/pinctrl-cygnus-mux.c +2
-1@@ -17,7 +17,6 @@#include <linux/err.h> #include <linux/io.h> -#include <linux/module.h> #include <linux/of.h> #include <linux/slab.h> #include <linux/platform_device.h> @@ -1017,6 +1016,8 @@ static int __init cygnus_pinmux_init(void) }arch_initcall (cygnus_pinmux_init); +#if 0 /* ...def MODULE ; never supported as such; kept for documentation. */ MODULE_AUTHOR ("Ray Jui <[email protected]>" );MODULE_DESCRIPTION ("Broadcom Cygnus IOMUX driver" );MODULE_LICENSE ("GPL v2" ); +#endif
Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions
In reply to Paul GortmakerQuoted 23 lines · Paul Gortmaker
Fixups here tend to be more of a conglomerate of some of the other repeated/systematic ones we've seen in the earlier pinctrl cleanups.
We remove
module.hfrom code that isn't doing anything modular at all; if they have__initsections, then replace it withinit.hOne driver has a .remove that would be dispatched on
module_exit, and as that code is essentially orphaned, so we remove it. In case anyone was previously doing the (pointless) unbind to get to that function, we disable unbind for this one driver as well.A couple bool drivers (hence non-modular) are converted over to to
builtin_platform_driver().Since
module_platform_driver()uses the same init level priority asbuiltin_platform_driver()the init ordering remains unchanged with this commit.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.We also delete the
MODULE_LICENSEtag etc. since all that information was (or is now) contained at the top of the file in the comments.
Quoted 12 lines
Cc Eric Anholt <[email protected]>Cc Florian Fainelli <[email protected]>Cc Jon Mason <[email protected]>Cc Linus Walleij <[email protected]>Cc Ray Jui <[email protected]>Cc Scott Branden <[email protected]>Cc Stefan Wahren <[email protected]>Cc Sherman Yin <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Patch applied with Stefan Wahren's Tested-by tag.
I can't take header standardization into account, header files are not ABI, further see Documentation/process/stable-api-nonsense.rst
Yours,
Linus Walleij
Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions
Hi Linus,
Quoted 38 lines · Linus Walleij
Quoted 23 lines · Paul Gortmaker
Fixups here tend to be more of a conglomerate of some of the other repeated/systematic ones we've seen in the earlier pinctrl cleanups.
We remove
module.hfrom code that isn't doing anything modular at all; if they have__initsections, then replace it withinit.hOne driver has a .remove that would be dispatched on
module_exit, and as that code is essentially orphaned, so we remove it. In case anyone was previously doing the (pointless) unbind to get to that function, we disable unbind for this one driver as well.A couple bool drivers (hence non-modular) are converted over to to
builtin_platform_driver().Since
module_platform_driver()uses the same init level priority asbuiltin_platform_driver()the init ordering remains unchanged with this commit.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.We also delete the
MODULE_LICENSEtag etc. since all that information was (or is now) contained at the top of the file in the comments.Quoted 12 lines
Cc Eric Anholt <[email protected]>Cc Florian Fainelli <[email protected]>Cc Jon Mason <[email protected]>Cc Linus Walleij <[email protected]>Cc Ray Jui <[email protected]>Cc Scott Branden <[email protected]>Cc Stefan Wahren <[email protected]>Cc Sherman Yin <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Quoted 5 lines
Patch applied with Stefan Wahren's Tested-by tag.
I can't take header standardization into account, header files are not ABI, further see
Documentation/process/stable-api-nonsense.rst
It is a simple ask to place the new information in a new comment after the legal header.
An aim at consistency helps reduce confusion (internal and external)
of what license header template to apply to files. Modifying these headers and placing information in the middle of them does not help in this effort.
Quoted 2 lines
Yours,
Linus Walleij
Regards,
Scott
Re: [PATCH 3/3] pinctrl: bcm: clean up modular vs. non-modular distinctions
Quoted 2 lines · Scott Branden
It is a simple ask to place the new information in a new comment after the legal header.
OK send a patch fixing the headers the way you want them.
I don't mind if you want a certain order on your desk as a figure of speak, I am the same.
Quoted 4 lines
An aim at consistency helps reduce confusion (internal and external) of what license header template to apply to files. Modifying these headers and placing
information in the middle of them does not help in this effort.
Aha, I understand it if a human is reading the files.
If it is a machine, not so much, as we should not serve the machines but the other way around.
Yours,
Linus Walleij
Quoted 1 line · Paul Gortmaker
This is the last of the pinctrl cleanups I have in my queue.
Awesome.
Quoted 1 line
Linus - thanks for your patience in merging all these to date.
You are the patient one. I'm just merging...
I was sold on the technical merit if these patches once it was explained to me that #include <linux/module.h> actually has a significant impact on compile time when accumulated across the kernel. This just needs to be done right and you make it so.
Yours,
Linus Walleij