linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 07/33] fbdev/aty128fb: Remove dead code
       [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
@ 2019-05-20  8:21 ` Daniel Vetter
  2019-05-20  8:21 ` [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly Daniel Vetter
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20  8:21 UTC (permalink / raw)
  To: DRI Development
  Cc: Intel Graphics Development, LKML, Daniel Vetter, Daniel Vetter,
	Paul Mackerras, linux-fbdev

Motivated because it contains a struct display, which is a fbcon
internal data structure that I want to rename. It seems to have been
formerly used in drivers, but that's very long time ago.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/fbdev/aty/aty128fb.c | 64 ------------------------------
 1 file changed, 64 deletions(-)

diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c
index 6cc46867ff57..c022ad7a49c2 100644
--- a/drivers/video/fbdev/aty/aty128fb.c
+++ b/drivers/video/fbdev/aty/aty128fb.c
@@ -2349,70 +2349,6 @@ static int aty128fb_ioctl(struct fb_info *info, u_int cmd, u_long arg)
 	return -EINVAL;
 }
 
-#if 0
-    /*
-     *  Accelerated functions
-     */
-
-static inline void aty128_rectcopy(int srcx, int srcy, int dstx, int dsty,
-				   u_int width, u_int height,
-				   struct fb_info_aty128 *par)
-{
-	u32 save_dp_datatype, save_dp_cntl, dstval;
-
-	if (!width || !height)
-		return;
-
-	dstval = depth_to_dst(par->current_par.crtc.depth);
-	if (dstval = DST_24BPP) {
-		srcx *= 3;
-		dstx *= 3;
-		width *= 3;
-	} else if (dstval = -EINVAL) {
-		printk("aty128fb: invalid depth or RGBA\n");
-		return;
-	}
-
-	wait_for_fifo(2, par);
-	save_dp_datatype = aty_ld_le32(DP_DATATYPE);
-	save_dp_cntl     = aty_ld_le32(DP_CNTL);
-
-	wait_for_fifo(6, par);
-	aty_st_le32(SRC_Y_X, (srcy << 16) | srcx);
-	aty_st_le32(DP_MIX, ROP3_SRCCOPY | DP_SRC_RECT);
-	aty_st_le32(DP_CNTL, DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM);
-	aty_st_le32(DP_DATATYPE, save_dp_datatype | dstval | SRC_DSTCOLOR);
-
-	aty_st_le32(DST_Y_X, (dsty << 16) | dstx);
-	aty_st_le32(DST_HEIGHT_WIDTH, (height << 16) | width);
-
-	par->blitter_may_be_busy = 1;
-
-	wait_for_fifo(2, par);
-	aty_st_le32(DP_DATATYPE, save_dp_datatype);
-	aty_st_le32(DP_CNTL, save_dp_cntl);
-}
-
-
-    /*
-     * Text mode accelerated functions
-     */
-
-static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy,
-			       int dx, int height, int width)
-{
-	sx     *= fontwidth(p);
-	sy     *= fontheight(p);
-	dx     *= fontwidth(p);
-	dy     *= fontheight(p);
-	width  *= fontwidth(p);
-	height *= fontheight(p);
-
-	aty128_rectcopy(sx, sy, dx, dy, width, height,
-			(struct fb_info_aty128 *)p->fb_info);
-}
-#endif /* 0 */
-
 static void aty128_set_suspend(struct aty128fb_par *par, int suspend)
 {
 	u32	pmgt;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly
       [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
  2019-05-20  8:21 ` [PATCH 07/33] fbdev/aty128fb: Remove dead code Daniel Vetter
@ 2019-05-20  8:21 ` Daniel Vetter
  2019-05-20  8:33   ` Thomas Zimmermann
  2019-05-20 17:08   ` Sam Ravnborg
  2019-05-20  8:21 ` [PATCH 16/33] fbdev: lock_fb_info cannot fail Daniel Vetter
                   ` (8 subsequent siblings)
  10 siblings, 2 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20  8:21 UTC (permalink / raw)
  To: DRI Development
  Cc: Intel Graphics Development, LKML, Daniel Vetter, Daniel Vetter,
	Bartlomiej Zolnierkiewicz, Hans de Goede, Greg Kroah-Hartman,
	Noralf Trønnes, Yisheng Xie, Peter Rosin,
	Michał Mirosław, Thomas Zimmermann, Mikulas Patocka,
	linux-fbdev

With

commit 6104c37094e729f3d4ce65797002112735d49cd1
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Tue Aug 1 17:32:07 2017 +0200

    fbcon: Make fbcon a built-time depency for fbdev

we have a static dependency between fbcon and fbdev, and we can
replace the indirection through the notifier chain with a function
call.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Yisheng Xie <ysxie@foxmail.com>
Cc: Peter Rosin <peda@axentia.se>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/fbdev/core/fbcon.c | 14 +++-----------
 drivers/video/fbdev/core/fbmem.c |  9 ++-------
 include/linux/fb.h               |  4 ----
 include/linux/fbcon.h            |  4 ++++
 4 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index a1be589b692f..95af6bd783e8 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3115,14 +3115,14 @@ static int fbcon_fb_unbind(int idx)
 }
 
 /* called with console_lock held */
-static int fbcon_fb_unregistered(struct fb_info *info)
+void fbcon_fb_unregistered(struct fb_info *info)
 {
 	int i, idx;
 
 	WARN_CONSOLE_UNLOCKED();
 
 	if (deferred_takeover)
-		return 0;
+		return;
 
 	idx = info->node;
 	for (i = first_fb_vc; i <= last_fb_vc; i++) {
@@ -3151,8 +3151,6 @@ static int fbcon_fb_unregistered(struct fb_info *info)
 
 	if (!num_registered_fb)
 		do_unregister_con_driver(&fb_con);
-
-	return 0;
 }
 
 /* called with console_lock held */
@@ -3211,7 +3209,7 @@ static inline void fbcon_select_primary(struct fb_info *info)
 #endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */
 
 /* called with console_lock held */
-static int fbcon_fb_registered(struct fb_info *info)
+int fbcon_fb_registered(struct fb_info *info)
 {
 	int ret = 0, i, idx;
 
@@ -3355,12 +3353,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 		idx = info->node;
 		ret = fbcon_fb_unbind(idx);
 		break;
-	case FB_EVENT_FB_REGISTERED:
-		ret = fbcon_fb_registered(info);
-		break;
-	case FB_EVENT_FB_UNREGISTERED:
-		ret = fbcon_fb_unregistered(info);
-		break;
 	case FB_EVENT_SET_CONSOLE_MAP:
 		/* called with console lock held */
 		con2fb = event->data;
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);
 	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 */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 16/33] fbdev: lock_fb_info cannot fail
       [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
  2019-05-20  8:21 ` [PATCH 07/33] fbdev/aty128fb: Remove dead code Daniel Vetter
  2019-05-20  8:21 ` [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly Daniel Vetter
@ 2019-05-20  8:21 ` Daniel Vetter
  2019-05-20  8:22 ` [PATCH 17/33] fbcon: call fbcon_fb_bind directly Daniel Vetter
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20  8:21 UTC (permalink / raw)
  To: DRI Development
  Cc: Intel Graphics Development, LKML, Daniel Vetter, Daniel Vetter,
	Bartlomiej Zolnierkiewicz, Hans de Goede, Yisheng Xie,
	Sergey Senozhatsky, Noralf Trønnes, Peter Rosin,
	Michał Mirosław, Mikulas Patocka, Gustavo A. R. Silva,
	linux-fbdev

Ever since

commit c47747fde931c02455683bd00ea43eaa62f35b0e
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Wed May 11 14:58:34 2011 -0700

    fbmem: make read/write/ioctl use the frame buffer at open time

fbdev has gained proper refcounting for the fbinfo attached to any
open files, which means that the backing driver (stored in
fb_info->fbops) cannot untimely disappear anymore.

The only thing that can happen is that the entire device just outright
disappears and gets unregistered, but file_fb_info does check for
that. Except that it's racy - it only checks once at the start of a
file_ops, there's no guarantee that the underlying fbdev won't
untimely disappear. Aside: A proper way to fix that race is probably
to replicate the srcu trickery we've rolled out in drm.

But given that this race has existed since forever it's probably not
one we need to fix right away. do_unregister_framebuffer also nowhere
clears fb_info->fbops, hence the check in lock_fb_info can't possible
catch a disappearing fbdev later on.

Long story short: Ever since the above commit the fb_info->fbops
checks have essentially become dead code. Remove this all.

Aside from the file_ops callbacks, and stuff called from there
there's only register/unregister code left. If that goes wrong a driver
managed to register/unregister a device instance twice or in the wrong
order.  That's just a driver bug.

v2:
- fb_mmap had an open-coded version of the fbinfo->fops check, because
  it doesn't need the fbinfo->lock. Delete that too.
- Use the wrapper function in fb_open/release now, since no difference
  anymore.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Yisheng Xie <ysxie@foxmail.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Peter Rosin <peda@axentia.se>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/fbdev/core/fbcmap.c |  6 +--
 drivers/video/fbdev/core/fbcon.c  |  3 +-
 drivers/video/fbdev/core/fbmem.c  | 73 +++++++------------------------
 include/linux/fb.h                |  5 ++-
 4 files changed, 23 insertions(+), 64 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcmap.c b/drivers/video/fbdev/core/fbcmap.c
index 68a113594808..aac710b2f95f 100644
--- a/drivers/video/fbdev/core/fbcmap.c
+++ b/drivers/video/fbdev/core/fbcmap.c
@@ -283,11 +283,7 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info)
 		goto out;
 	}
 	umap.start = cmap->start;
-	if (!lock_fb_info(info)) {
-		rc = -ENODEV;
-		goto out;
-	}
-
+	lock_fb_info(info);
 	rc = fb_set_cmap(&umap, info);
 	unlock_fb_info(info);
 out:
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 95af6bd783e8..35443add7f7e 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2360,8 +2360,7 @@ static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info,
 	}
 
 
-	if (!lock_fb_info(info))
-		return;
+	lock_fb_info(info);
 	event.info = info;
 	event.data = &blank;
 	fb_notifier_call_chain(FB_EVENT_CONBLANK, &event);
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index ae2db31eeba7..1987aba4f5a2 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -80,17 +80,6 @@ static void put_fb_info(struct fb_info *fb_info)
 		fb_info->fbops->fb_destroy(fb_info);
 }
 
-int lock_fb_info(struct fb_info *info)
-{
-	mutex_lock(&info->lock);
-	if (!info->fbops) {
-		mutex_unlock(&info->lock);
-		return 0;
-	}
-	return 1;
-}
-EXPORT_SYMBOL(lock_fb_info);
-
 /*
  * Helpers
  */
@@ -1121,8 +1110,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 
 	switch (cmd) {
 	case FBIOGET_VSCREENINFO:
-		if (!lock_fb_info(info))
-			return -ENODEV;
+		lock_fb_info(info);
 		var = info->var;
 		unlock_fb_info(info);
 
@@ -1132,10 +1120,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 		if (copy_from_user(&var, argp, sizeof(var)))
 			return -EFAULT;
 		console_lock();
-		if (!lock_fb_info(info)) {
-			console_unlock();
-			return -ENODEV;
-		}
+		lock_fb_info(info);
 		info->flags |= FBINFO_MISC_USEREVENT;
 		ret = fb_set_var(info, &var);
 		info->flags &= ~FBINFO_MISC_USEREVENT;
@@ -1145,8 +1130,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 			ret = -EFAULT;
 		break;
 	case FBIOGET_FSCREENINFO:
-		if (!lock_fb_info(info))
-			return -ENODEV;
+		lock_fb_info(info);
 		fix = info->fix;
 		if (info->flags & FBINFO_HIDE_SMEM_START)
 			fix.smem_start = 0;
@@ -1162,8 +1146,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 	case FBIOGETCMAP:
 		if (copy_from_user(&cmap, argp, sizeof(cmap)))
 			return -EFAULT;
-		if (!lock_fb_info(info))
-			return -ENODEV;
+		lock_fb_info(info);
 		cmap_from = info->cmap;
 		unlock_fb_info(info);
 		ret = fb_cmap_to_user(&cmap_from, &cmap);
@@ -1172,10 +1155,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 		if (copy_from_user(&var, argp, sizeof(var)))
 			return -EFAULT;
 		console_lock();
-		if (!lock_fb_info(info)) {
-			console_unlock();
-			return -ENODEV;
-		}
+		lock_fb_info(info);
 		ret = fb_pan_display(info, &var);
 		unlock_fb_info(info);
 		console_unlock();
@@ -1192,8 +1172,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 			return -EINVAL;
 		con2fb.framebuffer = -1;
 		event.data = &con2fb;
-		if (!lock_fb_info(info))
-			return -ENODEV;
+		lock_fb_info(info);
 		event.info = info;
 		fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event);
 		unlock_fb_info(info);
@@ -1214,10 +1193,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 		}
 		event.data = &con2fb;
 		console_lock();
-		if (!lock_fb_info(info)) {
-			console_unlock();
-			return -ENODEV;
-		}
+		lock_fb_info(info);
 		event.info = info;
 		ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP, &event);
 		unlock_fb_info(info);
@@ -1225,10 +1201,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 		break;
 	case FBIOBLANK:
 		console_lock();
-		if (!lock_fb_info(info)) {
-			console_unlock();
-			return -ENODEV;
-		}
+		lock_fb_info(info);
 		info->flags |= FBINFO_MISC_USEREVENT;
 		ret = fb_blank(info, arg);
 		info->flags &= ~FBINFO_MISC_USEREVENT;
@@ -1236,8 +1209,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 		console_unlock();
 		break;
 	default:
-		if (!lock_fb_info(info))
-			return -ENODEV;
+		lock_fb_info(info);
 		fb = info->fbops;
 		if (fb->fb_ioctl)
 			ret = fb->fb_ioctl(info, cmd, arg);
