fbdev: omapfb: Make FB_DEVICE dependency optional

omapfb provides several sysfs interfaces for framebuffer configuration
and debugging, but these are not required for the core driver.

Remove the hard dependency on CONFIG_FB_DEVICE and make sysfs support
optional by using dev_of_fbinfo() to obtain the backing device at runtime.
When FB_DEVICE is disabled, sysfs operations are skipped while the code
still builds and is type-checked.

Suggested-by: Helge Deller <deller@gmx.de>
Signed-off-by: Chintan Patel <chintanlike@gmail.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
Chintan Patel 2026-01-06 20:42:56 -08:00 committed by Helge Deller
parent 553d8a6e51
commit bf9ec461a7
2 changed files with 16 additions and 5 deletions

View File

@ -5,7 +5,6 @@ config OMAP2_VRFB
menuconfig FB_OMAP2
tristate "OMAP2+ frame buffer support"
depends on FB
depends on FB_DEVICE
depends on DRM_OMAP = n
depends on GPIOLIB
select FB_OMAP2_DSS
@ -13,6 +12,8 @@ menuconfig FB_OMAP2
select FB_IOMEM_HELPERS
help
Frame buffer driver for OMAP2+ based boards.
FB_DEVICE is not required, but if enabled, provides sysfs interface
for framebuffer configuration and debugging.
if FB_OMAP2

View File

@ -558,10 +558,15 @@ int omapfb_create_sysfs(struct omapfb2_device *fbdev)
DBG("create sysfs for fbs\n");
for (i = 0; i < fbdev->num_fbs; i++) {
struct device *dev;
int t;
dev = dev_of_fbinfo(fbdev->fbs[i]);
if (!dev)
continue;
for (t = 0; t < ARRAY_SIZE(omapfb_attrs); t++) {
r = device_create_file(fbdev->fbs[i]->dev,
&omapfb_attrs[t]);
r = device_create_file(dev, &omapfb_attrs[t]);
if (r) {
dev_err(fbdev->dev, "failed to create sysfs "
@ -580,9 +585,14 @@ void omapfb_remove_sysfs(struct omapfb2_device *fbdev)
DBG("remove sysfs for fbs\n");
for (i = 0; i < fbdev->num_fbs; i++) {
struct device *dev;
dev = dev_of_fbinfo(fbdev->fbs[i]);
if (!dev)
continue;
for (t = 0; t < ARRAY_SIZE(omapfb_attrs); t++)
device_remove_file(fbdev->fbs[i]->dev,
&omapfb_attrs[t]);
device_remove_file(dev, &omapfb_attrs[t]);
}
}