~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/drm/drm_module.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: MIT */
  2 
  3 #ifndef DRM_MODULE_H
  4 #define DRM_MODULE_H
  5 
  6 #include <linux/pci.h>
  7 #include <linux/platform_device.h>
  8 
  9 #include <drm/drm_drv.h>
 10 
 11 /**
 12  * DOC: overview
 13  *
 14  * This library provides helpers registering DRM drivers during module
 15  * initialization and shutdown. The provided helpers act like bus-specific
 16  * module helpers, such as module_pci_driver(), but respect additional
 17  * parameters that control DRM driver registration.
 18  *
 19  * Below is an example of initializing a DRM driver for a device on the
 20  * PCI bus.
 21  *
 22  * .. code-block:: c
 23  *
 24  *      struct pci_driver my_pci_drv = {
 25  *      };
 26  *
 27  *      drm_module_pci_driver(my_pci_drv);
 28  *
 29  * The generated code will test if DRM drivers are enabled and register
 30  * the PCI driver my_pci_drv. For more complex module initialization, you
 31  * can still use module_init() and module_exit() in your driver.
 32  */
 33 
 34 /*
 35  * PCI drivers
 36  */
 37 
 38 static inline int __init drm_pci_register_driver(struct pci_driver *pci_drv)
 39 {
 40         if (drm_firmware_drivers_only())
 41                 return -ENODEV;
 42 
 43         return pci_register_driver(pci_drv);
 44 }
 45 
 46 /**
 47  * drm_module_pci_driver - Register a DRM driver for PCI-based devices
 48  * @__pci_drv: the PCI driver structure
 49  *
 50  * Registers a DRM driver for devices on the PCI bus. The helper
 51  * macro behaves like module_pci_driver() but tests the state of
 52  * drm_firmware_drivers_only(). For more complex module initialization,
 53  * use module_init() and module_exit() directly.
 54  *
 55  * Each module may only use this macro once. Calling it replaces
 56  * module_init() and module_exit().
 57  */
 58 #define drm_module_pci_driver(__pci_drv) \
 59         module_driver(__pci_drv, drm_pci_register_driver, pci_unregister_driver)
 60 
 61 static inline int __init
 62 drm_pci_register_driver_if_modeset(struct pci_driver *pci_drv, int modeset)
 63 {
 64         if (drm_firmware_drivers_only() && modeset == -1)
 65                 return -ENODEV;
 66         if (modeset == 0)
 67                 return -ENODEV;
 68 
 69         return pci_register_driver(pci_drv);
 70 }
 71 
 72 static inline void __exit
 73 drm_pci_unregister_driver_if_modeset(struct pci_driver *pci_drv, int modeset)
 74 {
 75         pci_unregister_driver(pci_drv);
 76 }
 77 
 78 /**
 79  * drm_module_pci_driver_if_modeset - Register a DRM driver for PCI-based devices
 80  * @__pci_drv: the PCI driver structure
 81  * @__modeset: an additional parameter that disables the driver
 82  *
 83  * This macro is deprecated and only provided for existing drivers. For
 84  * new drivers, use drm_module_pci_driver().
 85  *
 86  * Registers a DRM driver for devices on the PCI bus. The helper macro
 87  * behaves like drm_module_pci_driver() with an additional driver-specific
 88  * flag. If __modeset is 0, the driver has been disabled, if __modeset is
 89  * -1 the driver state depends on the global DRM state. For all other
 90  * values, the PCI driver has been enabled. The default should be -1.
 91  */
 92 #define drm_module_pci_driver_if_modeset(__pci_drv, __modeset) \
 93         module_driver(__pci_drv, drm_pci_register_driver_if_modeset, \
 94                       drm_pci_unregister_driver_if_modeset, __modeset)
 95 
 96 /*
 97  * Platform drivers
 98  */
 99 
100 static inline int __init
101 drm_platform_driver_register(struct platform_driver *platform_drv)
102 {
103         if (drm_firmware_drivers_only())
104                 return -ENODEV;
105 
106         return platform_driver_register(platform_drv);
107 }
108 
109 /**
110  * drm_module_platform_driver - Register a DRM driver for platform devices
111  * @__platform_drv: the platform driver structure
112  *
113  * Registers a DRM driver for devices on the platform bus. The helper
114  * macro behaves like module_platform_driver() but tests the state of
115  * drm_firmware_drivers_only(). For more complex module initialization,
116  * use module_init() and module_exit() directly.
117  *
118  * Each module may only use this macro once. Calling it replaces
119  * module_init() and module_exit().
120  */
121 #define drm_module_platform_driver(__platform_drv) \
122         module_driver(__platform_drv, drm_platform_driver_register, \
123                       platform_driver_unregister)
124 
125 #endif
126 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php