diff options
| author | Chintan Patel <chintanlike@gmail.com> | 2026-01-06 20:42:54 -0800 |
|---|---|---|
| committer | Helge Deller <deller@gmx.de> | 2026-02-14 11:09:45 +0100 |
| commit | 39b65316fe9d6d3f730632408ace28d49c5845a4 (patch) | |
| tree | df43d932d46ef6273ca25467420bf02eec391ac3 /include/linux | |
| parent | 8f582bcd132cf1290e1fbd56b9f783dabe637dd4 (diff) | |
fb: Add dev_of_fbinfo() helper for optional sysfs support
Add dev_of_fbinfo() to return the framebuffer struct device when
CONFIG_FB_DEVICE is enabled, or NULL otherwise.
This allows fbdev drivers to use sysfs interfaces via runtime checks
instead of CONFIG_FB_DEVICE ifdefs, keeping the code clean while
remaining fully buildable.
Suggested-by: Helge Deller <deller@gmx.de>
Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Chintan Patel <chintanlike@gmail.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/fb.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/fb.h b/include/linux/fb.h index aaa50b81f1d2..e70ee58d689e 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -623,6 +623,15 @@ static inline void unlock_fb_info(struct fb_info *info) mutex_unlock(&info->lock); } +static inline struct device *dev_of_fbinfo(const struct fb_info *info) +{ +#ifdef CONFIG_FB_DEVICE + return info->dev; +#else + return NULL; +#endif +} + static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) { |
