summaryrefslogtreecommitdiff
path: root/drivers/cxl
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2021-09-08 22:12:38 -0700
committerDan Williams <dan.j.williams@intel.com>2021-09-21 13:44:57 -0700
commit5a2328f4e872a5bcbb2ff790497f000e8f79b152 (patch)
treed94567724a172ac4f14bfd41d4f01dd321dc49c4 /drivers/cxl
parent4faf31b43468c58e2c8c91cc5fa26f08a6b733be (diff)
cxl/pci: Use module_pci_driver
Now that cxl_mem_{init,exit} no longer need to manage debugfs, switch back to the smaller form of the boiler plate. Acked-by: Ben Widawsky <ben.widawsky@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/163116435825.2460985.7201322215431441130.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/cxl')
-rw-r--r--drivers/cxl/pci.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
index c9f2ac134f4d..27f75b5a2ee2 100644
--- a/drivers/cxl/pci.c
+++ b/drivers/cxl/pci.c
@@ -517,6 +517,13 @@ static int cxl_mem_probe(struct pci_dev *pdev, const struct pci_device_id *id)
struct cxl_mem *cxlm;
int rc;
+ /*
+ * Double check the anonymous union trickery in struct cxl_regs
+ * FIXME switch to struct_group()
+ */
+ BUILD_BUG_ON(offsetof(struct cxl_regs, memdev) !=
+ offsetof(struct cxl_regs, device_regs.memdev));
+
rc = pcim_enable_device(pdev);
if (rc)
return rc;
@@ -571,27 +578,6 @@ static struct pci_driver cxl_mem_driver = {
},
};
-static __init int cxl_mem_init(void)
-{
- int rc;
-
- /* Double check the anonymous union trickery in struct cxl_regs */
- BUILD_BUG_ON(offsetof(struct cxl_regs, memdev) !=
- offsetof(struct cxl_regs, device_regs.memdev));
-
- rc = pci_register_driver(&cxl_mem_driver);
- if (rc)
- return rc;
-
- return 0;
-}
-
-static __exit void cxl_mem_exit(void)
-{
- pci_unregister_driver(&cxl_mem_driver);
-}
-
MODULE_LICENSE("GPL v2");
-module_init(cxl_mem_init);
-module_exit(cxl_mem_exit);
+module_pci_driver(cxl_mem_driver);
MODULE_IMPORT_NS(CXL);