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 2/4] staging: fbtft: Make FB_DEVICE dependency optional
Date: Mon, 29 Dec 2025 21:28:20 -0800 [thread overview]
Message-ID: <20251230052827.4676-3-chintanlike@gmail.com> (raw)
In-Reply-To: <20251230052827.4676-1-chintanlike@gmail.com>
fbtft provides sysfs interfaces for debugging and gamma configuration,
but these are not required for the core driver.
Drop the hard dependency on CONFIG_FB_DEVICE and make sysfs support
optional by using dev_of_fbinfo() at runtime. When FB_DEVICE is disabled,
sysfs operations are skipped while the code remains buildable and
type-checked.
Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Suggested-by: Helge Deller <deller@gmx.de>
Signed-off-by: Chintan Patel <chintanlike@gmail.com>
---
drivers/staging/fbtft/Kconfig | 5 ++++-
drivers/staging/fbtft/fbtft-sysfs.c | 20 ++++++++++++++++----
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig
index c2655768209a..578412a2f379 100644
--- a/drivers/staging/fbtft/Kconfig
+++ b/drivers/staging/fbtft/Kconfig
@@ -2,11 +2,14 @@
menuconfig FB_TFT
tristate "Support for small TFT LCD display modules"
depends on FB && SPI
- depends on FB_DEVICE
depends on BACKLIGHT_CLASS_DEVICE
depends on GPIOLIB || COMPILE_TEST
select FB_BACKLIGHT
select FB_SYSMEM_HELPERS_DEFERRED
+ help
+ Support for small TFT LCD display modules over SPI bus. FB_DEVICE
+ is not required, but if enabled, provides sysfs interface for debugging
+ and gamma curve configuration.
if FB_TFT
diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c
index e45c90a03a90..d05599d80011 100644
--- a/drivers/staging/fbtft/fbtft-sysfs.c
+++ b/drivers/staging/fbtft/fbtft-sysfs.c
@@ -203,14 +203,26 @@ static struct device_attribute debug_device_attr =
void fbtft_sysfs_init(struct fbtft_par *par)
{
- device_create_file(par->info->dev, &debug_device_attr);
+ struct device *dev;
+
+ dev = dev_of_fbinfo(par->info);
+ if (!dev)
+ return;
+
+ device_create_file(dev, &debug_device_attr);
if (par->gamma.curves && par->fbtftops.set_gamma)
- device_create_file(par->info->dev, &gamma_device_attrs[0]);
+ device_create_file(dev, &gamma_device_attrs[0]);
}
void fbtft_sysfs_exit(struct fbtft_par *par)
{
- device_remove_file(par->info->dev, &debug_device_attr);
+ struct device *dev;
+
+ dev = dev_of_fbinfo(par->info);
+ if (!dev)
+ return;
+
+ device_remove_file(dev, &debug_device_attr);
if (par->gamma.curves && par->fbtftops.set_gamma)
- device_remove_file(par->info->dev, &gamma_device_attrs[0]);
+ device_remove_file(dev, &gamma_device_attrs[0]);
}
--
2.43.0
next prev parent reply other threads:[~2025-12-30 5:29 UTC|newest]
Thread overview: 17+ 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 ` [PATCH v3 1/4] fb: Add dev_of_fbinfo() helper for optional sysfs support Chintan Patel
2025-12-30 8:01 ` Helge Deller
2025-12-30 5:28 ` Chintan Patel [this message]
2025-12-30 8:03 ` [PATCH v3 2/4] staging: fbtft: Make FB_DEVICE dependency optional 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
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-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).