On 12/15/21 10:10, Thomas Zimmermann wrote:
[snip]
An extra pointer sounds indeed like over-engineering. If we take ast for example, I'd just do something like this:
static ast_pci_register_driver(struct pci_driver *pci) { if (drm_firmware_drivers_only() && ast_modeset == -1) return -ENODEV; if (ast_modeset == 0) return -ENODEV;
return pci_register_driver(pci); }
module_driver(&ast_pci_driver, ast_pci_register_driver, pci_unregister_driver)
That removes some of the boiler-plate module code without changing the driver's behavior.
Agreed that would be a nice cleanup and could allow to for example get rid of the following module exit function that's just a wrapper:
static void __exit ast_exit(void) { pci_unregister_driver(&ast_pci_driver); }
But I think these cleanups are out of scope for this series and could be done as a follow-up. Since the drm_firmware_drivers_only() check would be needed in the module init function anyways.
Best regards Thomas
Best regards,