Skip to content

Commit 553d8a6

Browse files
nehudesihdeller
authored andcommitted
staging: fbtft: Make FB_DEVICE dependency optional
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>
1 parent 39b6531 commit 553d8a6

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

drivers/staging/fbtft/Kconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
menuconfig FB_TFT
33
tristate "Support for small TFT LCD display modules"
44
depends on FB && SPI
5-
depends on FB_DEVICE
65
depends on BACKLIGHT_CLASS_DEVICE
76
depends on GPIOLIB || COMPILE_TEST
87
select FB_BACKLIGHT
98
select FB_SYSMEM_HELPERS_DEFERRED
9+
help
10+
Support for small TFT LCD display modules over SPI bus. FB_DEVICE
11+
is not required, but if enabled, provides sysfs interface for debugging
12+
and gamma curve configuration.
1013

1114
if FB_TFT
1215

drivers/staging/fbtft/fbtft-sysfs.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,26 @@ static struct device_attribute debug_device_attr =
203203

204204
void fbtft_sysfs_init(struct fbtft_par *par)
205205
{
206-
device_create_file(par->info->dev, &debug_device_attr);
206+
struct device *dev;
207+
208+
dev = dev_of_fbinfo(par->info);
209+
if (!dev)
210+
return;
211+
212+
device_create_file(dev, &debug_device_attr);
207213
if (par->gamma.curves && par->fbtftops.set_gamma)
208-
device_create_file(par->info->dev, &gamma_device_attrs[0]);
214+
device_create_file(dev, &gamma_device_attrs[0]);
209215
}
210216

211217
void fbtft_sysfs_exit(struct fbtft_par *par)
212218
{
213-
device_remove_file(par->info->dev, &debug_device_attr);
219+
struct device *dev;
220+
221+
dev = dev_of_fbinfo(par->info);
222+
if (!dev)
223+
return;
224+
225+
device_remove_file(dev, &debug_device_attr);
214226
if (par->gamma.curves && par->fbtftops.set_gamma)
215-
device_remove_file(par->info->dev, &gamma_device_attrs[0]);
227+
device_remove_file(dev, &gamma_device_attrs[0]);
216228
}

0 commit comments

Comments
 (0)