drm/cirrus: Replace module-init boiler-plate code with DRM helpers
authorThomas Zimmermann <tzimmermann@suse.de>
Wed, 22 Dec 2021 08:28:25 +0000 (09:28 +0100)
committerJavier Martinez Canillas <javierm@redhat.com>
Wed, 19 Jan 2022 17:40:06 +0000 (18:40 +0100)
Remove custom cirrus_init() and cirrus_exit() functions and initialize
the module with DRM module helpers.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211222082831.196562-5-javierm@redhat.com
drivers/gpu/drm/tiny/cirrus.c

index c95d9ff7d600659323bf6a772e22da47bd3fbba2..ecf2475d0f168c20f8fc6b2d7c949ed87cca76c9 100644 (file)
@@ -39,6 +39,7 @@
 #include <drm/drm_ioctl.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_modeset_helper_vtables.h>
+#include <drm/drm_module.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
 
@@ -633,21 +634,7 @@ static struct pci_driver cirrus_pci_driver = {
        .remove = cirrus_pci_remove,
 };
 
-static int __init cirrus_init(void)
-{
-       if (drm_firmware_drivers_only())
-               return -EINVAL;
-
-       return pci_register_driver(&cirrus_pci_driver);
-}
-
-static void __exit cirrus_exit(void)
-{
-       pci_unregister_driver(&cirrus_pci_driver);
-}
-
-module_init(cirrus_init);
-module_exit(cirrus_exit);
+drm_module_pci_driver(cirrus_pci_driver)
 
 MODULE_DEVICE_TABLE(pci, pciidlist);
 MODULE_LICENSE("GPL");