From: Chintan Patel <chintanlike@gmail.com>
To: linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev,
linux-omap@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
tzimmermann@suse.de, andy@kernel.org, deller@gmx.de,
gregkh@linuxfoundation.org, Chintan Patel <chintanlike@gmail.com>
Subject: [PATCH v3 1/4] fb: Add dev_of_fbinfo() helper for optional sysfs support
Date: Mon, 29 Dec 2025 21:28:19 -0800 [thread overview]
Message-ID: <20251230052827.4676-2-chintanlike@gmail.com> (raw)
In-Reply-To: <20251230052827.4676-1-chintanlike@gmail.com>
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 <chintanlike@gmail.com>
---
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
next prev parent reply other threads:[~2025-12-30 5:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-30 5:28 [PATCH v3 0/4] fbdev: Make CONFIG_FB_DEVICE optional for drivers Chintan Patel
2025-12-30 5:28 ` Chintan Patel [this message]
2025-12-30 8:01 ` [PATCH v3 1/4] fb: Add dev_of_fbinfo() helper for optional sysfs support Helge Deller
2025-12-30 5:28 ` [PATCH v3 2/4] staging: fbtft: Make FB_DEVICE dependency optional Chintan Patel
2025-12-30 8:03 ` Helge Deller
2025-12-30 5:28 ` [PATCH v3 3/4] fbdev: omapfb: " Chintan Patel
2025-12-30 8:05 ` Helge Deller
2025-12-30 11:37 ` Andy Shevchenko
2025-12-30 18:01 ` Chintan Patel
2025-12-30 22:42 ` Andy Shevchenko
2025-12-30 5:28 ` [PATCH v3 4/4] fbdev: sh_mobile_lcdc: " Chintan Patel
2025-12-30 8:13 ` Helge Deller
2025-12-30 18:25 ` Chintan Patel
2026-01-03 9:59 ` Helge Deller
2026-01-03 13:15 ` Andy Shevchenko
2026-01-06 5:07 ` Chintan Patel
2025-12-30 11:35 ` Andy Shevchenko
2025-12-30 10:42 ` [PATCH v3 0/4] fbdev: Make CONFIG_FB_DEVICE optional for drivers Geert Uytterhoeven
2025-12-30 11:33 ` Andy Shevchenko
2025-12-30 17:59 ` Chintan Patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251230052827.4676-2-chintanlike@gmail.com \
--to=chintanlike@gmail.com \
--cc=andy@kernel.org \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.