Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

backlight: lcd: Move event handling into helpers

Move the handling of display updates to separate helper functions.
There is code for handling fbdev blank events and fbdev mode changes.
The code currently runs from fbdev event notifiers, which will be
replaced.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org>
Acked-by: Simona Vetter <simona.vetter@ffwll.ch>
Link: https://lore.kernel.org/r/20250321095517.313713-8-tzimmermann@suse.de
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Thomas Zimmermann and committed by
Lee Jones
e98696ce b01beb2f

+28 -10
+28 -10
drivers/video/backlight/lcd.c
··· 18 18 #include <linux/fb.h> 19 19 #include <linux/slab.h> 20 20 21 + static void lcd_notify_blank(struct lcd_device *ld, struct device *display_dev, 22 + int power) 23 + { 24 + guard(mutex)(&ld->ops_lock); 25 + 26 + if (!ld->ops || !ld->ops->set_power) 27 + return; 28 + if (ld->ops->controls_device && !ld->ops->controls_device(ld, display_dev)) 29 + return; 30 + 31 + ld->ops->set_power(ld, power); 32 + } 33 + 34 + static void lcd_notify_mode_change(struct lcd_device *ld, struct device *display_dev, 35 + unsigned int width, unsigned int height) 36 + { 37 + guard(mutex)(&ld->ops_lock); 38 + 39 + if (!ld->ops || !ld->ops->set_mode) 40 + return; 41 + if (ld->ops->controls_device && !ld->ops->controls_device(ld, display_dev)) 42 + return; 43 + 44 + ld->ops->set_mode(ld, width, height); 45 + } 46 + 21 47 #if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ 22 48 defined(CONFIG_LCD_CLASS_DEVICE_MODULE)) 23 49 static int to_lcd_power(int fb_blank) ··· 76 50 struct fb_info *info = evdata->info; 77 51 struct lcd_device *fb_lcd = fb_lcd_device(info); 78 52 79 - guard(mutex)(&ld->ops_lock); 80 - 81 - if (!ld->ops) 82 - return 0; 83 - if (ld->ops->controls_device && !ld->ops->controls_device(ld, info->device)) 84 - return 0; 85 53 if (fb_lcd && fb_lcd != ld) 86 54 return 0; 87 55 88 56 if (event == FB_EVENT_BLANK) { 89 57 int power = to_lcd_power(*(int *)evdata->data); 90 58 91 - if (ld->ops->set_power) 92 - ld->ops->set_power(ld, power); 59 + lcd_notify_blank(ld, info->device, power); 93 60 } else { 94 61 const struct fb_videomode *videomode = evdata->data; 95 62 96 - if (ld->ops->set_mode) 97 - ld->ops->set_mode(ld, videomode->xres, videomode->yres); 63 + lcd_notify_mode_change(ld, info->device, videomode->xres, videomode->yres); 98 64 } 99 65 100 66 return 0;