diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-17 10:49:37 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-20 09:34:11 +0200 |
commit | 92642f385b7ea03117aff75e436a087a387fedb0 (patch) | |
tree | 2b862450229a94f78ba8ba397b40519c3f50c400 | |
parent | 59ae81e11fec92f1080c720b1e36c9176be58a64 (diff) |
staging: kpc2000: remove kp200_module.c file
The kp200_module.c does not need to be stand-alone, so move it into the
core.c file. This lets us make some functions static, reducing the
global namespace of the driver.
Cc: Matt Sickler <Matt.Sickler@daktronics.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/kpc2000/kpc2000/Makefile | 2 | ||||
-rw-r--r-- | drivers/staging/kpc2000/kpc2000/core.c | 44 | ||||
-rw-r--r-- | drivers/staging/kpc2000/kpc2000/kp2000_module.c | 54 | ||||
-rw-r--r-- | drivers/staging/kpc2000/kpc2000/pcie.h | 2 |
4 files changed, 43 insertions, 59 deletions
diff --git a/drivers/staging/kpc2000/kpc2000/Makefile b/drivers/staging/kpc2000/kpc2000/Makefile index 28ab1e185f9f..cfc20e2193df 100644 --- a/drivers/staging/kpc2000/kpc2000/Makefile +++ b/drivers/staging/kpc2000/kpc2000/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 obj-m := kpc2000.o -kpc2000-objs += kp2000_module.o core.o cell_probe.o fileops.o +kpc2000-objs += core.o cell_probe.o fileops.o diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c index eb8bac62d33d..e525dd130ce2 100644 --- a/drivers/staging/kpc2000/kpc2000/core.c +++ b/drivers/staging/kpc2000/kpc2000/core.c @@ -198,7 +198,8 @@ irqreturn_t kp2000_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; } -int kp2000_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) +static int kp2000_pcie_probe(struct pci_dev *pdev, + const struct pci_device_id *id) { int err = 0; struct kp2000_device *pcard; @@ -405,7 +406,7 @@ int kp2000_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) } -void kp2000_pcie_remove(struct pci_dev *pdev) +static void kp2000_pcie_remove(struct pci_dev *pdev) { struct kp2000_device *pcard = pci_get_drvdata(pdev); @@ -435,3 +436,42 @@ void kp2000_pcie_remove(struct pci_dev *pdev) unlock_card(pcard); kfree(pcard); } + +struct class *kpc_uio_class; +ATTRIBUTE_GROUPS(kpc_uio_class); + +static const struct pci_device_id kp2000_pci_device_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_DAKTRONICS, PCI_DEVICE_ID_DAKTRONICS) }, + { PCI_DEVICE(PCI_VENDOR_ID_DAKTRONICS, PCI_DEVICE_ID_DAKTRONICS_KADOKA_P2KR0) }, + { 0, } +}; +MODULE_DEVICE_TABLE(pci, kp2000_pci_device_ids); + +static struct pci_driver kp2000_driver_inst = { + .name = "kp2000_pcie", + .id_table = kp2000_pci_device_ids, + .probe = kp2000_pcie_probe, + .remove = kp2000_pcie_remove, +}; + +static int __init kp2000_pcie_init(void) +{ + kpc_uio_class = class_create(THIS_MODULE, "kpc_uio"); + if (IS_ERR(kpc_uio_class)) + return PTR_ERR(kpc_uio_class); + + kpc_uio_class->dev_groups = kpc_uio_class_groups; + return pci_register_driver(&kp2000_driver_inst); +} +module_init(kp2000_pcie_init); + +static void __exit kp2000_pcie_exit(void) +{ + pci_unregister_driver(&kp2000_driver_inst); + class_destroy(kpc_uio_class); +} +module_exit(kp2000_pcie_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Lee.Brooke@Daktronics.com, Matt.Sickler@Daktronics.com"); +MODULE_SOFTDEP("pre: uio post: kpc_nwl_dma kpc_i2c kpc_spi"); diff --git a/drivers/staging/kpc2000/kpc2000/kp2000_module.c b/drivers/staging/kpc2000/kpc2000/kp2000_module.c deleted file mode 100644 index fa3bd266ba54..000000000000 --- a/drivers/staging/kpc2000/kpc2000/kp2000_module.c +++ /dev/null @@ -1,54 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -#include <linux/init.h> -#include <linux/module.h> -#include <linux/pci.h> -#include <linux/types.h> -#include <linux/export.h> -#include <linux/slab.h> -#include <asm/io.h> -#include <linux/io.h> -#include <linux/mfd/core.h> -#include <linux/platform_device.h> -#include <linux/ioport.h> -#include "pcie.h" - - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Lee.Brooke@Daktronics.com, Matt.Sickler@Daktronics.com"); -MODULE_SOFTDEP("pre: uio post: kpc_nwl_dma kpc_i2c kpc_spi"); - -struct class *kpc_uio_class; -ATTRIBUTE_GROUPS(kpc_uio_class); - -static const struct pci_device_id kp2000_pci_device_ids[] = { - { PCI_DEVICE(PCI_VENDOR_ID_DAKTRONICS, PCI_DEVICE_ID_DAKTRONICS) }, - { PCI_DEVICE(PCI_VENDOR_ID_DAKTRONICS, PCI_DEVICE_ID_DAKTRONICS_KADOKA_P2KR0) }, - { 0, } -}; -MODULE_DEVICE_TABLE(pci, kp2000_pci_device_ids); - -static struct pci_driver kp2000_driver_inst = { - .name = "kp2000_pcie", - .id_table = kp2000_pci_device_ids, - .probe = kp2000_pcie_probe, - .remove = kp2000_pcie_remove -}; - - -static int __init kp2000_pcie_init(void) -{ - kpc_uio_class = class_create(THIS_MODULE, "kpc_uio"); - if (IS_ERR(kpc_uio_class)) - return PTR_ERR(kpc_uio_class); - - kpc_uio_class->dev_groups = kpc_uio_class_groups; - return pci_register_driver(&kp2000_driver_inst); -} -module_init(kp2000_pcie_init); - -static void __exit kp2000_pcie_exit(void) -{ - pci_unregister_driver(&kp2000_driver_inst); - class_destroy(kpc_uio_class); -} -module_exit(kp2000_pcie_exit); diff --git a/drivers/staging/kpc2000/kpc2000/pcie.h b/drivers/staging/kpc2000/kpc2000/pcie.h index 8a032a5a962e..9278084af547 100644 --- a/drivers/staging/kpc2000/kpc2000/pcie.h +++ b/drivers/staging/kpc2000/kpc2000/pcie.h @@ -84,8 +84,6 @@ struct kp2000_device { extern struct class *kpc_uio_class; extern struct attribute *kpc_uio_class_attrs[]; -int kp2000_pcie_probe(struct pci_dev *dev, const struct pci_device_id *id); -void kp2000_pcie_remove(struct pci_dev *pdev); int kp2000_probe_cores(struct kp2000_device *pcard); void kp2000_remove_cores(struct kp2000_device *pcard); |