Re: [PATCH v3 03/10] drm/bochs: Replace module-init boiler-plate code with DRM helpers

2021-12-22 Thread Javier Martinez Canillas
Hello Gerd,

On 12/22/21 11:21, Gerd Hoffmann wrote:
> On Wed, Dec 22, 2021 at 09:28:24AM +0100, Javier Martinez Canillas wrote:
>> -static int __init bochs_init(void)
>> -{
>> -if (drm_firmware_drivers_only() && bochs_modeset == -1)
>> -return -EINVAL;
> 
> Also cleanup bochs_modeset?  I guess its not used any more after this
> patch ...
>

That's still used. It is passed as an argument to the macro:

drm_module_pci_driver_if_modeset(bochs_pci_driver, bochs_modeset);

Best regards,
-- 
Javier Martinez Canillas
Linux Engineering
Red Hat



Re: [PATCH v3 03/10] drm/bochs: Replace module-init boiler-plate code with DRM helpers

2021-12-22 Thread Gerd Hoffmann
On Wed, Dec 22, 2021 at 09:28:24AM +0100, Javier Martinez Canillas wrote:
> -static int __init bochs_init(void)
> -{
> - if (drm_firmware_drivers_only() && bochs_modeset == -1)
> - return -EINVAL;

Also cleanup bochs_modeset?  I guess its not used any more after this
patch ...

take care,
  Gerd



[PATCH v3 03/10] drm/bochs: Replace module-init boiler-plate code with DRM helpers

2021-12-22 Thread Javier Martinez Canillas
From: Thomas Zimmermann 

Remove custom bochs_init() and bochs_exit() functions and initialize
the module with DRM module helpers.

Signed-off-by: Thomas Zimmermann 
Signed-off-by: Javier Martinez Canillas 
---

(no changes since v1)

 drivers/gpu/drm/tiny/bochs.c | 20 ++--
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
index fc26a1ce11ee..ed971c8bb446 100644
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -716,24 +717,7 @@ static struct pci_driver bochs_pci_driver = {
 /* -- */
 /* module init/exit   */
 
-static int __init bochs_init(void)
-{
-   if (drm_firmware_drivers_only() && bochs_modeset == -1)
-   return -EINVAL;
-
-   if (bochs_modeset == 0)
-   return -EINVAL;
-
-   return pci_register_driver(_pci_driver);
-}
-
-static void __exit bochs_exit(void)
-{
-   pci_unregister_driver(_pci_driver);
-}
-
-module_init(bochs_init);
-module_exit(bochs_exit);
+drm_module_pci_driver_if_modeset(bochs_pci_driver, bochs_modeset);
 
 MODULE_DEVICE_TABLE(pci, bochs_pci_tbl);
 MODULE_AUTHOR("Gerd Hoffmann ");
-- 
2.33.1