Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Chintan Patel <chintanlike@gmail.com>,
	Helge Deller <deller@gmx.de>, Andy Shevchenko <andy@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.18.y 1/3] fb: Add dev_of_fbinfo() helper for optional sysfs support
Date: Tue, 10 Nov 2026 15:11:18 -0500	[thread overview]
Message-ID: <20261110200947.3702749-1-sashal@kernel.org> (raw)
In-Reply-To: <20261107051054-failed-6.18-317a8be73091@kernel.org>

From: Chintan Patel <chintanlike@gmail.com>

[ Upstream commit 39b65316fe9d6d3f730632408ace28d49c5845a4 ]

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>
Stable-dep-of: 317a8be73091 ("fbdev: sh_mobile_lcdcfb: Restore the per-overlay sysfs attributes")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/fb.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/fb.h b/include/linux/fb.h
index f622f5f520cf0..e50fc8f0801e6 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -631,6 +631,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.53.0


  reply	other threads:[~2026-11-10 20:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 10:10 FAILED: patch "[PATCH] fbdev: sh_mobile_lcdcfb: Restore the per-overlay sysfs attributes" failed to apply to 6.18-stable tree Sasha Levin
2026-11-10 20:11 ` Sasha Levin [this message]
2026-11-10 20:11   ` [PATCH 6.18.y 2/3] fbdev: sh_mobile_lcdc: Make FB_DEVICE dependency optional Sasha Levin
2026-11-10 20:11   ` [PATCH 6.18.y 3/3] fbdev: sh_mobile_lcdcfb: Restore the per-overlay sysfs attributes Sasha Levin

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=20261110200947.3702749-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=andy@kernel.org \
    --cc=chintanlike@gmail.com \
    --cc=deller@gmx.de \
    --cc=stable@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox