diff mbox

[04/14] PCI: generic: make it explicitly non-modular

Message ID 20160702231334.26684-5-paul.gortmaker@windriver.com
State Accepted
Headers show

Commit Message

Paul Gortmaker July 2, 2016, 11:13 p.m. UTC
The Kconfig currently controlling compilation of this code is:

drivers/pci/host/Kconfig:config PCI_HOST_GENERIC
drivers/pci/host/Kconfig:       bool "Generic PCI host controller"

...meaning that it currently is not being built as a module by anyone.

Lets remove the few trace uses of modular code and macros, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

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

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

Cc: Will Deacon <will.deacon@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/pci/host/pci-host-generic.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Will Deacon July 4, 2016, 5:37 p.m. UTC | #1
On Sat, Jul 02, 2016 at 07:13:24PM -0400, Paul Gortmaker wrote:
> The Kconfig currently controlling compilation of this code is:
> 
> drivers/pci/host/Kconfig:config PCI_HOST_GENERIC
> drivers/pci/host/Kconfig:       bool "Generic PCI host controller"
> 
> ...meaning that it currently is not being built as a module by anyone.
> 
> Lets remove the few trace uses of modular code and macros, 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.

Ideally, we'd simply fix this to build as a module, but it's not clear
how to do that now that the ecam accessors have been split out into
their own file. A liberal sprinkling of EXPORT_SYMBOL might work, but
it's a bit grotty.

David, Jayachandran -- do you have any desire to build your PCI host
controller drivers as modules?

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Daney July 5, 2016, 8:19 p.m. UTC | #2
On 07/04/2016 10:37 AM, Will Deacon wrote:
> On Sat, Jul 02, 2016 at 07:13:24PM -0400, Paul Gortmaker wrote:
>> The Kconfig currently controlling compilation of this code is:
>>
>> drivers/pci/host/Kconfig:config PCI_HOST_GENERIC
>> drivers/pci/host/Kconfig:       bool "Generic PCI host controller"
>>
>> ...meaning that it currently is not being built as a module by anyone.
>>
>> Lets remove the few trace uses of modular code and macros, 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.
>
> Ideally, we'd simply fix this to build as a module, but it's not clear
> how to do that now that the ecam accessors have been split out into
> their own file. A liberal sprinkling of EXPORT_SYMBOL might work, but
> it's a bit grotty.
>
> David, Jayachandran -- do you have any desire to build your PCI host
> controller drivers as modules?

I can only speak to the Cavium case.

The system is not usable without PCI, so there is no advantage to making 
the PCI host drivers modular.  At this point I don't see any reason to 
expend effort making it work as a module.

David.


>
> Will
>

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jayachandran C July 6, 2016, 4:25 a.m. UTC | #3
On Wed, Jul 6, 2016 at 1:49 AM, David Daney <ddaney@caviumnetworks.com> wrote:
>
> On 07/04/2016 10:37 AM, Will Deacon wrote:
>>
>> On Sat, Jul 02, 2016 at 07:13:24PM -0400, Paul Gortmaker wrote:
>>>
>>> The Kconfig currently controlling compilation of this code is:
>>>
>>> drivers/pci/host/Kconfig:config PCI_HOST_GENERIC
>>> drivers/pci/host/Kconfig:       bool "Generic PCI host controller"
>>>
>>> ...meaning that it currently is not being built as a module by anyone.
>>>
>>> Lets remove the few trace uses of modular code and macros, 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.
>>
>>
>> Ideally, we'd simply fix this to build as a module, but it's not clear
>> how to do that now that the ecam accessors have been split out into
>> their own file. A liberal sprinkling of EXPORT_SYMBOL might work, but
>> it's a bit grotty.
>>
>> David, Jayachandran -- do you have any desire to build your PCI host
>> controller drivers as modules?
>
>
> I can only speak to the Cavium case.
>
> The system is not usable without PCI, so there is no advantage to making the PCI host drivers modular.  At this point I don't see any reason to expend effort making it work as a module.
>

