Thread (20 messages) 20 messages, 6 authors, 2026-01-06

[PATCH v3 1/4] fb: Add dev_of_fbinfo() helper for optional sysfs support

flat view
STALE300d SUPERSEDED

From: Chintan Patel <hidden>
Date: 2025-12-30 05:29:05
Also in: dri-devel, linux-omap, linux-staging, lkml
Subsystem: framebuffer layer, the rest · Maintainers: Helge Deller, Linus Torvalds

Status: Superseded by v4 (posted 2026-01-07). [go to v4]

Revision v3 (3 revisions archived).

Revisions (3)
  1. v2
  2. v3 current [diff against previous]
  3. v4 [diff against previous]
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>
Signed-off-by: Chintan Patel <redacted>
---
 include/linux/fb.h | 9 +++++++++
 1 file changed, 9 insertions(+)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 05cc251035da..dad3fb61a06a 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -628,6 +628,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)
 {
-- 
2.43.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help