Hi Javier,
On Thu, Dec 16, 2021 at 01:13:56AM +0100, Javier Martinez Canillas wrote:
Hello Laurent,
On 12/16/21 00:35, Laurent Pinchart wrote:
[snip]
I've built tested with 'make allmodconfig && make M=drivers/gpu/drm/', but only booted in a few devices with and without nomodeset in the cmdline. So testing and reviewing for all the drivers would be highly appreciated.
The fact that the series is so big makes me think it would be better to handle this in the DRM core. Is there any way we could do so ? Otherwise we'll chase this issue forever in new drivers, and will be plagued with cargo cult problems.
Yes, what Thomas suggested is to add a set of drm_module_{pci,platform}_driver() macros in include/drm/drm_drv.h, that will just check whether the driver should be registered or not and call the {pci,platform}_register_driver() functions.
That way the change in the drivers would just be something like the following:
-module_platform_driver(malidp_platform_driver); +drm_module_platform_driver(malidp_platform_driver);
There are some drivers that still need a custom module init functions for various reasons (e.g: register a set of devices/drivers, need to be a late init call, etc) but at least for most drivers this should be handled transparently as long as they use these drm_*_register_driver() macros.
Another option could be to return an error from drm_dev_alloc(). That may avoid changes in the drivers.
So just ignore this series and I'll post a v2 soon.