@@ -1357,8 +1329,7 @@ static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd,
 {
 	struct fb_fix_screeninfo fix;
 
-	if (!lock_fb_info(info))
-		return -ENODEV;
+	lock_fb_info(info);
 	fix = info->fix;
 	if (info->flags & FBINFO_HIDE_SMEM_START)
 		fix.smem_start = 0;
@@ -1418,8 +1389,6 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
 	if (!info)
 		return -ENODEV;
 	fb = info->fbops;
-	if (!fb)
-		return -ENODEV;
 	mutex_lock(&info->mm_lock);
 	if (fb->fb_mmap) {
 		int res;
@@ -1483,7 +1452,7 @@ __releases(&info->lock)
 	if (IS_ERR(info))
 		return PTR_ERR(info);
 
-	mutex_lock(&info->lock);
+	lock_fb_info(info);
 	if (!try_module_get(info->fbops->owner)) {
 		res = -ENODEV;
 		goto out;
@@ -1499,7 +1468,7 @@ __releases(&info->lock)
 		fb_deferred_io_open(info, inode, file);
 #endif
 out:
-	mutex_unlock(&info->lock);
+	unlock_fb_info(info);
 	if (res)
 		put_fb_info(info);
 	return res;
@@ -1512,11 +1481,11 @@ __releases(&info->lock)
 {
 	struct fb_info * const info = file->private_data;
 
-	mutex_lock(&info->lock);
+	lock_fb_info(info);
 	if (info->fbops->fb_release)
 		info->fbops->fb_release(info,1);
 	module_put(info->fbops->owner);
-	mutex_unlock(&info->lock);
+	unlock_fb_info(info);
 	put_fb_info(info);
 	return 0;
 }
@@ -1726,14 +1695,10 @@ static int do_register_framebuffer(struct fb_info *fb_info)
 		console_lock();
 	else
 		atomic_inc(&ignore_console_lock_warning);
-	if (!lock_fb_info(fb_info)) {
-		ret = -ENODEV;
-		goto unlock_console;
-	}
-
+	lock_fb_info(fb_info);
 	ret = fbcon_fb_registered(fb_info);
 	unlock_fb_info(fb_info);
-unlock_console:
+
 	if (!lockless_register_fb)
 		console_unlock();
 	else
@@ -1751,11 +1716,7 @@ static int unbind_console(struct fb_info *fb_info)
 		return -EINVAL;
 
 	console_lock();
-	if (!lock_fb_info(fb_info)) {
-		console_unlock();
-		return -ENODEV;
-	}
-
+	lock_fb_info(fb_info);
 	event.info = fb_info;
 	ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);
 	unlock_fb_info(fb_info);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 701abaf79c87..fd60207c0685 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -656,7 +656,10 @@ extern struct class *fb_class;
 	for (i = 0; i < FB_MAX; i++)		\
 		if (!registered_fb[i]) {} else
 
-extern int lock_fb_info(struct fb_info *info);
+static inline void lock_fb_info(struct fb_info *info)
+{
+	mutex_lock(&info->lock);
+}
 
 static inline void unlock_fb_info(struct fb_info *info)
 {
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 17/33] fbcon: call fbcon_fb_bind directly
       [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
                   ` (2 preceding siblings ...)
  2019-05-20  8:21 ` [PATCH 16/33] fbdev: lock_fb_info cannot fail Daniel Vetter
@ 2019-05-20  8:22 ` Daniel Vetter
  2019-05-20  8:22 ` [PATCH 18/33] fbdev: make unregister/unlink functions not fail Daniel Vetter
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20  8:22 UTC (permalink / raw)
  To: DRI Development
  Cc: linux-fbdev, Sergey Senozhatsky, Kees Cook,
	Bartlomiej Zolnierkiewicz, Daniel Vetter,
	Intel Graphics Development, LKML, Michał Mirosław,
	Yisheng Xie, Mikulas Patocka, Thomas Zimmermann, Daniel Vetter,
	Peter Rosin, Konstantin Khorenko

Also remove the error return value. That's all errors for either
driver bugs (trying to unbind something that isn't bound), or errors
of the new driver that will take over.

There's nothing the outgoing driver can do about this anyway, so
switch over to void.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Peter Rosin <peda@axentia.se>
Cc: Kees Cook <keescook@chromium.org>
Cc: Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: Yisheng Xie <ysxie@foxmail.com>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/fbdev/core/fbcon.c | 24 +++++++-----------------
 drivers/video/fbdev/core/fbmem.c |  7 ++-----
 include/linux/fb.h               |  2 --
 include/linux/fbcon.h            |  2 ++
 4 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 35443add7f7e..a8d12914b559 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3042,7 +3042,7 @@ static int fbcon_mode_deleted(struct fb_info *info,
 }
 
 #ifdef CONFIG_VT_HW_CONSOLE_BINDING
-static int fbcon_unbind(void)
+static void fbcon_unbind(void)
 {
 	int ret;
 
@@ -3051,25 +3051,21 @@ static int fbcon_unbind(void)
 
 	if (!ret)
 		fbcon_has_console_bind = 0;
-
-	return ret;
 }
 #else
-static inline int fbcon_unbind(void)
-{
-	return -EINVAL;
-}
+static inline void fbcon_unbind(void) {}
 #endif /* CONFIG_VT_HW_CONSOLE_BINDING */
 
 /* called with console_lock held */
-static int fbcon_fb_unbind(int idx)
+void fbcon_fb_unbind(struct fb_info *info)
 {
 	int i, new_idx = -1, ret = 0;
+	int idx = info->node;
 
 	WARN_CONSOLE_UNLOCKED();
 
 	if (!fbcon_has_console_bind)
-		return 0;
+		return;
 
 	for (i = first_fb_vc; i <= last_fb_vc; i++) {
 		if (con2fb_map[i] != idx &&
@@ -3102,15 +3098,13 @@ static int fbcon_fb_unbind(int idx)
 								     idx, 0);
 					if (ret) {
 						con2fb_map[i] = idx;
-						return ret;
+						return;
 					}
 				}
 			}
 		}
-		ret = fbcon_unbind();
+		fbcon_unbind();
 	}
-
-	return ret;
 }
 
 /* called with console_lock held */
@@ -3348,10 +3342,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 		mode = event->data;
 		ret = fbcon_mode_deleted(info, mode);
 		break;
-	case FB_EVENT_FB_UNBIND:
-		idx = info->node;
-		ret = fbcon_fb_unbind(idx);
-		break;
 	case FB_EVENT_SET_CONSOLE_MAP:
 		/* called with console lock held */
 		con2fb = event->data;
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 1987aba4f5a2..156523cc48bf 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1708,8 +1708,6 @@ static int do_register_framebuffer(struct fb_info *fb_info)
 
 static int unbind_console(struct fb_info *fb_info)
 {
-	struct fb_event event;
-	int ret;
 	int i = fb_info->node;
 
 	if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)
@@ -1717,12 +1715,11 @@ static int unbind_console(struct fb_info *fb_info)
 
 	console_lock();
 	lock_fb_info(fb_info);
-	event.info = fb_info;
-	ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);
+	fbcon_fb_unbind(fb_info);
 	unlock_fb_info(fb_info);
 	console_unlock();
 
-	return ret;
+	return 0;
 }
 
 static int __unlink_framebuffer(struct fb_info *fb_info);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index fd60207c0685..38fae1678939 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -151,8 +151,6 @@ struct fb_cursor_user {
 #define FB_EVENT_CONBLANK               0x0C
 /*      Get drawing requirements        */
 #define FB_EVENT_GET_REQ                0x0D
-/*      Unbind from the console if possible */
-#define FB_EVENT_FB_UNBIND              0x0E
 /*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
 #define FB_EVENT_REMAP_ALL_CONSOLE      0x0F
 /*      A hardware display blank early change occurred */
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
index 94a71e9e1257..38d44fdb6d14 100644
--- a/include/linux/fbcon.h
+++ b/include/linux/fbcon.h
@@ -6,11 +6,13 @@ 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);
+void fbcon_fb_unbind(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) {}
+static inline void fbcon_fb_unbind(struct fb_info *info) {}
 #endif
 
 #endif /* _LINUX_FBCON_H */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 18/33] fbdev: make unregister/unlink functions not fail
       [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
                   ` (3 preceding siblings ...)
  2019-05-20  8:22 ` [PATCH 17/33] fbcon: call fbcon_fb_bind directly Daniel Vetter
@ 2019-05-20  8:22 ` Daniel Vetter
  2019-05-20 19:08   ` [Intel-gfx] " kbuild test robot
                     ` (2 more replies)
  2019-05-20  8:22 ` [PATCH 21/33] fbdev: directly call fbcon_suspended/resumed Daniel Vetter
                   ` (5 subsequent siblings)
  10 siblings, 3 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20  8:22 UTC (permalink / raw)
  To: DRI Development
  Cc: linux-fbdev, Bartlomiej Zolnierkiewicz, Daniel Vetter,
	Intel Graphics Development, LKML, Michał Mirosław,
	Mikulas Patocka, Daniel Vetter, Peter Rosin

Except for driver bugs (which we'll catch with a WARN_ON) this is only
to report failures of the new driver taking over the console. There's
nothing the outgoing driver can do about that, and no one ever
bothered to actually look at these return values. So remove them all.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Peter Rosin <peda@axentia.se>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/fbdev/core/fbmem.c | 73 ++++++++++----------------------
 include/linux/fb.h               |  4 +-
 2 files changed, 25 insertions(+), 52 deletions(-)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 156523cc48bf..032506576aa0 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1590,13 +1590,13 @@ static bool fb_do_apertures_overlap(struct apertures_struct *gena,
 	return false;
 }
 
-static int do_unregister_framebuffer(struct fb_info *fb_info);
+static void do_unregister_framebuffer(struct fb_info *fb_info);
 
 #define VGA_FB_PHYS 0xA0000
-static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
-					      const char *name, bool primary)
+static void do_remove_conflicting_framebuffers(struct apertures_struct *a,
+					       const char *name, bool primary)
 {
-	int i, ret;
+	int i;
 
 	/* check all firmware fbs and kick off if the base addr overlaps */
 	for_each_registered_fb(i) {
@@ -1612,13 +1612,9 @@ static int do_remove_conflicting_framebuffers(struct apertures_struct *a,
 
 			printk(KERN_INFO "fb%d: switching to %s from %s\n",
 			       i, name, registered_fb[i]->fix.id);
-			ret = do_unregister_framebuffer(registered_fb[i]);
-			if (ret)
-				return ret;
+			do_unregister_framebuffer(registered_fb[i]);
 		}
 	}
-
-	return 0;
 }
 
 static bool lockless_register_fb;
@@ -1634,11 +1630,9 @@ static int do_register_framebuffer(struct fb_info *fb_info)
 	if (fb_check_foreignness(fb_info))
 		return -ENOSYS;
 
-	ret = do_remove_conflicting_framebuffers(fb_info->apertures,
-						 fb_info->fix.id,
-						 fb_is_primary_device(fb_info));
-	if (ret)
-		return ret;
+	do_remove_conflicting_framebuffers(fb_info->apertures,
+					   fb_info->fix.id,
+					   fb_is_primary_device(fb_info));
 
 	if (num_registered_fb = FB_MAX)
 		return -ENXIO;
@@ -1706,32 +1700,25 @@ static int do_register_framebuffer(struct fb_info *fb_info)
 	return ret;
 }
 
-static int unbind_console(struct fb_info *fb_info)
+static void unbind_console(struct fb_info *fb_info)
 {
 	int i = fb_info->node;
 
-	if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)
-		return -EINVAL;
+	if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info))
+		return;
 
 	console_lock();
 	lock_fb_info(fb_info);
 	fbcon_fb_unbind(fb_info);
 	unlock_fb_info(fb_info);
 	console_unlock();
-
-	return 0;
 }
 
-static int __unlink_framebuffer(struct fb_info *fb_info);
+static void __unlink_framebuffer(struct fb_info *fb_info);
 
-static int do_unregister_framebuffer(struct fb_info *fb_info)
+static void do_unregister_framebuffer(struct fb_info *fb_info)
 {
-	int ret;
-
-	ret = unbind_console(fb_info);
-
-	if (ret)
-		return -EINVAL;
+	unbind_console(fb_info);
 
 	pm_vt_switch_unregister(fb_info->dev);
 
@@ -1749,36 +1736,27 @@ static int do_unregister_framebuffer(struct fb_info *fb_info)
 
 	/* this may free fb info */
 	put_fb_info(fb_info);
-	return 0;
 }
 
-static int __unlink_framebuffer(struct fb_info *fb_info)
+static void __unlink_framebuffer(struct fb_info *fb_info)
 {
 	int i;
 
 	i = fb_info->node;
-	if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)
-		return -EINVAL;
+	if (WARN_ON(i < 0 || i >= FB_MAX || registered_fb[i] != fb_info))
+		return;
 
 	if (fb_info->dev) {
 		device_destroy(fb_class, MKDEV(FB_MAJOR, i));
 		fb_info->dev = NULL;
 	}
-
-	return 0;
 }
 
-int unlink_framebuffer(struct fb_info *fb_info)
+void unlink_framebuffer(struct fb_info *fb_info)
 {
-	int ret;
-
-	ret = __unlink_framebuffer(fb_info);
-	if (ret)
-		return ret;
+	__unlink_framebuffer(fb_info);
 
 	unbind_console(fb_info);
-
-	return 0;
 }
 EXPORT_SYMBOL(unlink_framebuffer);
 
@@ -1795,7 +1773,6 @@ EXPORT_SYMBOL(unlink_framebuffer);
 int remove_conflicting_framebuffers(struct apertures_struct *a,
 				    const char *name, bool primary)
 {
-	int ret;
 	bool do_free = false;
 
 	if (!a) {
@@ -1809,13 +1786,13 @@ int remove_conflicting_framebuffers(struct apertures_struct *a,
 	}
 
 	mutex_lock(&registration_lock);
-	ret = do_remove_conflicting_framebuffers(a, name, primary);
+	do_remove_conflicting_framebuffers(a, name, primary);
 	mutex_unlock(&registration_lock);
 
 	if (do_free)
 		kfree(a);
 
-	return ret;
+	return 0;
 }
 EXPORT_SYMBOL(remove_conflicting_framebuffers);
 
@@ -1891,16 +1868,12 @@ EXPORT_SYMBOL(register_framebuffer);
  *      that the driver implements fb_open() and fb_release() to
  *      check that no processes are using the device.
  */
-int
+void
 unregister_framebuffer(struct fb_info *fb_info)
 {
-	int ret;
-
 	mutex_lock(&registration_lock);
-	ret = do_unregister_framebuffer(fb_info);
+	do_unregister_framebuffer(fb_info);
 	mutex_unlock(&registration_lock);
-
-	return ret;
 }
 EXPORT_SYMBOL(unregister_framebuffer);
 
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 38fae1678939..44021e55b15c 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -627,8 +627,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
 
 /* drivers/video/fbmem.c */
 extern int register_framebuffer(struct fb_info *fb_info);
-extern int unregister_framebuffer(struct fb_info *fb_info);
-extern int unlink_framebuffer(struct fb_info *fb_info);
+extern void unregister_framebuffer(struct fb_info *fb_info);
+extern void unlink_framebuffer(struct fb_info *fb_info);
 extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id,
 					       const char *name);
 extern int remove_conflicting_framebuffers(struct apertures_struct *a,
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 21/33] fbdev: directly call fbcon_suspended/resumed
       [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
                   ` (4 preceding siblings ...)
  2019-05-20  8:22 ` [PATCH 18/33] fbdev: make unregister/unlink functions not fail Daniel Vetter
@ 2019-05-20  8:22 ` Daniel Vetter
  2019-05-20 19:24   ` kbuild test robot
  2019-05-20  8:22 ` [PATCH 22/33] fbcon: Call fbcon_mode_deleted/new_modelist directly Daniel Vetter
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20  8:22 UTC (permalink / raw)
  To: DRI Development
  Cc: Intel Graphics Development, LKML, Daniel Vetter, Daniel Vetter,
	Bartlomiej Zolnierkiewicz, Hans de Goede, Greg Kroah-Hartman,
	Prarit Bhargava, Kees Cook, Konstantin Khorenko, Yisheng Xie,
	Michał Mirosław, Peter Rosin, Mikulas Patocka,
	linux-fbdev

With the sh_mobile notifier removed we can just directly call the
fbcon code here.

v2: Remove now unused local variable.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: Yisheng Xie <ysxie@foxmail.com>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Peter Rosin <peda@axentia.se>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/fbdev/core/fbcon.c | 10 ++--------
 drivers/video/fbdev/core/fbmem.c |  7 ++-----
 include/linux/fb.h               |  8 --------
 include/linux/fbcon.h            |  4 ++++
 4 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index a8d12914b559..b056d1190788 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2915,7 +2915,7 @@ static int fbcon_set_origin(struct vc_data *vc)
 	return 0;
 }
 
