Introduce a device-managed variant of register_framebuffer() which
automatically unregisters the framebuffer on device destruction.
This can simplify the error handling and resource management in drivers.
Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
This is a fixed resend of [0], which was broken.
Thanks to Bert [1], and Chaitanya Kumar [2]
for reporting the issue.
[0] https://lore.kernel.org/lkml/20240827-efifb-sysfs-v1-3-c9cc3e052180@xxxxxxxxxxxxxx/
[1] https://lore.kernel.org/lkml/20240829224124.2978-1-spasswolf@xxxxxx/
[2] https://lore.kernel.org/lkml/SJ1PR11MB612925C1C533C09F8F62F7CBB9972@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
Helge, I didn't document the function devm_unregister_framebuffer() as
it is only an internal helper and will ever only used by one user,
similar to other helpers in fbmem.c.