diff mbox series

[2/5] PCI: dwc: pci-dra7xx: make it a kernel module

Message ID 20210517154122.430544-3-luca@lucaceresoli.net (mailing list archive)
State Superseded
Headers show
Series PCI: dwc: pci-dra7xx: miscellaneous improvements | expand

Commit Message

Luca Ceresoli May 17, 2021, 3:41 p.m. UTC
This allows to build the driver as a loadable kernel module.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
---
 drivers/pci/controller/dwc/pci-dra7xx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Rob Herring May 18, 2021, 6:55 p.m. UTC | #1
On Mon, May 17, 2021 at 10:41 AM Luca Ceresoli <luca@lucaceresoli.net> wrote:
>
> This allows to build the driver as a loadable kernel module.

Enable building the driver as a loadable kernel module.

>
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> ---
>  drivers/pci/controller/dwc/pci-dra7xx.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
> index 6457695df00c..fe11b96fe9a5 100644
> --- a/drivers/pci/controller/dwc/pci-dra7xx.c
> +++ b/drivers/pci/controller/dwc/pci-dra7xx.c
> @@ -15,6 +15,7 @@
>  #include <linux/irqdomain.h>
>  #include <linux/kernel.h>
>  #include <linux/init.h>
> +#include <linux/module.h>
>  #include <linux/of_device.h>
>  #include <linux/of_gpio.h>
>  #include <linux/of_pci.h>
> @@ -949,4 +950,8 @@ static struct platform_driver dra7xx_pcie_driver = {
>         },
>         .shutdown = dra7xx_pcie_shutdown,
>  };
> -builtin_platform_driver(dra7xx_pcie_driver);
> +module_platform_driver(dra7xx_pcie_driver);

You need MODULE_DEVICE_TABLE() too for autoloading.

> +
> +MODULE_AUTHOR("Kishon Vijay Abraham I <kishon@ti.com>");
> +MODULE_DESCRIPTION("PCIe controller driver for TI DRA7xx SoCs");
> +MODULE_LICENSE("GPL v2");
> --
> 2.25.1
>
Luca Ceresoli May 18, 2021, 9:39 p.m. UTC | #2
Hi Rob,

On 18/05/21 20:55, Rob Herring wrote:
> On Mon, May 17, 2021 at 10:41 AM Luca Ceresoli <luca@lucaceresoli.net> wrote:
>>
>> This allows to build the driver as a loadable kernel module.
> 
> Enable building the driver as a loadable kernel module.
> 
>>
>> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
>> ---
>>  drivers/pci/controller/dwc/pci-dra7xx.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
>> index 6457695df00c..fe11b96fe9a5 100644
>> --- a/drivers/pci/controller/dwc/pci-dra7xx.c
>> +++ b/drivers/pci/controller/dwc/pci-dra7xx.c
>> @@ -15,6 +15,7 @@
>>  #include <linux/irqdomain.h>
>>  #include <linux/kernel.h>
>>  #include <linux/init.h>
>> +#include <linux/module.h>
>>  #include <linux/of_device.h>
>>  #include <linux/of_gpio.h>
>>  #include <linux/of_pci.h>
>> @@ -949,4 +950,8 @@ static struct platform_driver dra7xx_pcie_driver = {
>>         },
>>         .shutdown = dra7xx_pcie_shutdown,
>>  };
>> -builtin_platform_driver(dra7xx_pcie_driver);
>> +module_platform_driver(dra7xx_pcie_driver);
> 
> You need MODULE_DEVICE_TABLE() too for autoloading.

Good catch! Will be fixed in v2.

Thanks.
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
index 6457695df00c..fe11b96fe9a5 100644
--- a/drivers/pci/controller/dwc/pci-dra7xx.c
+++ b/drivers/pci/controller/dwc/pci-dra7xx.c
@@ -15,6 +15,7 @@ 
 #include <linux/irqdomain.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/of_gpio.h>
 #include <linux/of_pci.h>
@@ -949,4 +950,8 @@  static struct platform_driver dra7xx_pcie_driver = {
 	},
 	.shutdown = dra7xx_pcie_shutdown,
 };
-builtin_platform_driver(dra7xx_pcie_driver);
+module_platform_driver(dra7xx_pcie_driver);
+
+MODULE_AUTHOR("Kishon Vijay Abraham I <kishon@ti.com>");
+MODULE_DESCRIPTION("PCIe controller driver for TI DRA7xx SoCs");
+MODULE_LICENSE("GPL v2");