drm/client: Do not acquire module reference
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 2 Nov 2023 13:08:06 +0000 (14:08 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Wed, 15 Nov 2023 12:51:38 +0000 (13:51 +0100)
commit312292a4ee19dddcbc7cf58349596b6a7e39fcd0
tree5afdfae14c13c728a567c92df1d42e7df857f3b8
parentf740f031cce7703a966ad0279d0f15973d61df16
drm/client: Do not acquire module reference

Do not acquire a reference on the module that provides a client's
callback functions in drm_client_init(). The additional reference
prevents the user from unloading the callback functions' module and
thus creating dangling pointers.

This is only necessary if there is no direct dependency between the
caller of drm_client_init() and the provider of the callbacks in
struct drm_client_funcs. If this case ever existed, it has been
removed from the DRM code. Callers of drm_client_init() also provide
the callback implementation. The lifetime of the clients is tied to
the dependency chain's outer-most module, which is the hardware's
DRM driver. Before client helpers could be unloaded, the driver module
would have to be unloaded, which also unregisters all clients.

Driver modules that set up DRM clients can now be unloaded.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231102131056.7256-2-tzimmermann@suse.de
drivers/gpu/drm/drm_client.c