Broadcom's case is also similar - pci-host-generic would to be built-in
when booting with device tree, or it would be unnecessary when booting
with ACPI. We don't have a scenario in which having it as a module would
be useful.

JC
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Will Deacon July 6, 2016, 5:02 p.m. UTC | #4
On Sat, Jul 02, 2016 at 07:13:24PM -0400, Paul Gortmaker wrote:
> The Kconfig currently controlling compilation of this code is:
> 
> drivers/pci/host/Kconfig:config PCI_HOST_GENERIC
> drivers/pci/host/Kconfig:       bool "Generic PCI host controller"
> 
> ...meaning that it currently is not being built as a module by anyone.
> 
> Lets remove the few trace uses of modular code and macros, so that
> when reading the driver there is no doubt it is builtin-only.
> 
> Since module_platform_driver() uses the same init level priority as
> builtin_platform_driver() the init ordering remains unchanged with
> this commit.
> 
> Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
> 
> We also delete the MODULE_LICENSE tag etc. since all that information
> is already contained at the top of the file in the comments.
> 
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: linux-pci@vger.kernel.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  drivers/pci/host/pci-host-generic.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)

Given that nobody seems to need this as a module and it's not
straightforward to enable that:

Acked-by: Will Deacon <will.deacon@arm.com>

I assume you've done something similar for
drivers/pci/host/pci-host-common.c?

Will
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Paul Gortmaker July 6, 2016, 5:39 p.m. UTC | #5
[Re: [PATCH 04/14] PCI: generic: make it explicitly non-modular] On 06/07/2016 (Wed 18:02) Will Deacon wrote:

> On Sat, Jul 02, 2016 at 07:13:24PM -0400, Paul Gortmaker wrote:
> > The Kconfig currently controlling compilation of this code is:
> > 
> > drivers/pci/host/Kconfig:config PCI_HOST_GENERIC
> > drivers/pci/host/Kconfig:       bool "Generic PCI host controller"
> > 
> > ...meaning that it currently is not being built as a module by anyone.
> > 
> > Lets remove the few trace uses of modular code and macros, so that
> > when reading the driver there is no doubt it is builtin-only.
> > 
> > Since module_platform_driver() uses the same init level priority as
> > builtin_platform_driver() the init ordering remains unchanged with
> > this commit.
> > 
> > Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
> > 
> > We also delete the MODULE_LICENSE tag etc. since all that information
> > is already contained at the top of the file in the comments.
> > 
> > Cc: Will Deacon <will.deacon@arm.com>
> > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > Cc: linux-pci@vger.kernel.org
> > Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> > ---
> >  drivers/pci/host/pci-host-generic.c | 10 ++--------
> >  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> Given that nobody seems to need this as a module and it's not
> straightforward to enable that:
> 
> Acked-by: Will Deacon <will.deacon@arm.com>
> 
> I assume you've done something similar for
> drivers/pci/host/pci-host-common.c?

Not yet -- that one escaped my radar because it didn't have module_init
or MODULE_DEVICE_TABLE in it; it just has MODULE_AUTHOR etc.  I'll add
that fix to my queue and update my audit to hide the MODULE_AUTHOR tags
when compiling for !MODULE.

Thanks,
Paul.
--

> 
> Will
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c
index f0ca6de0d87e..c05ea9d72f69 100644
--- a/drivers/pci/host/pci-host-generic.c
+++ b/drivers/pci/host/pci-host-generic.c
@@ -20,7 +20,7 @@ 
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of_address.h>
 #include <linux/of_pci.h>
 #include <linux/pci-ecam.h>
@@ -45,8 +45,6 @@  static const struct of_device_id gen_pci_of_match[] = {
 	{ },
 };
 
-MODULE_DEVICE_TABLE(of, gen_pci_of_match);
-
 static int gen_pci_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *of_id;
@@ -65,8 +63,4 @@  static struct platform_driver gen_pci_driver = {
 	},
 	.probe = gen_pci_probe,
 };
-module_platform_driver(gen_pci_driver);
-
-MODULE_DESCRIPTION("Generic PCI host driver");
-MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(gen_pci_driver);