[PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly

Thomas Zimmermann tzimmermann at suse.de
Mon May 20 08:33:40 UTC 2019


Hi

Am 20.05.19 um 10:21 schrieb Daniel Vetter:
...
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index fc3d34a8ea5b..ae2db31eeba7 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1660,7 +1660,6 @@ MODULE_PARM_DESC(lockless_register_fb,
>  static int do_register_framebuffer(struct fb_info *fb_info)
>  {
>  	int i, ret;
> -	struct fb_event event;
>  	struct fb_videomode mode;
>  
>  	if (fb_check_foreignness(fb_info))
> @@ -1723,7 +1722,6 @@ static int do_register_framebuffer(struct fb_info *fb_info)
>  	fb_add_videomode(&mode, &fb_info->modelist);
>  	registered_fb[i] = fb_info;
>  
> -	event.info = fb_info;
>  	if (!lockless_register_fb)
>  		console_lock();
>  	else
> @@ -1732,9 +1730,8 @@ static int do_register_framebuffer(struct fb_info *fb_info)
>  		ret = -ENODEV;
>  		goto unlock_console;
>  	}
> -	ret = 0;
>  
> -	fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
> +	ret = fbcon_fb_registered(fb_info);

What about backlight drivers? [1] Apparently these also use the
notifiers. [2] From my understanding, backlight drivers would stop
working with this change.

Best regards
Thomas

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/video/backlight
[2]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/video/backlight/backlight.c#n40

>  	unlock_fb_info(fb_info);
>  unlock_console:
>  	if (!lockless_register_fb)
> @@ -1771,7 +1768,6 @@ static int __unlink_framebuffer(struct fb_info *fb_info);
>  
>  static int do_unregister_framebuffer(struct fb_info *fb_info)
>  {
> -	struct fb_event event;
>  	int ret;
>  
>  	ret = unbind_console(fb_info);
> @@ -1789,9 +1785,8 @@ static int do_unregister_framebuffer(struct fb_info *fb_info)
>  	registered_fb[fb_info->node] = NULL;
>  	num_registered_fb--;
>  	fb_cleanup_device(fb_info);
> -	event.info = fb_info;
>  	console_lock();
> -	fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
> +	fbcon_fb_unregistered(fb_info);
>  	console_unlock();
>  
>  	/* this may free fb info */
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index f52ef0ad6781..701abaf79c87 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -136,10 +136,6 @@ struct fb_cursor_user {
>  #define FB_EVENT_RESUME			0x03
>  /*      An entry from the modelist was removed */
>  #define FB_EVENT_MODE_DELETE            0x04
> -/*      A driver registered itself */
> -#define FB_EVENT_FB_REGISTERED          0x05
> -/*      A driver unregistered itself */
> -#define FB_EVENT_FB_UNREGISTERED        0x06
>  /*      CONSOLE-SPECIFIC: get console to framebuffer mapping */
>  #define FB_EVENT_GET_CONSOLE_MAP        0x07
>  /*      CONSOLE-SPECIFIC: set console to framebuffer mapping */
> diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
> index f68a7db14165..94a71e9e1257 100644
> --- a/include/linux/fbcon.h
> +++ b/include/linux/fbcon.h
> @@ -4,9 +4,13 @@
>  #ifdef CONFIG_FRAMEBUFFER_CONSOLE
>  void __init fb_console_init(void);
>  void __exit fb_console_exit(void);
> +int fbcon_fb_registered(struct fb_info *info);
> +void fbcon_fb_unregistered(struct fb_info *info);
>  #else
>  static inline void fb_console_init(void) {}
>  static inline void fb_console_exit(void) {}
> +static inline int fbcon_fb_registered(struct fb_info *info) { return 0; }
> +static inline void fbcon_fb_unregistered(struct fb_info *info) {}
>  #endif
>  
>  #endif /* _LINUX_FBCON_H */
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190520/e382247d/attachment.sig>


More information about the dri-devel mailing list