gpio: batch #1: remove modular usage from non-modular drivers
cover gpio: batch #1: remove modular usage from non-modular drivers
For GPIO, I've divided up the the audit of modular usage in non-modular drivers into three categories to ease review and limit the batch size. The breakdown of the three groups is as follows:
1) just replacement of modular macros with their non-modular equivalents that CPP would have inserted anyway ; this means runtime equivalence and actually also binary equivalence.
[This lot represents #1, which are essentially the "free" ones that have essentially zero impact beyond the original desired cleanup goal itself.]
2) as per #1 but also with the removal of unused/orphaned __exit functions that could never be called/exercised. This also maintains runtime equivalence, but since the unused __exit function is gone, there is a reduction in the object file size and hence not binary equivalence, eg:
before: -rw-rw-r-- 1 8828 drivers/gpio/gpio-rc5t583.o
after: -rw-rw-r-- 1 7396 drivers/gpio/gpio-rc5t583.o3) as per #2 but also with the removal of a ".remove" function that is
hooked into the driver struct. This ".remove" function would of
course not be called from the __exit function since that is 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.
I will send #2 once this #1 is finalized/merged and #3 once #2 is merged.
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.
Build tested for arm and arm64 on 4.6-rc1 to ensure no silly typos exist.
Paul.
---
Paul Gortmaker (9):
drivers/gpio: make gpio-bcm-kona.c explicitly non-modular drivers/gpio: make gpio-mb86s7x.c driver explicitly non-modular drivers/gpio: make gpio-mc9s08dz60.c explicitly non-modular drivers/gpio: make gpio-moxart.c explicitly non-modular drivers/gpio: make gpio-mvebu.c explicitly non-modular drivers/gpio: make gpio-pl061.c explicitly non-modular drivers/gpio: make gpio-sta2x11.c explicitly non-modular drivers/gpio: make gpio-xgene.c explicitly non-modular drivers/gpio: make gpio-zx.c explicitly non-modular
drivers/gpio/gpio-bcm-kona.c | 14 +++++--------- drivers/gpio/gpio-mb86s7x.c | 8 +------- drivers/gpio/gpio-mc9s08dz60.c | 12 ++---------- drivers/gpio/gpio-moxart.c | 7 +------ drivers/gpio/gpio-mvebu.c | 5 ++--- drivers/gpio/gpio-pl061.c | 12 ++++-------- drivers/gpio/gpio-sta2x11.c | 8 ++------ drivers/gpio/gpio-xgene.c | 9 +-------- drivers/gpio/gpio-zx.c | 14 ++++++-------- 9 files changed, 24 insertions(+), 65 deletions(-)
Signature · 1 line
2.6.1
PATCH 1/9 drivers/gpio: make gpio-bcm-kona.c explicitly non-modular
The Kconfig currently controlling compilation of this code is:
config GPIO_BCM_KONA
bool "Broadcom Kona GPIO"
...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the driver there is no doubt it is builtin-only.
Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.
Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments.
--- drivers/gpio/gpio-bcm-kona.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/gpio/gpio-bcm-kona.c +5 -9
@@ -1,4 +1,7 @@/* +* Broadcom Kona GPIO Driver +* +* Author: Broadcom Corporation <[email protected]> * Copyright (C) 2012-2014 Broadcom Corporation * * This program is free software; you can redistribute it and/or
@@ -17,7 +20,7 @@#include <linux/gpio.h> #include <linux/of_device.h> #include <linux/of_irq.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/irqdomain.h> #include <linux/irqchip/chained_irq.h>
@@ -502,8 +505,6 @@ static struct of_device_id const bcm_kona_gpio_of_match[] = { {} }; -MODULE_DEVICE_TABLE (of, bcm_kona_gpio_of_match); -/* * This lock class tells lockdep that GPIO irqs are in a different * category than their parents, so it won't report false recursion.
@@ -659,9 +660,4 @@ static struct platform_driver bcm_kona_gpio_driver = { }, .probe = bcm_kona_gpio_probe, }; - -module_platform_driver (bcm_kona_gpio_driver); - -MODULE_AUTHOR ("Broadcom Corporation <[email protected]>" ); -MODULE_DESCRIPTION ("Broadcom Kona GPIO Driver" ); -MODULE_LICENSE ("GPL v2" ); +builtin_platform_driver (bcm_kona_gpio_driver);
Signature · 1 line
2.6.1
Re: [PATCH 1/9] drivers/gpio: make gpio-bcm-kona.c explicitly non-modular
Quoted 19 lines · Paul Gortmaker
The
Kconfigcurrently controlling compilation of this code is:config
GPIO_BCM_KONA
bool "Broadcom Kona GPIO"...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the driver there is no doubt it is builtin-only.
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 6 lines
Cc Ray Jui <[email protected]>Cc Linus Walleij <[email protected]>Cc Alexandre Courbot <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 2/9 drivers/gpio: make gpio-mb86s7x.c driver explicitly non-modular
In reply to Paul GortmakerThe Kconfig for this driver is currently:
config GPIO_MB86S7X
bool "GPIO support for Fujitsu MB86S7x Platforms"
...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modularity, 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.
--- drivers/gpio/gpio-mb86s7x.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpio/gpio-mb86s7x.c +1 -7
@@ -17,7 +17,6 @@#include <linux/io.h> #include <linux/init.h> #include <linux/clk.h> -#include <linux/module.h> #include <linux/err.h> #include <linux/errno.h> #include <linux/ioport.h>
@@ -210,7 +209,6 @@ static const struct of_device_id mb86s70_gpio_dt_ids[] = { { .compatible = "fujitsu,mb86s70-gpio" }, {/* sentinel */ } }; -MODULE_DEVICE_TABLE (of, mb86s70_gpio_dt_ids);static struct platform_driver mb86s70_gpio_driver = { .driver = {
@@ -225,8 +223,4 @@ static int __init mb86s70_gpio_init(void) {return platform_driver_register (&mb86s70_gpio_driver); } -module_init (mb86s70_gpio_init); - -MODULE_DESCRIPTION ("MB86S7x GPIO Driver" ); -MODULE_ALIAS ("platform:mb86s70-gpio" ); -MODULE_LICENSE ("GPL" ); +device_initcall (mb86s70_gpio_init);
Signature · 1 line
2.6.1
Re: [PATCH 2/9] drivers/gpio: make gpio-mb86s7x.c driver explicitly non-modular
Quoted 12 lines · Paul Gortmaker
The
Kconfigfor this driver is currently:config
GPIO_MB86S7X
bool "GPIO support for Fujitsu MB86S7x Platforms"...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modularity, so that when reading the driver there is no doubt it is builtin-only.
Since
module_inittranslates todevice_initcallin the non-modular case, the init ordering remains unchanged with this commit.
Quoted 7 lines
We also delete the
MODULE_LICENSEtag etc. since all that information is already contained at the top of the file in the comments.Cc Linus Walleij <[email protected]>Cc Alexandre Courbot <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 3/9 drivers/gpio: make gpio-mc9s08dz60.c explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
drivers/gpio/Kconfig:config GPIO_MC9S08DZ60drivers/gpio/Kconfig: bool "MX35 3DS BOARD MC9S08DZ60 GPIO functions"
...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_i2c_driver() uses the same init level priority as builtin_i2c_driver() the init ordering remains unchanged with this commit.
Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.
--- drivers/gpio/gpio-mc9s08dz60.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/gpio/gpio-mc9s08dz60.c +2 -10
@@ -15,7 +15,7 @@*/ #include <linux/kernel.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/slab.h> #include <linux/i2c.h> #include <linux/gpio.h>
@@ -111,8 +111,6 @@ static const struct i2c_device_id mc9s08dz60_id[] = { {}, }; -MODULE_DEVICE_TABLE (i2c, mc9s08dz60_id); -static struct i2c_driver mc9s08dz60_i2c_driver = { .driver = { .name ="mc9s08dz60" ,
@@ -120,10 +118,4 @@ static struct i2c_driver mc9s08dz60_i2c_driver = { .probe = mc9s08dz60_probe, .id_table = mc9s08dz60_id, }; - -module_i2c_driver (mc9s08dz60_i2c_driver); - -MODULE_AUTHOR ("Freescale Semiconductor, Inc. " -"Wu Guoxing <[email protected]>" ); -MODULE_DESCRIPTION ("mc9s08dz60 gpio function on mx35 3ds board" ); -MODULE_LICENSE ("GPL v2" ); +builtin_i2c_driver (mc9s08dz60_i2c_driver);
Signature · 1 line
2.6.1
Re: [PATCH 3/9] drivers/gpio: make gpio-mc9s08dz60.c explicitly non-modular
Quoted 16 lines · Paul Gortmaker
The
Kconfigcurrently controlling compilation of this code is:drivers/gpio/Kconfig:config
GPIO_MC9S08DZ60drivers/gpio/Kconfig: bool "MX35 3DS BOARD MC9S08DZ60 GPIO functions"...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_i2c_driver()uses the same init level priority asbuiltin_i2c_driver()the init ordering remains unchanged with this commit.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.
Quoted 8 lines
We also delete the
MODULE_LICENSEtag etc. since all that information is already contained at the top of the file in the comments.Cc Linus Walleij <[email protected]>Cc Alexandre Courbot <[email protected]>Cc Wu Guoxing <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 4/9 drivers/gpio: make gpio-moxart.c explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
drivers/gpio/Kconfig:config GPIO_MOXARTdrivers/gpio/Kconfig: bool "MOXART GPIO support"
...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modular references so that when reading the driver there is no doubt it is builtin-only.
Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.
We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.
We don't replace module.h with init.h since the file already has that.
--- drivers/gpio/gpio-moxart.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpio/gpio-moxart.c +1 -6
@@ -15,7 +15,6 @@#include <linux/irq.h> #include <linux/io.h> #include <linux/platform_device.h> -#include <linux/module.h> #include <linux/of_address.h> #include <linux/of_gpio.h> #include <linux/pinctrl/consumer.h>
@@ -82,8 +81,4 @@ static struct platform_driver moxart_gpio_driver = { }, .probe = moxart_gpio_probe, }; -module_platform_driver (moxart_gpio_driver); - -MODULE_DESCRIPTION ("MOXART GPIO chip driver" ); -MODULE_LICENSE ("GPL" ); -MODULE_AUTHOR ("Jonas Jensen <[email protected]>" ); +builtin_platform_driver (moxart_gpio_driver);
Signature · 1 line
2.6.1
Re: [PATCH 4/9] drivers/gpio: make gpio-moxart.c explicitly non-modular
Quoted 17 lines · Paul Gortmaker
The
Kconfigcurrently controlling compilation of this code is:drivers/gpio/Kconfig:config
GPIO_MOXARTdrivers/gpio/Kconfig: bool "MOXART GPIO support"...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modular references so that when reading the driver there is no doubt it is builtin-only.
Since
module_platform_driver()uses the same init level priority asbuiltin_platform_driver()the init ordering remains unchanged with this commit.We also delete the
MODULE_LICENSEtag etc. since all that information is already contained at the top of the file in the comments.
Quoted 7 lines
We don't replace
module.hwithinit.hsince the file already has that.Cc Jonas Jensen <[email protected]>Cc Linus Walleij <[email protected]>Cc Alexandre Courbot <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 5/9 drivers/gpio: make gpio-mvebu.c explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
drivers/gpio/Kconfig:config GPIO_MVEBUdrivers/gpio/Kconfig: def_bool y
...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the driver there is no doubt it is builtin-only.
Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.
Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
--- drivers/gpio/gpio-mvebu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpio/gpio-mvebu.c +2 -3
@@ -34,7 +34,7 @@*/ #include <linux/err.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/gpio.h> #include <linux/irq.h> #include <linux/slab.h>
@@ -557,7 +557,6 @@ static const struct of_device_id mvebu_gpio_of_match[] = {/* sentinel */ }, }; -MODULE_DEVICE_TABLE (of, mvebu_gpio_of_match);static int mvebu_gpio_suspend (struct platform_device *pdev,pm_message_t state) {
@@ -838,4 +837,4 @@ static struct platform_driver mvebu_gpio_driver = { .suspend = mvebu_gpio_suspend, .resume = mvebu_gpio_resume, }; -module_platform_driver (mvebu_gpio_driver); +builtin_platform_driver (mvebu_gpio_driver);
Signature · 1 line
2.6.1
Re: [PATCH 5/9] drivers/gpio: make gpio-mvebu.c explicitly non-modular
Quoted 14 lines · Paul Gortmaker
The
Kconfigcurrently controlling compilation of this code is:drivers/gpio/Kconfig:config
GPIO_MVEBUdrivers/gpio/Kconfig:def_booly...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the driver there is no doubt it is builtin-only.
Since
module_platform_driver()uses the same init level priority asbuiltin_platform_driver()the init ordering remains unchanged with this commit.
Quoted 6 lines
Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.Cc Linus Walleij <[email protected]>Cc Alexandre Courbot <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 6/9 drivers/gpio: make gpio-pl061.c explicitly non-modular
In reply to Paul GortmakerThe Kconfig for this driver is currently:
config GPIO_PL061
bool "PrimeCell PL061 GPIO support"
...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modularity, 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 was (or is now) contained at the top of the file in the comments.
--- drivers/gpio/gpio-pl061.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/gpio/gpio-pl061.c +4 -8
@@ -1,6 +1,8 @@/* * Copyright (C) 2008, 2009 Provigent Ltd. * +* Author: Baruch Siach <[email protected]> +* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation.
@@ -11,7 +13,7 @@*/ #include <linux/spinlock.h> #include <linux/errno.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/io.h> #include <linux/ioport.h> #include <linux/interrupt.h>
@@ -429,8 +431,6 @@ static struct amba_id pl061_ids[] = { { 0, 0 }, }; -MODULE_DEVICE_TABLE(amba, pl061_ids); - static struct amba_driver pl061_gpio_driver = { .drv = { .name = "pl061_gpio",
@@ -446,8 +446,4 @@ static int __init pl061_gpio_init(void) {return amba_driver_register (&pl061_gpio_driver); } -module_init (pl061_gpio_init); - -MODULE_AUTHOR ("Baruch Siach <[email protected]>" ); -MODULE_DESCRIPTION ("PL061 GPIO driver" ); -MODULE_LICENSE ("GPL" ); +device_initcall (pl061_gpio_init);
Signature · 1 line
2.6.1
Re: [PATCH 6/9] drivers/gpio: make gpio-pl061.c explicitly non-modular
Hi Paul,
Quoted 12 lines · Paul Gortmaker
The
Kconfigfor this driver is currently:config
GPIO_PL061
bool "PrimeCell PL061 GPIO support"...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modularity, so that when reading the driver there is no doubt it is builtin-only.
Since
module_inittranslates todevice_initcallin the non-modular case, the init ordering remains unchanged with this commit.
Quoted 8 lines
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 Linus Walleij <[email protected]>Cc Alexandre Courbot <[email protected]>Cc Baruch Siach <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Thanks,
baruch
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -Re: [PATCH 6/9] drivers/gpio: make gpio-pl061.c explicitly non-modular
In reply to Paul GortmakerQuoted 12 lines · Paul Gortmaker
The
Kconfigfor this driver is currently:config
GPIO_PL061
bool "PrimeCell PL061 GPIO support"...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modularity, so that when reading the driver there is no doubt it is builtin-only.
Since
module_inittranslates todevice_initcallin the non-modular case, the init ordering remains unchanged with this commit.
Quoted 8 lines
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 Linus Walleij <[email protected]>Cc Alexandre Courbot <[email protected]>Cc Baruch Siach <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Patch applied with Baruch's ACK.
Yours,
Linus Walleij
PATCH 7/9 drivers/gpio: make gpio-sta2x11.c explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
drivers/gpio/Kconfig:config GPIO_STA2X11drivers/gpio/Kconfig: bool "STA2x11/ConneXt GPIO support"
...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity, so that when reading the driver there is no doubt it is builtin-only.
Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.
We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.
--- drivers/gpio/gpio-sta2x11.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpio/gpio-sta2x11.c +2 -6
@@ -20,7 +20,7 @@* */ -#include <linux/module.h> +#include <linux/init.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/gpio.h>
@@ -432,8 +432,4 @@ static struct platform_driver sta2x11_gpio_platform_driver = { }, .probe = gsta_probe, }; - -module_platform_driver (sta2x11_gpio_platform_driver); - -MODULE_LICENSE ("GPL v2" ); -MODULE_DESCRIPTION ("sta2x11_gpio GPIO driver" ); +builtin_platform_driver (sta2x11_gpio_platform_driver);
Signature · 1 line
2.6.1
Re: [PATCH 7/9] drivers/gpio: make gpio-sta2x11.c explicitly non-modular
Quoted 14 lines · Paul Gortmaker
The
Kconfigcurrently controlling compilation of this code is:drivers/gpio/Kconfig:config
GPIO_STA2X11drivers/gpio/Kconfig: bool "STA2x11/ConneXt GPIO support"...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity, so that when reading the driver there is no doubt it is builtin-only.
Since
module_platform_driver()uses the same init level priority asbuiltin_platform_driver()the init ordering remains unchanged with this commit.
Quoted 7 lines
We also delete the
MODULE_LICENSEtag etc. since all that information is already contained at the top of the file in the comments.Cc Linus Walleij <[email protected]>Cc Alexandre Courbot <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 8/9 drivers/gpio: make gpio-xgene.c explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
drivers/gpio/Kconfig:config GPIO_XGENEdrivers/gpio/Kconfig: bool "APM X-Gene GPIO controller support"
...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.
--- drivers/gpio/gpio-xgene.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpio/gpio-xgene.c +1 -8
@@ -17,7 +17,6 @@* along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h>
@@ -211,7 +210,6 @@ static const struct of_device_id xgene_gpio_of_match[] = { { .compatible = "apm,xgene-gpio", }, {}, }; -MODULE_DEVICE_TABLE (of, xgene_gpio_of_match);static struct platform_driver xgene_gpio_driver = { .driver = {
@@ -221,9 +219,4 @@ static struct platform_driver xgene_gpio_driver = { }, .probe = xgene_gpio_probe, }; - -module_platform_driver (xgene_gpio_driver); - -MODULE_AUTHOR ("Feng Kan <[email protected]>" ); -MODULE_DESCRIPTION ("APM X-Gene GPIO driver" ); -MODULE_LICENSE ("GPL" ); +builtin_platform_driver (xgene_gpio_driver);
Signature · 1 line
2.6.1
Re: [PATCH 8/9] drivers/gpio: make gpio-xgene.c explicitly non-modular
Quoted 16 lines · Paul Gortmaker
The
Kconfigcurrently controlling compilation of this code is:drivers/gpio/Kconfig:config
GPIO_XGENEdrivers/gpio/Kconfig: bool "APM X-Gene GPIO controller support"...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 asbuiltin_platform_driver()the init ordering remains unchanged with this commit.Also note that
MODULE_DEVICE_TABLEis a no-op for non-modular code.
Quoted 8 lines
We also delete the
MODULE_LICENSEtag etc. since all that information is already contained at the top of the file in the comments.Cc Feng Kan <[email protected]>Cc Linus Walleij <[email protected]>Cc Alexandre Courbot <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 9/9 drivers/gpio: make gpio-zx.c explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
config GPIO_ZX
bool "ZTE ZX GPIO support"
...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the driver there is no doubt it is builtin-only.
Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit.
Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments.
--- drivers/gpio/gpio-zx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/gpio/gpio-zx.c +6 -8
@@ -1,4 +1,8 @@/* +* ZTE ZX296702 GPIO driver +* +* Author: Jun Nie <[email protected]> +* * Copyright (C) 2015 Linaro Ltd. * * This program is free software; you can redistribute it and/or modify
@@ -10,7 +14,7 @@#include <linux/errno.h> #include <linux/gpio/driver.h> #include <linux/irqchip/chained_irq.h> -#include <linux/module.h> +#include <linux/init.h> #include <linux/of.h> #include <linux/pinctrl/consumer.h> #include <linux/platform_device.h>
@@ -282,7 +286,6 @@ static const struct of_device_id zx_gpio_match[] = { }, { }, }; -MODULE_DEVICE_TABLE (of, zx_gpio_match);static struct platform_driver zx_gpio_driver = { .probe = zx_gpio_probe,
@@ -291,9 +294,4 @@ static struct platform_driver zx_gpio_driver = { .of_match_table = of_match_ptr(zx_gpio_match), }, }; - -module_platform_driver(zx_gpio_driver) - -MODULE_AUTHOR("Jun Nie <[email protected]>"); -MODULE_DESCRIPTION ("ZTE ZX296702 GPIO driver" ); -MODULE_LICENSE ("GPL" ); +builtin_platform_driver (zx_gpio_driver)
Signature · 1 line
2.6.1
Re: [PATCH 9/9] drivers/gpio: make gpio-zx.c explicitly non-modular
Quoted 16 lines · Paul Gortmaker
The
Kconfigcurrently controlling compilation of this code is:config
GPIO_ZX
bool "ZTE ZX GPIO support"...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the driver there is no doubt it is builtin-only.
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.
Quoted 8 lines
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 Linus Walleij <[email protected]>Cc Alexandre Courbot <[email protected]>Cc Jun Nie <[email protected]>Signed-off-by Paul Gortmaker <[email protected]>
Patch applied.
Yours,
Linus Walleij
Quoted 1 line · Paul Gortmaker
I will send #2 once this #1 is finalized/merged and #3 once #2 is merged.
I merged the first set.
Thank you for your tireless efforts in cleaning upp this mess.
Yours,
Linus Walleij