]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
staging: fbtft: Make FB_DEVICE dependency optional
authorChintan Patel <chintanlike@gmail.com>
Wed, 7 Jan 2026 04:42:55 +0000 (20:42 -0800)
committerHelge Deller <deller@gmx.de>
Sat, 14 Feb 2026 10:09:46 +0000 (11:09 +0100)
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>
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Chintan Patel <chintanlike@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/staging/fbtft/Kconfig
drivers/staging/fbtft/fbtft-sysfs.c

index c2655768209ac397195dddb8a90153b8e0a9f41a..578412a2f379effe4f7017cee03f40fd2f7c2173 100644 (file)
@@ -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
 
index e45c90a03a903ea3433ca7cde32bd52479142ea6..d05599d80011a1d2bc5a29de1acea95926651820 100644 (file)
@@ -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]);
 }