summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2019-05-28 05:02:41 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2019-06-12 14:27:45 -0400
commit97b67986f1451c772b488d597310f95c14547cce (patch)
treee3dd1e1fe055ba6c78f9b511e937ee9e4f049a88
parent1f4ed2fb01f80faa722f71efd3791e1d1f337010 (diff)
fbcon: call fbcon_fb_(un)registered directly
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 Link: https://patchwork.freedesktop.org/patch/msgid/20190528090304.9388-11-daniel.vetter@ffwll.ch
-rw-r--r--arch/arm/mach-pxa/am200epd.c13
-rw-r--r--drivers/video/fbdev/core/fbcon.c14
-rw-r--r--drivers/video/fbdev/core/fbmem.c24
-rw-r--r--include/linux/fb.h7
-rw-r--r--include/linux/fbcon.h4
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)
347{ 347{
348 int ret; 348 int ret;
349 349
350 /* before anything else, we request notification for any fb 350 /*
351 * creation events */ 351 * Before anything else, we request notification for any fb
352 * creation events.
353 *
354 * FIXME: This is terrible and needs to be nuked. The notifier is used
355 * to get at the fb base address from the boot splash fb driver, which
356 * is then passed to metronomefb. Instaed of metronomfb or this board
357 * support file here figuring this out on their own.
358 *
359 * See also the #ifdef in fbmem.c.
360 */
352 fb_register_client(&am200_fb_notif); 361 fb_register_client(&am200_fb_notif);
353 362
354 pxa2xx_mfp_config(ARRAY_AND_SIZE(am200_pin_config)); 363 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 9c14eab77d99..c12fc98035e0 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)
3119} 3119}
3120 3120
3121/* called with console_lock held */ 3121/* called with console_lock held */
3122static int fbcon_fb_unregistered(struct fb_info *info) 3122void fbcon_fb_unregistered(struct fb_info *info)
3123{ 3123{
3124 int i, idx; 3124 int i, idx;
3125 3125
3126 WARN_CONSOLE_UNLOCKED(); 3126 WARN_CONSOLE_UNLOCKED();
3127 3127
3128 if (deferred_takeover) 3128 if (deferred_takeover)
3129 return 0; 3129 return;
3130 3130
3131 idx = info->node; 3131 idx = info->node;
3132 for (i = first_fb_vc; i <= last_fb_vc; i++) { 3132 for (i = first_fb_vc; i <= last_fb_vc; i++) {
@@ -3155,8 +3155,6 @@ static int fbcon_fb_unregistered(struct fb_info *info)
3155 3155
3156 if (!num_registered_fb) 3156 if (!num_registered_fb)
3157 do_unregister_con_driver(&fb_con); 3157 do_unregister_con_driver(&fb_con);
3158
3159 return 0;
3160} 3158}
3161 3159
3162/* called with console_lock held */ 3160/* called with console_lock held */
@@ -3215,7 +3213,7 @@ static inline void fbcon_select_primary(struct fb_info *info)
3215#endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */ 3213#endif /* CONFIG_FRAMEBUFFER_DETECT_PRIMARY */
3216 3214
3217/* called with console_lock held */ 3215/* called with console_lock held */
3218static int fbcon_fb_registered(struct fb_info *info) 3216int fbcon_fb_registered(struct fb_info *info)
3219{ 3217{
3220 int ret = 0, i, idx; 3218 int ret = 0, i, idx;
3221 3219
@@ -3359,12 +3357,6 @@ static int fbcon_event_notify(struct notifier_block *self,
3359 idx = info->node; 3357 idx = info->node;
3360 ret = fbcon_fb_unbind(idx); 3358 ret = fbcon_fb_unbind(idx);
3361 break; 3359 break;
3362 case FB_EVENT_FB_REGISTERED:
3363 ret = fbcon_fb_registered(info);
3364 break;
3365 case FB_EVENT_FB_UNREGISTERED:
3366 ret = fbcon_fb_unregistered(info);
3367 break;
3368 case FB_EVENT_SET_CONSOLE_MAP: 3360 case FB_EVENT_SET_CONSOLE_MAP:
3369 /* called with console lock held */ 3361 /* called with console lock held */
3370 con2fb = event->data; 3362 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,
1660static int do_register_framebuffer(struct fb_info *fb_info) 1660static int do_register_framebuffer(struct fb_info *fb_info)
1661{ 1661{
1662 int i, ret; 1662 int i, ret;
1663 struct fb_event event;
1664 struct fb_videomode mode; 1663 struct fb_videomode mode;
1665 1664
1666 if (fb_check_foreignness(fb_info)) 1665 if (fb_check_foreignness(fb_info))
@@ -1723,7 +1722,14 @@ static int do_register_framebuffer(struct fb_info *fb_info)
1723 fb_add_videomode(&mode, &fb_info->modelist); 1722 fb_add_videomode(&mode, &fb_info->modelist);
1724 registered_fb[i] = fb_info; 1723 registered_fb[i] = fb_info;
1725 1724
1726 event.info = fb_info; 1725#ifdef CONFIG_GUMSTIX_AM200EPD
1726 {
1727 struct fb_event event;
1728 event.info = fb_info;
1729 fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
1730 }
1731#endif
1732
1727 if (!lockless_register_fb) 1733 if (!lockless_register_fb)
1728 console_lock(); 1734 console_lock();
1729 else 1735 else
@@ -1732,9 +1738,8 @@ static int do_register_framebuffer(struct fb_info *fb_info)
1732 ret = -ENODEV; 1738 ret = -ENODEV;
1733 goto unlock_console; 1739 goto unlock_console;
1734 } 1740 }
1735 ret = 0;
1736 1741
1737 fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event); 1742 ret = fbcon_fb_registered(fb_info);
1738 unlock_fb_info(fb_info); 1743 unlock_fb_info(fb_info);
1739unlock_console: 1744unlock_console:
1740 if (!lockless_register_fb) 1745 if (!lockless_register_fb)
@@ -1771,7 +1776,6 @@ static int __unlink_framebuffer(struct fb_info *fb_info);
1771 1776
1772static int do_unregister_framebuffer(struct fb_info *fb_info) 1777static int do_unregister_framebuffer(struct fb_info *fb_info)
1773{ 1778{
1774 struct fb_event event;
1775 int ret; 1779 int ret;
1776 1780
1777 ret = unbind_console(fb_info); 1781 ret = unbind_console(fb_info);
@@ -1789,9 +1793,15 @@ static int do_unregister_framebuffer(struct fb_info *fb_info)
1789 registered_fb[fb_info->node] = NULL; 1793 registered_fb[fb_info->node] = NULL;
1790 num_registered_fb--; 1794 num_registered_fb--;
1791 fb_cleanup_device(fb_info); 1795 fb_cleanup_device(fb_info);
1792 event.info = fb_info; 1796#ifdef CONFIG_GUMSTIX_AM200EPD
1797 {
1798 struct fb_event event;
1799 event.info = fb_info;
1800 fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
1801 }
1802#endif
1793 console_lock(); 1803 console_lock();
1794 fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); 1804 fbcon_fb_unregistered(fb_info);
1795 console_unlock(); 1805 console_unlock();
1796 1806
1797 /* this may free fb info */ 1807 /* 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 {
136#define FB_EVENT_RESUME 0x03 136#define FB_EVENT_RESUME 0x03
137/* An entry from the modelist was removed */ 137/* An entry from the modelist was removed */
138#define FB_EVENT_MODE_DELETE 0x04 138#define FB_EVENT_MODE_DELETE 0x04
139/* A driver registered itself */ 139
140#ifdef CONFIG_GUMSTIX_AM200EPD
141/* only used by mach-pxa/am200epd.c */
140#define FB_EVENT_FB_REGISTERED 0x05 142#define FB_EVENT_FB_REGISTERED 0x05
141/* A driver unregistered itself */
142#define FB_EVENT_FB_UNREGISTERED 0x06 143#define FB_EVENT_FB_UNREGISTERED 0x06
144#endif
145
143/* CONSOLE-SPECIFIC: get console to framebuffer mapping */ 146/* CONSOLE-SPECIFIC: get console to framebuffer mapping */
144#define FB_EVENT_GET_CONSOLE_MAP 0x07 147#define FB_EVENT_GET_CONSOLE_MAP 0x07
145/* CONSOLE-SPECIFIC: set console to framebuffer mapping */ 148/* 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 @@
4#ifdef CONFIG_FRAMEBUFFER_CONSOLE 4#ifdef CONFIG_FRAMEBUFFER_CONSOLE
5void __init fb_console_init(void); 5void __init fb_console_init(void);
6void __exit fb_console_exit(void); 6void __exit fb_console_exit(void);
7int fbcon_fb_registered(struct fb_info *info);
8void fbcon_fb_unregistered(struct fb_info *info);
7#else 9#else
8static inline void fb_console_init(void) {} 10static inline void fb_console_init(void) {}
9static inline void fb_console_exit(void) {} 11static inline void fb_console_exit(void) {}
12static inline int fbcon_fb_registered(struct fb_info *info) { return 0; }
13static inline void fbcon_fb_unregistered(struct fb_info *info) {}
10#endif 14#endif
11 15
12#endif /* _LINUX_FBCON_H */ 16#endif /* _LINUX_FBCON_H */