-static void fbcon_suspended(struct fb_info *info)
+void fbcon_suspended(struct fb_info *info)
 {
 	struct vc_data *vc = NULL;
 	struct fbcon_ops *ops = info->fbcon_par;
@@ -2928,7 +2928,7 @@ static void fbcon_suspended(struct fb_info *info)
 	fbcon_cursor(vc, CM_ERASE);
 }
 
-static void fbcon_resumed(struct fb_info *info)
+void fbcon_resumed(struct fb_info *info)
 {
 	struct vc_data *vc;
 	struct fbcon_ops *ops = info->fbcon_par;
@@ -3326,12 +3326,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 	int idx, ret = 0;
 
 	switch(action) {
-	case FB_EVENT_SUSPEND:
-		fbcon_suspended(info);
-		break;
-	case FB_EVENT_RESUME:
-		fbcon_resumed(info);
-		break;
 	case FB_EVENT_MODE_CHANGE:
 		fbcon_modechanged(info);
 		break;
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index f059b0b1a030..7c55846ee5fc 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1881,17 +1881,14 @@ EXPORT_SYMBOL(unregister_framebuffer);
  */
 void fb_set_suspend(struct fb_info *info, int state)
 {
-	struct fb_event event;
-
 	WARN_CONSOLE_UNLOCKED();
 
-	event.info = info;
 	if (state) {
-		fb_notifier_call_chain(FB_EVENT_SUSPEND, &event);
+		fbcon_suspended(info);
 		info->state = FBINFO_STATE_SUSPENDED;
 	} else {
 		info->state = FBINFO_STATE_RUNNING;
-		fb_notifier_call_chain(FB_EVENT_RESUME, &event);
+		fbcon_resumed(info);
 	}
 }
 EXPORT_SYMBOL(fb_set_suspend);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 44021e55b15c..a78bbd372cfd 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -126,14 +126,6 @@ struct fb_cursor_user {
 
 /*	The resolution of the passed in fb_info about to change */ 
 #define FB_EVENT_MODE_CHANGE		0x01
-/*	The display on this fb_info is being suspended, no access to the
- *	framebuffer is allowed any more after that call returns
- */
-#define FB_EVENT_SUSPEND		0x02
-/*	The display on this fb_info was resumed, you can restore the display
- *	if you own it
- */
-#define FB_EVENT_RESUME			0x03
 /*      An entry from the modelist was removed */
 #define FB_EVENT_MODE_DELETE            0x04
 /*      CONSOLE-SPECIFIC: get console to framebuffer mapping */
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
index 38d44fdb6d14..61a22e6c0c64 100644
--- a/include/linux/fbcon.h
+++ b/include/linux/fbcon.h
@@ -7,12 +7,16 @@ void __exit fb_console_exit(void);
 int fbcon_fb_registered(struct fb_info *info);
 void fbcon_fb_unregistered(struct fb_info *info);
 void fbcon_fb_unbind(struct fb_info *info);
+void fbcon_suspended(struct fb_info *info);
+void fbcon_resumed(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) {}
 static inline void fbcon_fb_unbind(struct fb_info *info) {}
+static inline void fbcon_suspended(void) {}
+static inline void fbcon_resumed(void) {}
 #endif
 
 #endif /* _LINUX_FBCON_H */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 22/33] fbcon: Call fbcon_mode_deleted/new_modelist directly
       [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
                   ` (5 preceding siblings ...)
  2019-05-20  8:22 ` [PATCH 21/33] fbdev: directly call fbcon_suspended/resumed Daniel Vetter
@ 2019-05-20  8:22 ` Daniel Vetter
  2019-05-20  8:22 ` [PATCH 23/33] fbdev: Call fbcon_get_requirement directly Daniel Vetter
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20  8:22 UTC (permalink / raw)
  To: DRI Development
  Cc: Intel Graphics Development, LKML, Daniel Vetter, Daniel Vetter,
	Bartlomiej Zolnierkiewicz, Hans de Goede, Mikulas Patocka,
	Sergey Senozhatsky, Kees Cook, Peter Rosin, Yisheng Xie,
	Michał Mirosław, linux-fbdev

I'm not entirely clear on what new_modelist actually does, it seems
exclusively for a sysfs interface. Which in the end does amount to a
normal fb_set_par to check the mode, but then takes a different path
in both fbmem.c and fbcon.c.

I have no idea why these 2 paths are different, but then I also don't
really want to find out. So just do the simple conversion to a direct
function call.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Peter Rosin <peda@axentia.se>
Cc: Yisheng Xie <ysxie@foxmail.com>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/fbdev/core/fbcon.c | 14 +++-----------
 drivers/video/fbdev/core/fbmem.c | 22 +++++++---------------
 include/linux/fb.h               |  5 -----
 include/linux/fbcon.h            |  6 ++++++
 4 files changed, 16 insertions(+), 31 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index b056d1190788..5635acb4b11c 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3015,8 +3015,8 @@ static void fbcon_set_all_vcs(struct fb_info *info)
 		fbcon_modechanged(info);
 }
 
-static int fbcon_mode_deleted(struct fb_info *info,
-			      struct fb_videomode *mode)
+int fbcon_mode_deleted(struct fb_info *info,
+		       struct fb_videomode *mode)
 {
 	struct fb_info *fb_info;
 	struct fbcon_display *p;
@@ -3258,7 +3258,7 @@ static void fbcon_fb_blanked(struct fb_info *info, int blank)
 	ops->blank_state = blank;
 }
 
-static void fbcon_new_modelist(struct fb_info *info)
+void fbcon_new_modelist(struct fb_info *info)
 {
 	int i;
 	struct vc_data *vc;
@@ -3320,7 +3320,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 {
 	struct fb_event *event = data;
 	struct fb_info *info = event->info;
-	struct fb_videomode *mode;
 	struct fb_con2fbmap *con2fb;
 	struct fb_blit_caps *caps;
 	int idx, ret = 0;
@@ -3332,10 +3331,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 	case FB_EVENT_MODE_CHANGE_ALL:
 		fbcon_set_all_vcs(info);
 		break;
-	case FB_EVENT_MODE_DELETE:
-		mode = event->data;
-		ret = fbcon_mode_deleted(info, mode);
-		break;
 	case FB_EVENT_SET_CONSOLE_MAP:
 		/* called with console lock held */
 		con2fb = event->data;
@@ -3349,9 +3344,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 	case FB_EVENT_BLANK:
 		fbcon_fb_blanked(info, *(int *)event->data);
 		break;
-	case FB_EVENT_NEW_MODELIST:
-		fbcon_new_modelist(info);
-		break;
 	case FB_EVENT_GET_REQ:
 		caps = event->data;
 		fbcon_get_requirement(info, caps);
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 7c55846ee5fc..96d280228746 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -966,16 +966,11 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
 		/* make sure we don't delete the videomode of current var */
 		ret = fb_mode_is_equal(&mode1, &mode2);
 
-		if (!ret) {
-		    struct fb_event event;
-
-		    event.info = info;
-		    event.data = &mode1;
-		    ret = fb_notifier_call_chain(FB_EVENT_MODE_DELETE, &event);
-		}
+		if (!ret)
+			fbcon_mode_deleted(info, &mode1);
 
 		if (!ret)
-		    fb_delete_videomode(&mode1, &info->modelist);
+			fb_delete_videomode(&mode1, &info->modelist);
 
 
 		ret = (ret) ? -EINVAL : 0;
@@ -1956,7 +1951,6 @@ subsys_initcall(fbmem_init);
 
 int fb_new_modelist(struct fb_info *info)
 {
-	struct fb_event event;
 	struct fb_var_screeninfo var = info->var;
 	struct list_head *pos, *n;
 	struct fb_modelist *modelist;
@@ -1976,14 +1970,12 @@ int fb_new_modelist(struct fb_info *info)
 		}
 	}
 
-	err = 1;
+	if (list_empty(&info->modelist))
+		return 1;
 
-	if (!list_empty(&info->modelist)) {
-		event.info = info;
-		err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event);
-	}
+	fbcon_new_modelist(info);
 
-	return err;
+	return 0;
 }
 
 MODULE_LICENSE("GPL");
diff --git a/include/linux/fb.h b/include/linux/fb.h
index a78bbd372cfd..e6595a381792 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -126,8 +126,6 @@ struct fb_cursor_user {
 
 /*	The resolution of the passed in fb_info about to change */ 
 #define FB_EVENT_MODE_CHANGE		0x01
-/*      An entry from the modelist was removed */
-#define FB_EVENT_MODE_DELETE            0x04
 /*      CONSOLE-SPECIFIC: get console to framebuffer mapping */
 #define FB_EVENT_GET_CONSOLE_MAP        0x07
 /*      CONSOLE-SPECIFIC: set console to framebuffer mapping */
@@ -135,9 +133,6 @@ struct fb_cursor_user {
 /*      A hardware display blank change occurred */
 #define FB_EVENT_BLANK                  0x09
 /*      Private modelist is to be replaced */
-#define FB_EVENT_NEW_MODELIST           0x0A
-/*	The resolution of the passed in fb_info about to change and
-        all vc's should be changed         */
 #define FB_EVENT_MODE_CHANGE_ALL	0x0B
 /*	A software display blank change occurred */
 #define FB_EVENT_CONBLANK               0x0C
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
index 61a22e6c0c64..42b06848b459 100644
--- a/include/linux/fbcon.h
+++ b/include/linux/fbcon.h
@@ -9,6 +9,9 @@ void fbcon_fb_unregistered(struct fb_info *info);
 void fbcon_fb_unbind(struct fb_info *info);
 void fbcon_suspended(struct fb_info *info);
 void fbcon_resumed(struct fb_info *info);
+int fbcon_mode_deleted(struct fb_info *info,
+		       struct fb_videomode *mode);
+void fbcon_new_modelist(struct fb_info *info);
 #else
 static inline void fb_console_init(void) {}
 static inline void fb_console_exit(void) {}
@@ -17,6 +20,9 @@ static inline void fbcon_fb_unregistered(struct fb_info *info) {}
 static inline void fbcon_fb_unbind(struct fb_info *info) {}
 static inline void fbcon_suspended(void) {}
 static inline void fbcon_resumed(void) {}
+int fbcon_mode_deleted(struct fb_info *info,
+		       struct fb_videomode *mode) { return 0; }
+void fbcon_new_modelist(struct fb_info *info) {}
 #endif
 
 #endif /* _LINUX_FBCON_H */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 23/33] fbdev: Call fbcon_get_requirement directly
       [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
                   ` (6 preceding siblings ...)
  2019-05-20  8:22 ` [PATCH 22/33] fbcon: Call fbcon_mode_deleted/new_modelist directly Daniel Vetter
@ 2019-05-20  8:22 ` Daniel Vetter
  2019-05-20  8:22 ` [PATCH 24/33] Revert "backlight/fbcon: Add FB_EVENT_CONBLANK" Daniel Vetter
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20  8:22 UTC (permalink / raw)
  To: DRI Development
  Cc: Intel Graphics Development, LKML, Daniel Vetter, Daniel Vetter,
	Bartlomiej Zolnierkiewicz, Hans de Goede, Steven Rostedt (VMware),
	Prarit Bhargava, Kees Cook, Yisheng Xie,
	Michał Mirosław, Peter Rosin, Mikulas Patocka,
	linux-fbdev

Pretty simple case really.

v2: Forgot to remove a break;

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Yisheng Xie <ysxie@foxmail.com>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Peter Rosin <peda@axentia.se>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/fbdev/core/fbcon.c | 9 ++-------
 drivers/video/fbdev/core/fbmem.c | 5 +----
 include/linux/fb.h               | 2 --
 include/linux/fbcon.h            | 4 ++++
 4 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 5635acb4b11c..58b876718d81 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3279,8 +3279,8 @@ void fbcon_new_modelist(struct fb_info *info)
 	}
 }
 
-static void fbcon_get_requirement(struct fb_info *info,
-				  struct fb_blit_caps *caps)
+void fbcon_get_requirement(struct fb_info *info,
+			   struct fb_blit_caps *caps)
 {
 	struct vc_data *vc;
 	struct fbcon_display *p;
@@ -3321,7 +3321,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 	struct fb_event *event = data;
 	struct fb_info *info = event->info;
 	struct fb_con2fbmap *con2fb;
-	struct fb_blit_caps *caps;
 	int idx, ret = 0;
 
 	switch(action) {
@@ -3344,10 +3343,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 	case FB_EVENT_BLANK:
 		fbcon_fb_blanked(info, *(int *)event->data);
 		break;
-	case FB_EVENT_GET_REQ:
-		caps = event->data;
-		fbcon_get_requirement(info, caps);
-		break;
 	case FB_EVENT_REMAP_ALL_CONSOLE:
 		idx = info->node;
 		fbcon_remap_all(idx);
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 96d280228746..d428d08c358a 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -932,16 +932,13 @@ EXPORT_SYMBOL(fb_pan_display);
 static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var,
 			 u32 activate)
 {
-	struct fb_event event;
 	struct fb_blit_caps caps, fbcaps;
 	int err = 0;
 
 	memset(&caps, 0, sizeof(caps));
 	memset(&fbcaps, 0, sizeof(fbcaps));
 	caps.flags = (activate & FB_ACTIVATE_ALL) ? 1 : 0;
-	event.info = info;
-	event.data = &caps;
-	fb_notifier_call_chain(FB_EVENT_GET_REQ, &event);
+	fbcon_get_requirement(info, &caps);
 	info->fbops->fb_get_caps(info, &fbcaps, var);
 
 	if (((fbcaps.x ^ caps.x) & caps.x) ||
diff --git a/include/linux/fb.h b/include/linux/fb.h
index e6595a381792..e76185244593 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -136,8 +136,6 @@ struct fb_cursor_user {
 #define FB_EVENT_MODE_CHANGE_ALL	0x0B
 /*	A software display blank change occurred */
 #define FB_EVENT_CONBLANK               0x0C
-/*      Get drawing requirements        */
-#define FB_EVENT_GET_REQ                0x0D
 /*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
 #define FB_EVENT_REMAP_ALL_CONSOLE      0x0F
 /*      A hardware display blank early change occurred */
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
index 42b06848b459..7f0a530a913c 100644
--- a/include/linux/fbcon.h
+++ b/include/linux/fbcon.h
@@ -12,6 +12,8 @@ void fbcon_resumed(struct fb_info *info);
 int fbcon_mode_deleted(struct fb_info *info,
 		       struct fb_videomode *mode);
 void fbcon_new_modelist(struct fb_info *info);
+void fbcon_get_requirement(struct fb_info *info,
+			   struct fb_blit_caps *caps);
 #else
 static inline void fb_console_init(void) {}
 static inline void fb_console_exit(void) {}
@@ -23,6 +25,8 @@ static inline void fbcon_resumed(void) {}
 int fbcon_mode_deleted(struct fb_info *info,
 		       struct fb_videomode *mode) { return 0; }
 void fbcon_new_modelist(struct fb_info *info) {}
+void fbcon_get_requirement(struct fb_info *info,
+			   struct fb_blit_caps *caps) {}
 #endif
 
 #endif /* _LINUX_FBCON_H */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 24/33] Revert "backlight/fbcon: Add FB_EVENT_CONBLANK"
       [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
                   ` (7 preceding siblings ...)
  2019-05-20  8:22 ` [PATCH 23/33] fbdev: Call fbcon_get_requirement directly Daniel Vetter
@ 2019-05-20  8:22 ` Daniel Vetter
  2019-05-20  8:22 ` [PATCH 29/33] fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls Daniel Vetter
  2019-05-20  8:22 ` [PATCH 30/33] vgaswitcheroo: call fbcon_remap_all directly Daniel Vetter
  10 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20  8:22 UTC (permalink / raw)
  To: DRI Development
  Cc: Intel Graphics Development, LKML, Daniel Vetter, Richard Purdie,
	Daniel Vetter, Lee Jones, Daniel Thompson, Jingoo Han,
	Bartlomiej Zolnierkiewicz, Hans de Goede, Yisheng Xie,
	linux-fbdev

This reverts commit 994efacdf9a087b52f71e620b58dfa526b0cf928.

The justification is that if hw blanking fails (i.e. fbops->fb_blank)
fails, then we still want to shut down the backlight. Which is exactly
_not_ what fb_blank() does and so rather inconsistent if we end up
with different behaviour between fbcon and direct fbdev usage. Given
that the entire notifier maze is getting in the way anyway I figured
it's simplest to revert this not well justified commit.

Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Yisheng Xie <ysxie@foxmail.com>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/backlight/backlight.c | 2 +-
 drivers/video/fbdev/core/fbcon.c    | 9 ---------
 include/linux/fb.h                  | 4 +---
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index deb824bef6e2..c55590ec0057 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -46,7 +46,7 @@ static int fb_notifier_callback(struct notifier_block *self,
 	int fb_blank = 0;
 
 	/* If we aren't interested in this event, skip it immediately ... */
-	if (event != FB_EVENT_BLANK && event != FB_EVENT_CONBLANK)
+	if (event != FB_EVENT_BLANK)
 		return 0;
 
 	bd = container_of(self, struct backlight_device, fb_notif);
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 58b876718d81..1549056a848e 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2346,8 +2346,6 @@ static int fbcon_switch(struct vc_data *vc)
 static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info,
 				int blank)
 {
-	struct fb_event event;
-
 	if (blank) {
 		unsigned short charmask = vc->vc_hi_font_mask ?
 			0x1ff : 0xff;
@@ -2358,13 +2356,6 @@ static void fbcon_generic_blank(struct vc_data *vc, struct fb_info *info,
 		fbcon_clear(vc, 0, 0, vc->vc_rows, vc->vc_cols);
 		vc->vc_video_erase_char = oldc;
 	}
-
-
-	lock_fb_info(info);
-	event.info = info;
-	event.data = &blank;
-	fb_notifier_call_chain(FB_EVENT_CONBLANK, &event);
-	unlock_fb_info(info);
 }
 
 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index e76185244593..4b9b882f8f52 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -130,12 +130,10 @@ struct fb_cursor_user {
 #define FB_EVENT_GET_CONSOLE_MAP        0x07
 /*      CONSOLE-SPECIFIC: set console to framebuffer mapping */
 #define FB_EVENT_SET_CONSOLE_MAP        0x08
-/*      A hardware display blank change occurred */
+/*      A display blank is requested       */
 #define FB_EVENT_BLANK                  0x09
 /*      Private modelist is to be replaced */
 #define FB_EVENT_MODE_CHANGE_ALL	0x0B
-/*	A software display blank change occurred */
-#define FB_EVENT_CONBLANK               0x0C
 /*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
 #define FB_EVENT_REMAP_ALL_CONSOLE      0x0F
 /*      A hardware display blank early change occurred */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 29/33] fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls
       [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
                   ` (8 preceding siblings ...)
  2019-05-20  8:22 ` [PATCH 24/33] Revert "backlight/fbcon: Add FB_EVENT_CONBLANK" Daniel Vetter
@ 2019-05-20  8:22 ` Daniel Vetter
  2019-05-21 10:56   ` Maarten Lankhorst
  2019-05-20  8:22 ` [PATCH 30/33] vgaswitcheroo: call fbcon_remap_all directly Daniel Vetter
  10 siblings, 1 reply; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20  8:22 UTC (permalink / raw)
  To: DRI Development
  Cc: Intel Graphics Development, LKML, Daniel Vetter, Daniel Vetter,
	Lee Jones, Daniel Thompson, Jingoo Han, Bartlomiej Zolnierkiewicz,
	Hans de Goede, Yisheng Xie, Michał Mirosław,
	Peter Rosin, Mikulas Patocka, linux-fbdev

Create a new wrapper function for this, feels like there's some
refactoring room here between the two modes.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Yisheng Xie <ysxie@foxmail.com>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Peter Rosin <peda@axentia.se>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/backlight/lcd.c          |  2 --
 drivers/video/fbdev/core/fbcon.c       | 15 +++++++++------
 drivers/video/fbdev/core/fbmem.c       | 13 ++-----------
 drivers/video/fbdev/sh_mobile_lcdcfb.c | 11 +----------
 include/linux/fb.h                     |  4 ----
 include/linux/fbcon.h                  |  2 ++
 6 files changed, 14 insertions(+), 33 deletions(-)

diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 4b40c6a4d441..16298041b141 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -32,8 +32,6 @@ static int fb_notifier_callback(struct notifier_block *self,
 	/* If we aren't interested in this event, skip it immediately ... */
 	switch (event) {
 	case FB_EVENT_BLANK:
-	case FB_EVENT_MODE_CHANGE:
-	case FB_EVENT_MODE_CHANGE_ALL:
 	case FB_EARLY_EVENT_BLANK:
 	case FB_R_EARLY_EVENT_BLANK:
 		break;
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index c1a7476e980f..8cc62d340387 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3005,6 +3005,15 @@ static void fbcon_set_all_vcs(struct fb_info *info)
 		fbcon_modechanged(info);
 }
 
+
+void fbcon_update_vcs(struct fb_info *info, bool all)
+{
+	if (all)
+		fbcon_set_all_vcs(info);
+	else
+		fbcon_modechanged(info);
+}
+
 int fbcon_mode_deleted(struct fb_info *info,
 		       struct fb_videomode *mode)
 {
@@ -3314,12 +3323,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 	int idx, ret = 0;
 
 	switch(action) {
-	case FB_EVENT_MODE_CHANGE:
-		fbcon_modechanged(info);
-		break;
-	case FB_EVENT_MODE_CHANGE_ALL:
-		fbcon_set_all_vcs(info);
-		break;
 	case FB_EVENT_SET_CONSOLE_MAP:
 		/* called with console lock held */
 		con2fb = event->data;
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index cbd58ba8a59d..55b88163edc2 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1039,17 +1039,8 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
 	    !list_empty(&info->modelist))
 		ret = fb_add_videomode(&mode, &info->modelist);
 
-	if (!ret && (flags & FBINFO_MISC_USEREVENT)) {
-		struct fb_event event;
-		int evnt = (activate & FB_ACTIVATE_ALL) ?
-			FB_EVENT_MODE_CHANGE_ALL :
-			FB_EVENT_MODE_CHANGE;
-
-		info->flags &= ~FBINFO_MISC_USEREVENT;
-		event.info = info;
-		event.data = &mode;
-		fb_notifier_call_chain(evnt, &event);
-	}
+	if (!ret && (flags & FBINFO_MISC_USEREVENT))
+		fbcon_update_vcs(info, activate & FB_ACTIVATE_ALL);
 
 	return ret;
 }
diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c
index 0d7a044852d7..bb1a610d0363 100644
--- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
+++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
@@ -1776,8 +1776,6 @@ static void sh_mobile_fb_reconfig(struct fb_info *info)
 	struct sh_mobile_lcdc_chan *ch = info->par;
 	struct fb_var_screeninfo var;
 	struct fb_videomode mode;
-	struct fb_event event;
-	int evnt = FB_EVENT_MODE_CHANGE_ALL;
 
 	if (ch->use_count > 1 || (ch->use_count = 1 && !info->fbcon_par))
 		/* More framebuffer users are active */
@@ -1799,14 +1797,7 @@ static void sh_mobile_fb_reconfig(struct fb_info *info)
 		/* Couldn't reconfigure, hopefully, can continue as before */
 		return;
 
-	/*
-	 * fb_set_var() calls the notifier change internally, only if
-	 * FBINFO_MISC_USEREVENT flag is set. Since we do not want to fake a
-	 * user event, we have to call the chain ourselves.
-	 */
-	event.info = info;
-	event.data = &ch->display.mode;
-	fb_notifier_call_chain(evnt, &event);
+	fbcon_update_vcs(info, true);
 }
 
 /*
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 4b9b882f8f52..54d6bee09121 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -124,16 +124,12 @@ struct fb_cursor_user {
  * Register/unregister for framebuffer events
  */
 
-/*	The resolution of the passed in fb_info about to change */ 
-#define FB_EVENT_MODE_CHANGE		0x01
 /*      CONSOLE-SPECIFIC: get console to framebuffer mapping */
 #define FB_EVENT_GET_CONSOLE_MAP        0x07
 /*      CONSOLE-SPECIFIC: set console to framebuffer mapping */
 #define FB_EVENT_SET_CONSOLE_MAP        0x08
 /*      A display blank is requested       */
 #define FB_EVENT_BLANK                  0x09
-/*      Private modelist is to be replaced */
-#define FB_EVENT_MODE_CHANGE_ALL	0x0B
 /*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
 #define FB_EVENT_REMAP_ALL_CONSOLE      0x0F
 /*      A hardware display blank early change occurred */
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
index 90e196c835dd..daaa97b0c9e6 100644
--- a/include/linux/fbcon.h
+++ b/include/linux/fbcon.h
@@ -15,6 +15,7 @@ void fbcon_new_modelist(struct fb_info *info);
 void fbcon_get_requirement(struct fb_info *info,
 			   struct fb_blit_caps *caps);
 void fbcon_fb_blanked(struct fb_info *info, int blank);
+void fbcon_update_vcs(struct fb_info *info, bool all);
 #else
 static inline void fb_console_init(void) {}
 static inline void fb_console_exit(void) {}
@@ -29,6 +30,7 @@ void fbcon_new_modelist(struct fb_info *info) {}
 void fbcon_get_requirement(struct fb_info *info,
 			   struct fb_blit_caps *caps) {}
 void fbcon_fb_blanked(struct fb_info *info, int blank) {}
+void fbcon_update_vcs(struct fb_info *info, bool all) {}
 #endif
 
 #endif /* _LINUX_FBCON_H */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 30/33] vgaswitcheroo: call fbcon_remap_all directly
       [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
                   ` (9 preceding siblings ...)
  2019-05-20  8:22 ` [PATCH 29/33] fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls Daniel Vetter
@ 2019-05-20  8:22 ` Daniel Vetter
  2019-05-20  8:37   ` Lukas Wunner
  10 siblings, 1 reply; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20  8:22 UTC (permalink / raw)
  To: DRI Development
  Cc: Intel Graphics Development, LKML, Daniel Vetter, Daniel Vetter,
	Lukas Wunner, David Airlie, Daniel Vetter, Maarten Lankhorst,
	Maxime Ripard, Sean Paul, Bartlomiej Zolnierkiewicz,
	Hans de Goede, Yisheng Xie, linux-fbdev

While at it, clean up the interface a bit and push the console locking
into fbcon.c.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Yisheng Xie <ysxie@foxmail.com>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/gpu/vga/vga_switcheroo.c | 11 +++--------
 drivers/video/fbdev/core/fbcon.c | 13 +++++--------
 include/linux/fb.h               |  2 --
 include/linux/fbcon.h            |  2 ++
 4 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index a132c37d7334..65d7541c413a 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -35,6 +35,7 @@
 #include <linux/debugfs.h>
 #include <linux/fb.h>
 #include <linux/fs.h>
+#include <linux/fbcon.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/pm_domain.h>
@@ -736,14 +737,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
 	if (!active->driver_power_control)
 		set_audio_state(active->id, VGA_SWITCHEROO_OFF);
 
-	if (new_client->fb_info) {
-		struct fb_event event;
-
-		console_lock();
-		event.info = new_client->fb_info;
-		fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event);
-		console_unlock();
-	}
+	if (new_client->fb_info)
+		fbcon_remap_all(new_client->fb_info);
 
 	mutex_lock(&vgasr_priv.mux_hw_lock);
 	ret = vgasr_priv.handler->switchto(new_client->id);
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 8cc62d340387..fd604ffb3c05 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3146,16 +3146,16 @@ void fbcon_fb_unregistered(struct fb_info *info)
 }
 
 /* called with console_lock held */
-static void fbcon_remap_all(int idx)
+void fbcon_remap_all(struct fb_info *info)
 {
-	int i;
-
-	WARN_CONSOLE_UNLOCKED();
+	int i, idx = info->node;
 
+	console_lock();
 	if (deferred_takeover) {
 		for (i = first_fb_vc; i <= last_fb_vc; i++)
 			con2fb_map_boot[i] = idx;
 		fbcon_map_override();
+		console_unlock();
 		return;
 	}
 
@@ -3168,6 +3168,7 @@ static void fbcon_remap_all(int idx)
 		       first_fb_vc + 1, last_fb_vc + 1);
 		info_idx = idx;
 	}
+	console_unlock();
 }
 
 #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
@@ -3333,10 +3334,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 		con2fb = event->data;
 		con2fb->framebuffer = con2fb_map[con2fb->console - 1];
 		break;
-	case FB_EVENT_REMAP_ALL_CONSOLE:
-		idx = info->node;
-		fbcon_remap_all(idx);
-		break;
 	}
 	return ret;
 }
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 54d6bee09121..acd8daa23002 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -130,8 +130,6 @@ struct fb_cursor_user {
 #define FB_EVENT_SET_CONSOLE_MAP        0x08
 /*      A display blank is requested       */
 #define FB_EVENT_BLANK                  0x09
-/*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
-#define FB_EVENT_REMAP_ALL_CONSOLE      0x0F
 /*      A hardware display blank early change occurred */
 #define FB_EARLY_EVENT_BLANK		0x10
 /*      A hardware display blank revert early change occurred */
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
index daaa97b0c9e6..3f854e803746 100644
--- a/include/linux/fbcon.h
+++ b/include/linux/fbcon.h
@@ -16,6 +16,7 @@ void fbcon_get_requirement(struct fb_info *info,
 			   struct fb_blit_caps *caps);
 void fbcon_fb_blanked(struct fb_info *info, int blank);
 void fbcon_update_vcs(struct fb_info *info, bool all);
+void fbcon_remap_all(struct fb_info *info);
 #else
 static inline void fb_console_init(void) {}
 static inline void fb_console_exit(void) {}
@@ -31,6 +32,7 @@ void fbcon_get_requirement(struct fb_info *info,
 			   struct fb_blit_caps *caps) {}
 void fbcon_fb_blanked(struct fb_info *info, int blank) {}
 void fbcon_update_vcs(struct fb_info *info, bool all) {}
+void fbcon_remap_all(struct fb_info *info) {}
 #endif
 
 #endif /* _LINUX_FBCON_H */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly
  2019-05-20  8:21 ` [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly Daniel Vetter
@ 2019-05-20  8:33   ` Thomas Zimmermann
  2019-05-20  8:37     ` Thomas Zimmermann
  2019-05-20 17:08   ` Sam Ravnborg
  1 sibling, 1 reply; 25+ messages in thread
From: Thomas Zimmermann @ 2019-05-20  8:33 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: Intel Graphics Development, LKML, Daniel Vetter,
	Bartlomiej Zolnierkiewicz, Hans de Goede, Greg Kroah-Hartman,
	Noralf Trønnes, Yisheng Xie, Peter Rosin,
	Michał Mirosław, Mikulas Patocka, linux-fbdev


[-- Attachment #1.1: Type: text/plain, Size: 3795 bytes --]

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)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 30/33] vgaswitcheroo: call fbcon_remap_all directly
  2019-05-20  8:22 ` [PATCH 30/33] vgaswitcheroo: call fbcon_remap_all directly Daniel Vetter
@ 2019-05-20  8:37   ` Lukas Wunner
  0 siblings, 0 replies; 25+ messages in thread
From: Lukas Wunner @ 2019-05-20  8:37 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: DRI Development, Intel Graphics Development, LKML, Daniel Vetter,
	David Airlie, Daniel Vetter, Maarten Lankhorst, Maxime Ripard,
	Sean Paul, Bartlomiej Zolnierkiewicz, Hans de Goede, Yisheng Xie,
	linux-fbdev

On Mon, May 20, 2019 at 10:22:13AM +0200, Daniel Vetter wrote:
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -3146,16 +3146,16 @@ void fbcon_fb_unregistered(struct fb_info *info)
>  }
>  
>  /* called with console_lock held */
> -static void fbcon_remap_all(int idx)

That comment needs to be removed as well.

Not an expert on fbcon code but this looks sane to me, so in case it helps:
Acked-by: Lukas Wunner <lukas@wunner.de>

Thanks,

Lukas

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly
  2019-05-20  8:33   ` Thomas Zimmermann
@ 2019-05-20  8:37     ` Thomas Zimmermann
  2019-05-21 15:09       ` Daniel Vetter
  0 siblings, 1 reply; 25+ messages in thread
From: Thomas Zimmermann @ 2019-05-20  8:37 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: Intel Graphics Development, LKML, Daniel Vetter,
	Bartlomiej Zolnierkiewicz, Hans de Goede, Greg Kroah-Hartman,
	Noralf Trønnes, Yisheng Xie, Peter Rosin,
	Michał Mirosław, Mikulas Patocka, linux-fbdev


[-- Attachment #1.1: Type: text/plain, Size: 4093 bytes --]

Hi

Am 20.05.19 um 10:33 schrieb Thomas Zimmermann:
> 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.

I just saw that backlight drivers only care about blanking and
unblanking. Never mind then.

Best regards
Thomas

> 
> 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)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly
  2019-05-20  8:21 ` [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly Daniel Vetter
  2019-05-20  8:33   ` Thomas Zimmermann
@ 2019-05-20 17:08   ` Sam Ravnborg
  2019-05-20 17:25     ` Daniel Vetter
  1 sibling, 1 reply; 25+ messages in thread
From: Sam Ravnborg @ 2019-05-20 17:08 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: linux-fbdev, Bartlomiej Zolnierkiewicz, Greg Kroah-Hartman,
	Intel Graphics Development, LKML, DRI Development,
	Michał Mirosław, Yisheng Xie, Hans de Goede,
	Mikulas Patocka, Thomas Zimmermann, Daniel Vetter, Peter Rosin

Hi Daniel.

While browsing this nice patch series I stumbled upon a detail.

On Mon, May 20, 2019 at 10:21:53AM +0200, Daniel Vetter wrote:
> With
> 
> commit 6104c37094e729f3d4ce65797002112735d49cd1
> Author: Daniel Vetter <daniel.vetter@ffwll.ch>
> Date:   Tue Aug 1 17:32:07 2017 +0200
> 
>     fbcon: Make fbcon a built-time depency for fbdev
> 
> we have a static dependency between fbcon and fbdev, and we can
> replace the indirection through the notifier chain with a function
> call.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Noralf Trønnes" <noralf@tronnes.org>
> Cc: Yisheng Xie <ysxie@foxmail.com>
> Cc: Peter Rosin <peda@axentia.se>
> Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Mikulas Patocka <mpatocka@redhat.com>
> Cc: linux-fbdev@vger.kernel.org
> ---
> 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 */

This breaks build of arch/arm/mach-pxa/am200epd.c thats uses
FB_EVENT_FB_*REGISTERED:


       if (event = FB_EVENT_FB_REGISTERED)
                return am200_share_video_mem(info);
        else if (event = FB_EVENT_FB_UNREGISTERED)
                return am200_unshare_video_mem(info);


Found while grepping for "FB_EVENT" so this is not a build
error I triggered.

	Sam

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly
  2019-05-20 17:08   ` Sam Ravnborg
@ 2019-05-20 17:25     ` Daniel Vetter
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-20 17:25 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: DRI Development, Linux Fbdev development list,
	Bartlomiej Zolnierkiewicz, Intel Graphics Development, LKML,
	Michał Mirosław, Yisheng Xie, Hans de Goede,
	Mikulas Patocka, Thomas Zimmermann, Greg Kroah-Hartman,
	Daniel Vetter, Peter Rosin

On Mon, May 20, 2019 at 7:08 PM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Daniel.
>
> While browsing this nice patch series I stumbled upon a detail.
>
> On Mon, May 20, 2019 at 10:21:53AM +0200, Daniel Vetter wrote:
> > With
> >
> > commit 6104c37094e729f3d4ce65797002112735d49cd1
> > Author: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Date:   Tue Aug 1 17:32:07 2017 +0200
> >
> >     fbcon: Make fbcon a built-time depency for fbdev
> >
> > we have a static dependency between fbcon and fbdev, and we can
> > replace the indirection through the notifier chain with a function
> > call.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Hans de Goede <hdegoede@redhat.com>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: "Noralf Trønnes" <noralf@tronnes.org>
> > Cc: Yisheng Xie <ysxie@foxmail.com>
> > Cc: Peter Rosin <peda@axentia.se>
> > Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
> > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > Cc: Mikulas Patocka <mpatocka@redhat.com>
> > Cc: linux-fbdev@vger.kernel.org
> > ---
> > 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 */
>
> This breaks build of arch/arm/mach-pxa/am200epd.c thats uses
> FB_EVENT_FB_*REGISTERED:
>
>
>        if (event == FB_EVENT_FB_REGISTERED)
>                 return am200_share_video_mem(info);
>         else if (event == FB_EVENT_FB_UNREGISTERED)
>                 return am200_unshare_video_mem(info);
>
>
> Found while grepping for "FB_EVENT" so this is not a build
> error I triggered.

Oh this is glorious :-/

Thanks a lot for spotting this, I guess I need to hack around on
metronomefb a bit ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Intel-gfx] [PATCH 18/33] fbdev: make unregister/unlink functions not fail
  2019-05-20  8:22 ` [PATCH 18/33] fbdev: make unregister/unlink functions not fail Daniel Vetter
@ 2019-05-20 19:08   ` kbuild test robot
  2019-05-20 19:25   ` kbuild test robot
  2019-05-20 21:45   ` kbuild test robot
  2 siblings, 0 replies; 25+ messages in thread
From: kbuild test robot @ 2019-05-20 19:08 UTC (permalink / raw)
  Cc: kbuild-all, DRI Development, linux-fbdev,
	Bartlomiej Zolnierkiewicz, Daniel Vetter,
	Intel Graphics Development, LKML, Michał Mirosław,
	Mikulas Patocka, Daniel Vetter, Peter Rosin

[-- Attachment #1: Type: text/plain, Size: 3463 bytes --]

Hi Daniel,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.2-rc1 next-20190520]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/fbcon-notifier-begone/20190521-021841
config: x86_64-randconfig-x004-201920 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/video/fbdev/neofb.c: In function 'neofb_remove':
>> drivers/video/fbdev/neofb.c:2130:7: error: void value not ignored as it ought to be
      if (unregister_framebuffer(info))
          ^~~~~~~~~~~~~~~~~~~~~~

vim +2130 drivers/video/fbdev/neofb.c

^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2117  
48c68c4f drivers/video/neofb.c Greg Kroah-Hartman 2012-12-21  2118  static void neofb_remove(struct pci_dev *dev)
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2119  {
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2120  	struct fb_info *info = pci_get_drvdata(dev);
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2121  
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2122  	DBG("neofb_remove");
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2123  
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2124  	if (info) {
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2125  		/*
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2126  		 * If unregister_framebuffer fails, then
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2127  		 * we will be leaving hooks that could cause
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2128  		 * oopsen laying around.
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2129  		 */
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16 @2130  		if (unregister_framebuffer(info))
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2131  			printk(KERN_WARNING
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2132  			       "neofb: danger danger!  Oopsen imminent!\n");
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2133  
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2134  		neo_unmap_video(info);
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2135  		fb_destroy_modedb(info->monspecs.modedb);
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2136  		neo_unmap_mmio(info);
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2137  		neo_free_fb_info(info);
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2138  	}
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2139  }
^1da177e drivers/video/neofb.c Linus Torvalds     2005-04-16  2140  

:::::: The code at line 2130 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30860 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 21/33] fbdev: directly call fbcon_suspended/resumed
  2019-05-20  8:22 ` [PATCH 21/33] fbdev: directly call fbcon_suspended/resumed Daniel Vetter
@ 2019-05-20 19:24   ` kbuild test robot
  0 siblings, 0 replies; 25+ messages in thread
From: kbuild test robot @ 2019-05-20 19:24 UTC (permalink / raw)
  Cc: Prarit Bhargava, linux-fbdev, Kees Cook,
	Bartlomiej Zolnierkiewicz, Daniel Vetter,
	Intel Graphics Development, LKML, DRI Development,
	Michał Mirosław, Yisheng Xie, Mikulas Patocka,
	kbuild-all, Greg Kroah-Hartman, Daniel Vetter, Peter Rosin,
	Konstantin Khorenko

[-- Attachment #1: Type: text/plain, Size: 2394 bytes --]

Hi Daniel,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.2-rc1 next-20190520]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/fbcon-notifier-begone/20190521-021841
config: x86_64-randconfig-x006-201920 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/video/fbdev/core/fbmem.c: In function 'fb_set_suspend':
>> drivers/video/fbdev/core/fbmem.c:1908:3: error: too many arguments to function 'fbcon_suspended'
      fbcon_suspended(info);
      ^~~~~~~~~~~~~~~
   In file included from drivers/video/fbdev/core/fbmem.c:35:0:
   include/linux/fbcon.h:18:20: note: declared here
    static inline void fbcon_suspended(void) {}
                       ^~~~~~~~~~~~~~~
>> drivers/video/fbdev/core/fbmem.c:1912:3: error: too many arguments to function 'fbcon_resumed'
      fbcon_resumed(info);
      ^~~~~~~~~~~~~
   In file included from drivers/video/fbdev/core/fbmem.c:35:0:
   include/linux/fbcon.h:19:20: note: declared here
    static inline void fbcon_resumed(void) {}
                       ^~~~~~~~~~~~~

vim +/fbcon_suspended +1908 drivers/video/fbdev/core/fbmem.c

  1893	
  1894	/**
  1895	 *	fb_set_suspend - low level driver signals suspend
  1896	 *	@info: framebuffer affected
  1897	 *	@state: 0 = resuming, !=0 = suspending
  1898	 *
  1899	 *	This is meant to be used by low level drivers to
  1900	 * 	signal suspend/resume to the core & clients.
  1901	 *	It must be called with the console semaphore held
  1902	 */
  1903	void fb_set_suspend(struct fb_info *info, int state)
  1904	{
  1905		WARN_CONSOLE_UNLOCKED();
  1906	
  1907		if (state) {
> 1908			fbcon_suspended(info);
  1909			info->state = FBINFO_STATE_SUSPENDED;
  1910		} else {
  1911			info->state = FBINFO_STATE_RUNNING;
> 1912			fbcon_resumed(info);
  1913		}
  1914	}
  1915	EXPORT_SYMBOL(fb_set_suspend);
  1916	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26895 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Intel-gfx] [PATCH 18/33] fbdev: make unregister/unlink functions not fail
  2019-05-20  8:22 ` [PATCH 18/33] fbdev: make unregister/unlink functions not fail Daniel Vetter
  2019-05-20 19:08   ` [Intel-gfx] " kbuild test robot
@ 2019-05-20 19:25   ` kbuild test robot
  2019-05-20 21:45   ` kbuild test robot
  2 siblings, 0 replies; 25+ messages in thread
From: kbuild test robot @ 2019-05-20 19:25 UTC (permalink / raw)
  Cc: linux-fbdev, Bartlomiej Zolnierkiewicz, Daniel Vetter,
	Intel Graphics Development, LKML, DRI Development,
	Michał Mirosław, Mikulas Patocka, kbuild-all,
	Daniel Vetter, Peter Rosin

[-- Attachment #1: Type: text/plain, Size: 3216 bytes --]

Hi Daniel,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.2-rc1 next-20190520]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/fbcon-notifier-begone/20190521-021841
config: x86_64-randconfig-x003-201920 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/video/fbdev/savage/savagefb_driver.c: In function 'savagefb_remove':
>> drivers/video/fbdev/savage/savagefb_driver.c:2341:7: error: void value not ignored as it ought to be
      if (unregister_framebuffer(info))
          ^~~~~~~~~~~~~~~~~~~~~~

vim +2341 drivers/video/fbdev/savage/savagefb_driver.c

^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2328  
48c68c4f drivers/video/savage/savagefb_driver.c Greg Kroah-Hartman 2012-12-21  2329  static void savagefb_remove(struct pci_dev *dev)
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2330  {
b8901b09 drivers/video/savage/savagefb_driver.c Antonino A. Daplas 2006-01-09  2331  	struct fb_info *info = pci_get_drvdata(dev);
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2332  
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2333  	DBG("savagefb_remove");
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2334  
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2335  	if (info) {
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2336  		/*
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2337  		 * If unregister_framebuffer fails, then
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2338  		 * we will be leaving hooks that could cause
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2339  		 * oopsen laying around.
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2340  		 */
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16 @2341  		if (unregister_framebuffer(info))
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2342  			printk(KERN_WARNING "savagefb: danger danger! "
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2343  			       "Oopsen imminent!\n");
^1da177e drivers/video/savage/savagefb_driver.c Linus Torvalds     2005-04-16  2344  

:::::: The code at line 2341 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35839 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Intel-gfx] [PATCH 18/33] fbdev: make unregister/unlink functions not fail
  2019-05-20  8:22 ` [PATCH 18/33] fbdev: make unregister/unlink functions not fail Daniel Vetter
  2019-05-20 19:08   ` [Intel-gfx] " kbuild test robot
  2019-05-20 19:25   ` kbuild test robot
@ 2019-05-20 21:45   ` kbuild test robot
  2 siblings, 0 replies; 25+ messages in thread
From: kbuild test robot @ 2019-05-20 21:45 UTC (permalink / raw)
  Cc: kbuild-all, DRI Development, linux-fbdev,
	Bartlomiej Zolnierkiewicz, Daniel Vetter,
	Intel Graphics Development, LKML, Michał Mirosław,
	Mikulas Patocka, Daniel Vetter, Peter Rosin

Hi Daniel,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.2-rc1 next-20190520]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/fbcon-notifier-begone/20190521-021841
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> drivers/staging/fbtft/fbtft-core.c:894:38: sparse: sparse: incorrect type in return expression (different base types) @@    expected int @@    got vint @@
>> drivers/staging/fbtft/fbtft-core.c:894:38: sparse:    expected int
>> drivers/staging/fbtft/fbtft-core.c:894:38: sparse:    got void
--
>> drivers/media/pci/ivtv/ivtvfb.c:1261:43: sparse: sparse: incorrect type in conditional (non-scalar type)
>> drivers/media/pci/ivtv/ivtvfb.c:1261:43: sparse:    got void
--
>> drivers/video/fbdev/neofb.c:2130:43: sparse: sparse: incorrect type in conditional (non-scalar type)
>> drivers/video/fbdev/neofb.c:2130:43: sparse:    got void
--
>> drivers/video/fbdev/savage/savagefb_driver.c:2341:43: sparse: sparse: incorrect type in conditional (non-scalar type)
>> drivers/video/fbdev/savage/savagefb_driver.c:2341:43: sparse:    got void

vim +894 drivers/staging/fbtft/fbtft-core.c

c296d5f9 Thomas Petazzoni 2014-12-31  877  
c296d5f9 Thomas Petazzoni 2014-12-31  878  /**
c296d5f9 Thomas Petazzoni 2014-12-31  879   *	fbtft_unregister_framebuffer - releases a tft frame buffer device
c296d5f9 Thomas Petazzoni 2014-12-31  880   *	@fb_info: frame buffer info structure
c296d5f9 Thomas Petazzoni 2014-12-31  881   *
c296d5f9 Thomas Petazzoni 2014-12-31  882   *  Frees SPI driverdata if needed
c296d5f9 Thomas Petazzoni 2014-12-31  883   *  Frees gpios.
c296d5f9 Thomas Petazzoni 2014-12-31  884   *	Unregisters frame buffer device.
c296d5f9 Thomas Petazzoni 2014-12-31  885   *
c296d5f9 Thomas Petazzoni 2014-12-31  886   */
c296d5f9 Thomas Petazzoni 2014-12-31  887  int fbtft_unregister_framebuffer(struct fb_info *fb_info)
c296d5f9 Thomas Petazzoni 2014-12-31  888  {
c296d5f9 Thomas Petazzoni 2014-12-31  889  	struct fbtft_par *par = fb_info->par;
c296d5f9 Thomas Petazzoni 2014-12-31  890  
c296d5f9 Thomas Petazzoni 2014-12-31  891  	if (par->fbtftops.unregister_backlight)
c296d5f9 Thomas Petazzoni 2014-12-31  892  		par->fbtftops.unregister_backlight(par);
c296d5f9 Thomas Petazzoni 2014-12-31  893  	fbtft_sysfs_exit(par);
11107ffe Aya Mahfouz      2015-02-27 @894  	return unregister_framebuffer(fb_info);
c296d5f9 Thomas Petazzoni 2014-12-31  895  }
c296d5f9 Thomas Petazzoni 2014-12-31  896  EXPORT_SYMBOL(fbtft_unregister_framebuffer);
c296d5f9 Thomas Petazzoni 2014-12-31  897  

:::::: The code at line 894 was first introduced by commit
:::::: 11107ffe2cd1c1dc5948713fc08a1372185be0d5 staging: fbtft: remove unused variable

:::::: TO: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 29/33] fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls
  2019-05-20  8:22 ` [PATCH 29/33] fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls Daniel Vetter
@ 2019-05-21 10:56   ` Maarten Lankhorst
  2019-05-21 12:42     ` Daniel Vetter
  0 siblings, 1 reply; 25+ messages in thread
From: Maarten Lankhorst @ 2019-05-21 10:56 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: Daniel Thompson, Bartlomiej Zolnierkiewicz,
	Intel Graphics Development, LKML, Michał Mirosław,
	Yisheng Xie, Hans de Goede, Mikulas Patocka, linux-fbdev,
	Jingoo Han, Daniel Vetter, Lee Jones, Peter Rosin

Op 20-05-2019 om 10:22 schreef Daniel Vetter:
> Create a new wrapper function for this, feels like there's some
> refactoring room here between the two modes.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Jingoo Han <jingoohan1@gmail.com>
> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Yisheng Xie <ysxie@foxmail.com>
> Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
> Cc: Peter Rosin <peda@axentia.se>
> Cc: Mikulas Patocka <mpatocka@redhat.com>
> Cc: linux-fbdev@vger.kernel.org
> ---
>  drivers/video/backlight/lcd.c          |  2 --
>  drivers/video/fbdev/core/fbcon.c       | 15 +++++++++------
>  drivers/video/fbdev/core/fbmem.c       | 13 ++-----------
>  drivers/video/fbdev/sh_mobile_lcdcfb.c | 11 +----------
>  include/linux/fb.h                     |  4 ----
>  include/linux/fbcon.h                  |  2 ++
>  6 files changed, 14 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
> index 4b40c6a4d441..16298041b141 100644
> --- a/drivers/video/backlight/lcd.c
> +++ b/drivers/video/backlight/lcd.c
> @@ -32,8 +32,6 @@ static int fb_notifier_callback(struct notifier_block *self,
>  	/* If we aren't interested in this event, skip it immediately ... */
>  	switch (event) {
>  	case FB_EVENT_BLANK:
> -	case FB_EVENT_MODE_CHANGE:
> -	case FB_EVENT_MODE_CHANGE_ALL:
>  	case FB_EARLY_EVENT_BLANK:
>  	case FB_R_EARLY_EVENT_BLANK:
>  		break;

Below it performs a call to set_mode() if it's none of the blanking events; it can be removed. :)

> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index c1a7476e980f..8cc62d340387 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -3005,6 +3005,15 @@ static void fbcon_set_all_vcs(struct fb_info *info)
>  		fbcon_modechanged(info);
>  }
>  
> +
> +void fbcon_update_vcs(struct fb_info *info, bool all)
> +{
> +	if (all)
> +		fbcon_set_all_vcs(info);
> +	else
> +		fbcon_modechanged(info);
> +}
> +
>  int fbcon_mode_deleted(struct fb_info *info,
>  		       struct fb_videomode *mode)
>  {
> @@ -3314,12 +3323,6 @@ static int fbcon_event_notify(struct notifier_block *self,
>  	int idx, ret = 0;
>  
>  	switch(action) {
> -	case FB_EVENT_MODE_CHANGE:
> -		fbcon_modechanged(info);
> -		break;
> -	case FB_EVENT_MODE_CHANGE_ALL:
> -		fbcon_set_all_vcs(info);
> -		break;
>  	case FB_EVENT_SET_CONSOLE_MAP:
>  		/* called with console lock held */
>  		con2fb = event->data;
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index cbd58ba8a59d..55b88163edc2 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1039,17 +1039,8 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
>  	    !list_empty(&info->modelist))
>  		ret = fb_add_videomode(&mode, &info->modelist);
>  
> -	if (!ret && (flags & FBINFO_MISC_USEREVENT)) {
> -		struct fb_event event;
> -		int evnt = (activate & FB_ACTIVATE_ALL) ?
> -			FB_EVENT_MODE_CHANGE_ALL :
> -			FB_EVENT_MODE_CHANGE;
> -
> -		info->flags &= ~FBINFO_MISC_USEREVENT;
> -		event.info = info;
> -		event.data = &mode;
> -		fb_notifier_call_chain(evnt, &event);
> -	}
> +	if (!ret && (flags & FBINFO_MISC_USEREVENT))
> +		fbcon_update_vcs(info, activate & FB_ACTIVATE_ALL);
>  
>  	return ret;
>  }
> diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c
> index 0d7a044852d7..bb1a610d0363 100644
> --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
> +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
> @@ -1776,8 +1776,6 @@ static void sh_mobile_fb_reconfig(struct fb_info *info)
>  	struct sh_mobile_lcdc_chan *ch = info->par;
>  	struct fb_var_screeninfo var;
>  	struct fb_videomode mode;
> -	struct fb_event event;
> -	int evnt = FB_EVENT_MODE_CHANGE_ALL;
>  
>  	if (ch->use_count > 1 || (ch->use_count = 1 && !info->fbcon_par))
>  		/* More framebuffer users are active */
> @@ -1799,14 +1797,7 @@ static void sh_mobile_fb_reconfig(struct fb_info *info)
>  		/* Couldn't reconfigure, hopefully, can continue as before */
>  		return;
>  
> -	/*
> -	 * fb_set_var() calls the notifier change internally, only if
> -	 * FBINFO_MISC_USEREVENT flag is set. Since we do not want to fake a
> -	 * user event, we have to call the chain ourselves.
> -	 */
> -	event.info = info;
> -	event.data = &ch->display.mode;
> -	fb_notifier_call_chain(evnt, &event);
> +	fbcon_update_vcs(info, true);
>  }
>  
>  /*
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 4b9b882f8f52..54d6bee09121 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -124,16 +124,12 @@ struct fb_cursor_user {
>   * Register/unregister for framebuffer events
>   */
>  
> -/*	The resolution of the passed in fb_info about to change */ 
> -#define FB_EVENT_MODE_CHANGE		0x01
>  /*      CONSOLE-SPECIFIC: get console to framebuffer mapping */
>  #define FB_EVENT_GET_CONSOLE_MAP        0x07
>  /*      CONSOLE-SPECIFIC: set console to framebuffer mapping */
>  #define FB_EVENT_SET_CONSOLE_MAP        0x08
>  /*      A display blank is requested       */
>  #define FB_EVENT_BLANK                  0x09
> -/*      Private modelist is to be replaced */
> -#define FB_EVENT_MODE_CHANGE_ALL	0x0B
>  /*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
>  #define FB_EVENT_REMAP_ALL_CONSOLE      0x0F
>  /*      A hardware display blank early change occurred */
> diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
> index 90e196c835dd..daaa97b0c9e6 100644
> --- a/include/linux/fbcon.h
> +++ b/include/linux/fbcon.h
> @@ -15,6 +15,7 @@ void fbcon_new_modelist(struct fb_info *info);
>  void fbcon_get_requirement(struct fb_info *info,
>  			   struct fb_blit_caps *caps);
>  void fbcon_fb_blanked(struct fb_info *info, int blank);
> +void fbcon_update_vcs(struct fb_info *info, bool all);
>  #else
>  static inline void fb_console_init(void) {}
>  static inline void fb_console_exit(void) {}
> @@ -29,6 +30,7 @@ void fbcon_new_modelist(struct fb_info *info) {}
>  void fbcon_get_requirement(struct fb_info *info,
>  			   struct fb_blit_caps *caps) {}
>  void fbcon_fb_blanked(struct fb_info *info, int blank) {}
> +void fbcon_update_vcs(struct fb_info *info, bool all) {}
>  #endif
>  
>  #endif /* _LINUX_FBCON_H */

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 29/33] fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls
  2019-05-21 10:56   ` Maarten Lankhorst
@ 2019-05-21 12:42     ` Daniel Vetter
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-21 12:42 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: Daniel Thompson, Bartlomiej Zolnierkiewicz, Daniel Vetter,
	Intel Graphics Development, LKML, DRI Development,
	Michał Mirosław, Yisheng Xie, Hans de Goede,
	Mikulas Patocka, linux-fbdev, Jingoo Han, Daniel Vetter,
	Lee Jones, Peter Rosin

On Tue, May 21, 2019 at 12:56:30PM +0200, Maarten Lankhorst wrote:
> Op 20-05-2019 om 10:22 schreef Daniel Vetter:
> > Create a new wrapper function for this, feels like there's some
> > refactoring room here between the two modes.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Cc: Daniel Thompson <daniel.thompson@linaro.org>
> > Cc: Jingoo Han <jingoohan1@gmail.com>
> > Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Hans de Goede <hdegoede@redhat.com>
> > Cc: Yisheng Xie <ysxie@foxmail.com>
> > Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
> > Cc: Peter Rosin <peda@axentia.se>
> > Cc: Mikulas Patocka <mpatocka@redhat.com>
> > Cc: linux-fbdev@vger.kernel.org
> > ---
> >  drivers/video/backlight/lcd.c          |  2 --
> >  drivers/video/fbdev/core/fbcon.c       | 15 +++++++++------
> >  drivers/video/fbdev/core/fbmem.c       | 13 ++-----------
> >  drivers/video/fbdev/sh_mobile_lcdcfb.c | 11 +----------
> >  include/linux/fb.h                     |  4 ----
> >  include/linux/fbcon.h                  |  2 ++
> >  6 files changed, 14 insertions(+), 33 deletions(-)
> >
> > diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
> > index 4b40c6a4d441..16298041b141 100644
> > --- a/drivers/video/backlight/lcd.c
> > +++ b/drivers/video/backlight/lcd.c
> > @@ -32,8 +32,6 @@ static int fb_notifier_callback(struct notifier_block *self,
> >  	/* If we aren't interested in this event, skip it immediately ... */
> >  	switch (event) {
> >  	case FB_EVENT_BLANK:
> > -	case FB_EVENT_MODE_CHANGE:
> > -	case FB_EVENT_MODE_CHANGE_ALL:
> >  	case FB_EARLY_EVENT_BLANK:
> >  	case FB_R_EARLY_EVENT_BLANK:
> >  		break;
> 
> Below it performs a call to set_mode() if it's none of the blanking events; it can be removed. :)

Oops ... I think I'll insert a patch here to create a new MODESET event
for backlights. We still need this one I think (maybe not for kms, but for
old fbdev drivers). And maybe a wrapper for fb_backlight_notify on top ...

Thanks for spotting this.
-Daniel

> 
> > diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> > index c1a7476e980f..8cc62d340387 100644
> > --- a/drivers/video/fbdev/core/fbcon.c
> > +++ b/drivers/video/fbdev/core/fbcon.c
> > @@ -3005,6 +3005,15 @@ static void fbcon_set_all_vcs(struct fb_info *info)
> >  		fbcon_modechanged(info);
> >  }
> >  
> > +
> > +void fbcon_update_vcs(struct fb_info *info, bool all)
> > +{
> > +	if (all)
> > +		fbcon_set_all_vcs(info);
> > +	else
> > +		fbcon_modechanged(info);
> > +}
> > +
> >  int fbcon_mode_deleted(struct fb_info *info,
> >  		       struct fb_videomode *mode)
> >  {
> > @@ -3314,12 +3323,6 @@ static int fbcon_event_notify(struct notifier_block *self,
> >  	int idx, ret = 0;
> >  
> >  	switch(action) {
> > -	case FB_EVENT_MODE_CHANGE:
> > -		fbcon_modechanged(info);
> > -		break;
> > -	case FB_EVENT_MODE_CHANGE_ALL:
> > -		fbcon_set_all_vcs(info);
> > -		break;
> >  	case FB_EVENT_SET_CONSOLE_MAP:
> >  		/* called with console lock held */
> >  		con2fb = event->data;
> > diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> > index cbd58ba8a59d..55b88163edc2 100644
> > --- a/drivers/video/fbdev/core/fbmem.c
> > +++ b/drivers/video/fbdev/core/fbmem.c
> > @@ -1039,17 +1039,8 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
> >  	    !list_empty(&info->modelist))
> >  		ret = fb_add_videomode(&mode, &info->modelist);
> >  
> > -	if (!ret && (flags & FBINFO_MISC_USEREVENT)) {
> > -		struct fb_event event;
> > -		int evnt = (activate & FB_ACTIVATE_ALL) ?
> > -			FB_EVENT_MODE_CHANGE_ALL :
> > -			FB_EVENT_MODE_CHANGE;
> > -
> > -		info->flags &= ~FBINFO_MISC_USEREVENT;
> > -		event.info = info;
> > -		event.data = &mode;
> > -		fb_notifier_call_chain(evnt, &event);
> > -	}
> > +	if (!ret && (flags & FBINFO_MISC_USEREVENT))
> > +		fbcon_update_vcs(info, activate & FB_ACTIVATE_ALL);
> >  
> >  	return ret;
> >  }
> > diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c
> > index 0d7a044852d7..bb1a610d0363 100644
> > --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
> > +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
> > @@ -1776,8 +1776,6 @@ static void sh_mobile_fb_reconfig(struct fb_info *info)
> >  	struct sh_mobile_lcdc_chan *ch = info->par;
> >  	struct fb_var_screeninfo var;
> >  	struct fb_videomode mode;
> > -	struct fb_event event;
> > -	int evnt = FB_EVENT_MODE_CHANGE_ALL;
> >  
> >  	if (ch->use_count > 1 || (ch->use_count = 1 && !info->fbcon_par))
> >  		/* More framebuffer users are active */
> > @@ -1799,14 +1797,7 @@ static void sh_mobile_fb_reconfig(struct fb_info *info)
> >  		/* Couldn't reconfigure, hopefully, can continue as before */
> >  		return;
> >  
> > -	/*
> > -	 * fb_set_var() calls the notifier change internally, only if
> > -	 * FBINFO_MISC_USEREVENT flag is set. Since we do not want to fake a
> > -	 * user event, we have to call the chain ourselves.
> > -	 */
> > -	event.info = info;
> > -	event.data = &ch->display.mode;
> > -	fb_notifier_call_chain(evnt, &event);
> > +	fbcon_update_vcs(info, true);
> >  }
> >  
> >  /*
> > diff --git a/include/linux/fb.h b/include/linux/fb.h
> > index 4b9b882f8f52..54d6bee09121 100644
> > --- a/include/linux/fb.h
> > +++ b/include/linux/fb.h
> > @@ -124,16 +124,12 @@ struct fb_cursor_user {
> >   * Register/unregister for framebuffer events
> >   */
> >  
> > -/*	The resolution of the passed in fb_info about to change */ 
> > -#define FB_EVENT_MODE_CHANGE		0x01
> >  /*      CONSOLE-SPECIFIC: get console to framebuffer mapping */
> >  #define FB_EVENT_GET_CONSOLE_MAP        0x07
> >  /*      CONSOLE-SPECIFIC: set console to framebuffer mapping */
> >  #define FB_EVENT_SET_CONSOLE_MAP        0x08
> >  /*      A display blank is requested       */
> >  #define FB_EVENT_BLANK                  0x09
> > -/*      Private modelist is to be replaced */
> > -#define FB_EVENT_MODE_CHANGE_ALL	0x0B
> >  /*      CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
> >  #define FB_EVENT_REMAP_ALL_CONSOLE      0x0F
> >  /*      A hardware display blank early change occurred */
> > diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
> > index 90e196c835dd..daaa97b0c9e6 100644
> > --- a/include/linux/fbcon.h
> > +++ b/include/linux/fbcon.h
> > @@ -15,6 +15,7 @@ void fbcon_new_modelist(struct fb_info *info);
> >  void fbcon_get_requirement(struct fb_info *info,
> >  			   struct fb_blit_caps *caps);
> >  void fbcon_fb_blanked(struct fb_info *info, int blank);
> > +void fbcon_update_vcs(struct fb_info *info, bool all);
> >  #else
> >  static inline void fb_console_init(void) {}
> >  static inline void fb_console_exit(void) {}
> > @@ -29,6 +30,7 @@ void fbcon_new_modelist(struct fb_info *info) {}
> >  void fbcon_get_requirement(struct fb_info *info,
> >  			   struct fb_blit_caps *caps) {}
> >  void fbcon_fb_blanked(struct fb_info *info, int blank) {}
> > +void fbcon_update_vcs(struct fb_info *info, bool all) {}
> >  #endif
> >  
> >  #endif /* _LINUX_FBCON_H */
> 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly
  2019-05-20  8:37     ` Thomas Zimmermann
@ 2019-05-21 15:09       ` Daniel Vetter
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-21 15:09 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Daniel Vetter, DRI Development, Intel Graphics Development, LKML,
	Daniel Vetter, Bartlomiej Zolnierkiewicz, Hans de Goede,
	Greg Kroah-Hartman, Noralf Trønnes, Yisheng Xie, Peter Rosin,
	Michał Mirosław, Mikulas Patocka, linux-fbdev

On Mon, May 20, 2019 at 10:37:53AM +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 20.05.19 um 10:33 schrieb Thomas Zimmermann:
> > 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.
> 
> I just saw that backlight drivers only care about blanking and
> unblanking. Never mind then.

I did screw this up for one event for the mode changes. But should be
fixed in the next series.

I also added a patch to simplify the backlight/lcd notifier, since it
doesn't need to filter events anymore after this series - the only events
left are the ones backlight cares about.

Cheers, Daniel

> 
> Best regards
> Thomas
> 
> > 
> > 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)
> 




-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly
       [not found] <20190524085354.27411-1-daniel.vetter@ffwll.ch>
@ 2019-05-24  8:53 ` Daniel Vetter
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-24  8:53 UTC (permalink / raw)
  To: LKML
  Cc: Intel Graphics Development, DRI Development, Daniel Vetter,
	Daniel Vetter, Bartlomiej Zolnierkiewicz, Hans de Goede,
	Greg Kroah-Hartman, Noralf Trønnes, Yisheng Xie, Peter Rosin,
	Michał Mirosław, Thomas Zimmermann, Mikulas Patocka,
	linux-fbdev, Daniel Mack, Haojian Zhuang, Robert Jarzmik

With

commit 6104c37094e729f3d4ce65797002112735d49cd1
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Tue Aug 1 17:32:07 2017 +0200

    fbcon: Make fbcon a built-time depency for fbdev

we have a static dependency between fbcon and fbdev, and we can
replace the indirection through the notifier chain with a function
call.

v2: Sam Ravnborg noticed that mach-pxa/am200epd.c has a notifier too,
and listens to this.

...

Looking at the code it seems to wait for some fb to show up, so that
it can get the framebuffer base address from the fb_info struct. I
suspect his is some firmware fbdev. Then it uses that information to
let the real fbdev driver (metronomefb.c by the looks) get at the
framebuffer memory.

This doesn't looke like it's easy to fix (except by deleting the
entire thing, seems untouched since 2008, we might be able to get away
with that), so let's just stuff a few #ifdef into fb.h and fbmem.c and
cry over them for a bit.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Yisheng Xie <ysxie@foxmail.com>
Cc: Peter Rosin <peda@axentia.se>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Steve Sakoman <sakoman@gmail.com>
Cc: Steve Sakoman <steve@sakoman.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm/mach-pxa/am200epd.c     | 13 +++++++++++--
 drivers/video/fbdev/core/fbcon.c | 14 +++-----------
 drivers/video/fbdev/core/fbmem.c | 24 +++++++++++++++++-------
 include/linux/fb.h               |  7 +++++--
 include/linux/fbcon.h            |  4 ++++
 5 files changed, 40 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c
index 50e18ed37fa6..cac0bb09db14 100644
--- a/arch/arm/mach-pxa/am200epd.c
+++ b/arch/arm/mach-pxa/am200epd.c
@@ -347,8 +347,17 @@ int __init am200_init(void)
 {
 	int ret;
 
-	/* before anything else, we request notification for any fb
-	 * creation events */
+	/*
+	 * Before anything else, we request notification for any fb
+	 * creation events.
+	 *
+	 * FIXME: This is terrible and needs to be nuked. The notifier is used
+	 * to get at the fb base address from the boot splash fb driver, which
+	 * is then passed to metronomefb. Instaed of metronomfb or this board
+	 * support file here figuring this out on their own.
+	 *
+	 * See also the #ifdef in fbmem.c.
+	 */
 	fb_register_client(&am200_fb_notif);
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(am200_pin_config));
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 622d336cfc81..54d01f7284cb 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3119,14 +3119,14 @@ static int fbcon_fb_unbind(int idx)
 }
 
 /* called with console_lock held */
-static int fbcon_fb_unregistered(struct fb_info *info)
+void fbcon_fb_unregistered(struct fb_info *info)
 {
 	int i, idx;
 
 	WARN_CONSOLE_UNLOCKED();
 
 	if (deferred_takeover)
-		return 0;
+		return;
 
 	idx = info->node;
 	for (i = first_fb_vc; i <= last_fb_vc; i++) {
@@ -3155,8 +3155,6 @@ static int fbcon_fb_unregistered(struct fb_info *info)
 
 	if (!num_registered_fb)
 		do_unregister_con_driver(&fb_con);
-
-	return 0;
 }
 
 /* called with console_lock held */
@@ -3215,7 +3213,7 @@ static inline void fbcon_select_primary(struct fb_info *info)
 #endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */
 
 /* called with console_lock held */
-static int fbcon_fb_registered(struct fb_info *info)
+int fbcon_fb_registered(struct fb_info *info)
 {
 	int ret = 0, i, idx;
 
@@ -3359,12 +3357,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 		idx = info->node;
 		ret = fbcon_fb_unbind(idx);
 		break;
-	case FB_EVENT_FB_REGISTERED:
-		ret = fbcon_fb_registered(info);
-		break;
-	case FB_EVENT_FB_UNREGISTERED:
-		ret = fbcon_fb_unregistered(info);
-		break;
 	case FB_EVENT_SET_CONSOLE_MAP:
 		/* called with console lock held */
 		con2fb = event->data;
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 8ba674ffb3c9..bed7698ad18a 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,14 @@ 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;
+#ifdef CONFIG_GUMSTIX_AM200EPD
+	{
+		struct fb_event event;
+		event.info = fb_info;
+		fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
+	}
+#endif
+
 	if (!lockless_register_fb)
 		console_lock();
 	else
@@ -1732,9 +1738,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);
 	unlock_fb_info(fb_info);
 unlock_console:
 	if (!lockless_register_fb)
@@ -1771,7 +1776,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 +1793,15 @@ 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;
+#ifdef CONFIG_GUMSTIX_AM200EPD
+	{
+		struct fb_event event;
+		event.info = fb_info;
+		fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
+	}
+#endif
 	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..288175fafaf6 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -136,10 +136,13 @@ 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 */
+
+#ifdef CONFIG_GUMSTIX_AM200EPD
+/* only used by mach-pxa/am200epd.c */
 #define FB_EVENT_FB_REGISTERED          0x05
-/*      A driver unregistered itself */
 #define FB_EVENT_FB_UNREGISTERED        0x06
+#endif
+
 /*      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 */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly
  2019-05-28  9:02 [PATCH 00/33] fbcon notifier begone v3! Daniel Vetter
@ 2019-05-28  9:02 ` Daniel Vetter
  0 siblings, 0 replies; 25+ messages in thread
From: Daniel Vetter @ 2019-05-28  9:02 UTC (permalink / raw)
  To: LKML
  Cc: DRI Development, Intel Graphics Development, linux-fbdev,
	Daniel Thompson, Bartlomiej Zolnierkiewicz, Daniel Vetter,
	Daniel Vetter, Sam Ravnborg, Maarten Lankhorst, Hans de Goede,
	Greg Kroah-Hartman, Noralf Trønnes, Yisheng Xie, Peter Rosin,
	Michał Mirosław, Thomas Zimmermann, Mikulas Patocka

With

commit 6104c37094e729f3d4ce65797002112735d49cd1
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Tue Aug 1 17:32:07 2017 +0200

    fbcon: Make fbcon a built-time depency for fbdev

we have a static dependency between fbcon and fbdev, and we can
replace the indirection through the notifier chain with a function
call.

v2: Sam Ravnborg noticed that mach-pxa/am200epd.c has a notifier too,
and listens to this.

...

Looking at the code it seems to wait for some fb to show up, so that
it can get the framebuffer base address from the fb_info struct. I
suspect his is some firmware fbdev. Then it uses that information to
let the real fbdev driver (metronomefb.c by the looks) get at the
framebuffer memory.

This doesn't looke like it's easy to fix (except by deleting the
entire thing, seems untouched since 2008, we might be able to get away
with that), so let's just stuff a few #ifdef into fb.h and fbmem.c and
cry over them for a bit.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Yisheng Xie <ysxie@foxmail.com>
Cc: Peter Rosin <peda@axentia.se>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Daniel Mack <daniel@zonque.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Steve Sakoman <sakoman@gmail.com>
Cc: Steve Sakoman <steve@sakoman.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm/mach-pxa/am200epd.c     | 13 +++++++++++--
 drivers/video/fbdev/core/fbcon.c | 14 +++-----------
 drivers/video/fbdev/core/fbmem.c | 24 +++++++++++++++++-------
 include/linux/fb.h               |  7 +++++--
 include/linux/fbcon.h            |  4 ++++
 5 files changed, 40 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c
index 50e18ed37fa6..cac0bb09db14 100644
--- a/arch/arm/mach-pxa/am200epd.c
+++ b/arch/arm/mach-pxa/am200epd.c
@@ -347,8 +347,17 @@ int __init am200_init(void)
 {
 	int ret;
 
-	/* before anything else, we request notification for any fb
-	 * creation events */
+	/*
+	 * Before anything else, we request notification for any fb
+	 * creation events.
+	 *
+	 * FIXME: This is terrible and needs to be nuked. The notifier is used
+	 * to get at the fb base address from the boot splash fb driver, which
+	 * is then passed to metronomefb. Instaed of metronomfb or this board
+	 * support file here figuring this out on their own.
+	 *
+	 * See also the #ifdef in fbmem.c.
+	 */
 	fb_register_client(&am200_fb_notif);
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(am200_pin_config));
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index e11bae2787e6..5a9fe0c0dd3c 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3119,14 +3119,14 @@ static int fbcon_fb_unbind(int idx)
 }
 
 /* called with console_lock held */
-static int fbcon_fb_unregistered(struct fb_info *info)
+void fbcon_fb_unregistered(struct fb_info *info)
 {
 	int i, idx;
 
 	WARN_CONSOLE_UNLOCKED();
 
 	if (deferred_takeover)
-		return 0;
+		return;
 
 	idx = info->node;
 	for (i = first_fb_vc; i <= last_fb_vc; i++) {
@@ -3155,8 +3155,6 @@ static int fbcon_fb_unregistered(struct fb_info *info)
 
 	if (!num_registered_fb)
 		do_unregister_con_driver(&fb_con);
-
-	return 0;
 }
 
 /* called with console_lock held */
@@ -3215,7 +3213,7 @@ static inline void fbcon_select_primary(struct fb_info *info)
 #endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */
 
 /* called with console_lock held */
-static int fbcon_fb_registered(struct fb_info *info)
+int fbcon_fb_registered(struct fb_info *info)
 {
 	int ret = 0, i, idx;
 
@@ -3359,12 +3357,6 @@ static int fbcon_event_notify(struct notifier_block *self,
 		idx = info->node;
 		ret = fbcon_fb_unbind(idx);
 		break;
-	case FB_EVENT_FB_REGISTERED:
-		ret = fbcon_fb_registered(info);
-		break;
-	case FB_EVENT_FB_UNREGISTERED:
-		ret = fbcon_fb_unregistered(info);
-		break;
 	case FB_EVENT_SET_CONSOLE_MAP:
 		/* called with console lock held */
 		con2fb = event->data;
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 8ba674ffb3c9..bed7698ad18a 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,14 @@ 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;
+#ifdef CONFIG_GUMSTIX_AM200EPD
+	{
+		struct fb_event event;
+		event.info = fb_info;
+		fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
+	}
+#endif
+
 	if (!lockless_register_fb)
 		console_lock();
 	else
@@ -1732,9 +1738,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);
 	unlock_fb_info(fb_info);
 unlock_console:
 	if (!lockless_register_fb)
@@ -1771,7 +1776,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 +1793,15 @@ 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;
+#ifdef CONFIG_GUMSTIX_AM200EPD
+	{
+		struct fb_event event;
+		event.info = fb_info;
+		fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
+	}
+#endif
 	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..288175fafaf6 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -136,10 +136,13 @@ 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 */
+
+#ifdef CONFIG_GUMSTIX_AM200EPD
+/* only used by mach-pxa/am200epd.c */
 #define FB_EVENT_FB_REGISTERED          0x05
-/*      A driver unregistered itself */
 #define FB_EVENT_FB_UNREGISTERED        0x06
+#endif
+
 /*      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 */
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2019-05-28  9:02 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190520082216.26273-1-daniel.vetter@ffwll.ch>
2019-05-20  8:21 ` [PATCH 07/33] fbdev/aty128fb: Remove dead code Daniel Vetter
2019-05-20  8:21 ` [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly Daniel Vetter
2019-05-20  8:33   ` Thomas Zimmermann
2019-05-20  8:37     ` Thomas Zimmermann
2019-05-21 15:09       ` Daniel Vetter
2019-05-20 17:08   ` Sam Ravnborg
2019-05-20 17:25     ` Daniel Vetter
2019-05-20  8:21 ` [PATCH 16/33] fbdev: lock_fb_info cannot fail Daniel Vetter
2019-05-20  8:22 ` [PATCH 17/33] fbcon: call fbcon_fb_bind directly Daniel Vetter
2019-05-20  8:22 ` [PATCH 18/33] fbdev: make unregister/unlink functions not fail Daniel Vetter
2019-05-20 19:08   ` [Intel-gfx] " kbuild test robot
2019-05-20 19:25   ` kbuild test robot
2019-05-20 21:45   ` kbuild test robot
2019-05-20  8:22 ` [PATCH 21/33] fbdev: directly call fbcon_suspended/resumed Daniel Vetter
2019-05-20 19:24   ` kbuild test robot
2019-05-20  8:22 ` [PATCH 22/33] fbcon: Call fbcon_mode_deleted/new_modelist directly Daniel Vetter
2019-05-20  8:22 ` [PATCH 23/33] fbdev: Call fbcon_get_requirement directly Daniel Vetter
2019-05-20  8:22 ` [PATCH 24/33] Revert "backlight/fbcon: Add FB_EVENT_CONBLANK" Daniel Vetter
2019-05-20  8:22 ` [PATCH 29/33] fbcon: replace FB_EVENT_MODE_CHANGE/_ALL with direct calls Daniel Vetter
2019-05-21 10:56   ` Maarten Lankhorst
2019-05-21 12:42     ` Daniel Vetter
2019-05-20  8:22 ` [PATCH 30/33] vgaswitcheroo: call fbcon_remap_all directly Daniel Vetter
2019-05-20  8:37   ` Lukas Wunner
     [not found] <20190524085354.27411-1-daniel.vetter@ffwll.ch>
2019-05-24  8:53 ` [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly Daniel Vetter
2019-05-28  9:02 [PATCH 00/33] fbcon notifier begone v3! Daniel Vetter
2019-05-28  9:02 ` [PATCH 10/33] fbcon: call fbcon_fb_(un)registered directly Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).