Skip to content

Commit bf9ec46

Browse files
nehudesihdeller
authored andcommitted
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>
1 parent 553d8a6 commit bf9ec46

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

drivers/video/fbdev/omap2/omapfb/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ config OMAP2_VRFB
55
menuconfig FB_OMAP2
66
tristate "OMAP2+ frame buffer support"
77
depends on FB
8-
depends on FB_DEVICE
98
depends on DRM_OMAP = n
109
depends on GPIOLIB
1110
select FB_OMAP2_DSS
1211
select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3
1312
select FB_IOMEM_HELPERS
1413
help
1514
Frame buffer driver for OMAP2+ based boards.
15+
FB_DEVICE is not required, but if enabled, provides sysfs interface
16+
for framebuffer configuration and debugging.
1617

1718
if FB_OMAP2
1819

drivers/video/fbdev/omap2/omapfb/omapfb-sysfs.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,15 @@ int omapfb_create_sysfs(struct omapfb2_device *fbdev)
558558

559559
DBG("create sysfs for fbs\n");
560560
for (i = 0; i < fbdev->num_fbs; i++) {
561+
struct device *dev;
561562
int t;
563+
564+
dev = dev_of_fbinfo(fbdev->fbs[i]);
565+
if (!dev)
566+
continue;
567+
562568
for (t = 0; t < ARRAY_SIZE(omapfb_attrs); t++) {
563-
r = device_create_file(fbdev->fbs[i]->dev,
564-
&omapfb_attrs[t]);
569+
r = device_create_file(dev, &omapfb_attrs[t]);
565570

566571
if (r) {
567572
dev_err(fbdev->dev, "failed to create sysfs "
@@ -580,9 +585,14 @@ void omapfb_remove_sysfs(struct omapfb2_device *fbdev)
580585

581586
DBG("remove sysfs for fbs\n");
582587
for (i = 0; i < fbdev->num_fbs; i++) {
588+
struct device *dev;
589+
590+
dev = dev_of_fbinfo(fbdev->fbs[i]);
591+
if (!dev)
592+
continue;
593+
583594
for (t = 0; t < ARRAY_SIZE(omapfb_attrs); t++)
584-
device_remove_file(fbdev->fbs[i]->dev,
585-
&omapfb_attrs[t]);
595+
device_remove_file(dev, &omapfb_attrs[t]);
586596
}
587597
}
588598

0 commit comments

Comments
 (0)