summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2019-05-28 05:02:53 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2019-06-12 14:29:16 -0400
commit13ff178ccd6d3b8074c542a911300b79c4eec255 (patch)
tree566be65297e7b6cf45aa4cebd6b773a781584dc9
parent50c5056356340c8b5be90440d2f32fec8c47a7c3 (diff)
fbcon: Call fbcon_mode_deleted/new_modelist directly
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. v2: static inline for the dummy versions, I forgot. 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: 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 Link: https://patchwork.freedesktop.org/patch/msgid/20190528090304.9388-23-daniel.vetter@ffwll.ch
-rw-r--r--drivers/video/fbdev/core/fbcon.c14
-rw-r--r--drivers/video/fbdev/core/fbmem.c22
-rw-r--r--include/linux/fb.h5
-rw-r--r--include/linux/fbcon.h6
4 files changed, 16 insertions, 31 deletions
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 9994111f2563..24bd6cd270d5 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -3019,8 +3019,8 @@ static void fbcon_set_all_vcs(struct fb_info *info)
3019 fbcon_modechanged(info); 3019 fbcon_modechanged(info);
3020} 3020}
3021 3021
3022static int fbcon_mode_deleted(struct fb_info *info, 3022int fbcon_mode_deleted(struct fb_info *info,
3023 struct fb_videomode *mode) 3023 struct fb_videomode *mode)
3024{ 3024{
3025 struct fb_info *fb_info; 3025 struct fb_info *fb_info;
3026 struct fbcon_display *p; 3026 struct fbcon_display *p;
@@ -3262,7 +3262,7 @@ static void fbcon_fb_blanked(struct fb_info *info, int blank)
3262 ops->blank_state = blank; 3262 ops->blank_state = blank;
3263} 3263}
3264 3264
3265static void fbcon_new_modelist(struct fb_info *info) 3265void fbcon_new_modelist(struct fb_info *info)
3266{ 3266{
3267 int i; 3267 int i;
3268 struct vc_data *vc; 3268 struct vc_data *vc;
@@ -3324,7 +3324,6 @@ static int fbcon_event_notify(struct notifier_block *self,
3324{ 3324{
3325 struct fb_event *event = data; 3325 struct fb_event *event = data;
3326 struct fb_info *info = event->info; 3326 struct fb_info *info = event->info;
3327 struct fb_videomode *mode;
3328 struct fb_con2fbmap *con2fb; 3327 struct fb_con2fbmap *con2fb;
3329 struct fb_blit_caps *caps; 3328 struct fb_blit_caps *caps;
3330 int idx, ret = 0; 3329 int idx, ret = 0;
@@ -3336,10 +3335,6 @@ static int fbcon_event_notify(struct notifier_block *self,
3336 case FB_EVENT_MODE_CHANGE_ALL: 3335 case FB_EVENT_MODE_CHANGE_ALL:
3337 fbcon_set_all_vcs(info); 3336 fbcon_set_all_vcs(info);
3338 break; 3337 break;
3339 case FB_EVENT_MODE_DELETE:
3340 mode = event->data;
3341 ret = fbcon_mode_deleted(info, mode);
3342 break;
3343 case FB_EVENT_SET_CONSOLE_MAP: 3338 case FB_EVENT_SET_CONSOLE_MAP:
3344 /* called with console lock held */ 3339 /* called with console lock held */
3345 con2fb = event->data; 3340 con2fb = event->data;
@@ -3353,9 +3348,6 @@ static int fbcon_event_notify(struct notifier_block *self,
3353 case FB_EVENT_BLANK: 3348 case FB_EVENT_BLANK:
3354 fbcon_fb_blanked(info, *(int *)event->data); 3349 fbcon_fb_blanked(info, *(int *)event->data);
3355 break; 3350 break;
3356 case FB_EVENT_NEW_MODELIST:
3357 fbcon_new_modelist(info);
3358 break;
3359 case FB_EVENT_GET_REQ: 3351 case FB_EVENT_GET_REQ:
3360 caps = event->data; 3352 caps = event->data;
3361 fbcon_get_requirement(info, caps); 3353 fbcon_get_requirement(info, caps);
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 73269dedcd45..cbdd141e7695 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)
966 /* make sure we don't delete the videomode of current var */ 966 /* make sure we don't delete the videomode of current var */
967 ret = fb_mode_is_equal(&mode1, &mode2); 967 ret = fb_mode_is_equal(&mode1, &mode2);
968 968
969 if (!ret) { 969 if (!ret)
970 struct fb_event event; 970 fbcon_mode_deleted(info, &mode1);
971
972 event.info = info;
973 event.data = &mode1;
974 ret = fb_notifier_call_chain(FB_EVENT_MODE_DELETE, &event);
975 }
976 971
977 if (!ret) 972 if (!ret)
978 fb_delete_videomode(&mode1, &info->modelist); 973 fb_delete_videomode(&mode1, &info->modelist);
979 974
980 975
981 ret = (ret) ? -EINVAL : 0; 976 ret = (ret) ? -EINVAL : 0;
@@ -1992,7 +1987,6 @@ subsys_initcall(fbmem_init);
1992 1987
1993int fb_new_modelist(struct fb_info *info) 1988int fb_new_modelist(struct fb_info *info)
1994{ 1989{
1995 struct fb_event event;
1996 struct fb_var_screeninfo var = info->var; 1990 struct fb_var_screeninfo var = info->var;
1997 struct list_head *pos, *n; 1991 struct list_head *pos, *n;
1998 struct fb_modelist *modelist; 1992 struct fb_modelist *modelist;
@@ -2012,14 +2006,12 @@ int fb_new_modelist(struct fb_info *info)
2012 } 2006 }
2013 } 2007 }
2014 2008
2015 err = 1; 2009 if (list_empty(&info->modelist))
2010 return 1;
2016 2011
2017 if (!list_empty(&info->modelist)) { 2012 fbcon_new_modelist(info);
2018 event.info = info;
2019 err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event);
2020 }
2021 2013
2022 return err; 2014 return 0;
2023} 2015}
2024 2016
2025MODULE_LICENSE("GPL"); 2017MODULE_LICENSE("GPL");
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 794b386415b7..7a788ed8c7b5 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -126,8 +126,6 @@ struct fb_cursor_user {
126 126
127/* The resolution of the passed in fb_info about to change */ 127/* The resolution of the passed in fb_info about to change */
128#define FB_EVENT_MODE_CHANGE 0x01 128#define FB_EVENT_MODE_CHANGE 0x01
129/* An entry from the modelist was removed */
130#define FB_EVENT_MODE_DELETE 0x04
131 129
132#ifdef CONFIG_GUMSTIX_AM200EPD 130#ifdef CONFIG_GUMSTIX_AM200EPD
133/* only used by mach-pxa/am200epd.c */ 131/* only used by mach-pxa/am200epd.c */
@@ -142,9 +140,6 @@ struct fb_cursor_user {
142/* A hardware display blank change occurred */ 140/* A hardware display blank change occurred */
143#define FB_EVENT_BLANK 0x09 141#define FB_EVENT_BLANK 0x09
144/* Private modelist is to be replaced */ 142/* Private modelist is to be replaced */
145#define FB_EVENT_NEW_MODELIST 0x0A
146/* The resolution of the passed in fb_info about to change and
147 all vc's should be changed */
148#define FB_EVENT_MODE_CHANGE_ALL 0x0B 143#define FB_EVENT_MODE_CHANGE_ALL 0x0B
149/* A software display blank change occurred */ 144/* A software display blank change occurred */
150#define FB_EVENT_CONBLANK 0x0C 145#define FB_EVENT_CONBLANK 0x0C
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
index 790c42ec7b5d..c139834342f5 100644
--- a/include/linux/fbcon.h
+++ b/include/linux/fbcon.h
@@ -9,6 +9,9 @@ void fbcon_fb_unregistered(struct fb_info *info);
9void fbcon_fb_unbind(struct fb_info *info); 9void fbcon_fb_unbind(struct fb_info *info);
10void fbcon_suspended(struct fb_info *info); 10void fbcon_suspended(struct fb_info *info);
11void fbcon_resumed(struct fb_info *info); 11void fbcon_resumed(struct fb_info *info);
12int fbcon_mode_deleted(struct fb_info *info,
13 struct fb_videomode *mode);
14void fbcon_new_modelist(struct fb_info *info);
12#else 15#else
13static inline void fb_console_init(void) {} 16static inline void fb_console_init(void) {}
14static inline void fb_console_exit(void) {} 17static inline void fb_console_exit(void) {}
@@ -17,6 +20,9 @@ static inline void fbcon_fb_unregistered(struct fb_info *info) {}
17static inline void fbcon_fb_unbind(struct fb_info *info) {} 20static inline void fbcon_fb_unbind(struct fb_info *info) {}
18static inline void fbcon_suspended(struct fb_info *info) {} 21static inline void fbcon_suspended(struct fb_info *info) {}
19static inline void fbcon_resumed(struct fb_info *info) {} 22static inline void fbcon_resumed(struct fb_info *info) {}
23static inline int fbcon_mode_deleted(struct fb_info *info,
24 struct fb_videomode *mode) { return 0; }
25static inline void fbcon_new_modelist(struct fb_info *info) {}
20#endif 26#endif
21 27
22#endif /* _LINUX_FBCON_H */ 28#endif /* _LINUX_FBCON_H */