CONFIG_FB_DEVICE controls the fbdev character device interface. SH Mobile
LCDC does not need that interface to build framebuffer support. Tying the
driver option to FB_DEVICE unnecessarily prevents it from being enabled
where device node support is disabled.

Relax the Kconfig dependency so the driver can be built independently of
the fbdev device interface.

Signed-off-by: Melih Emik <[email protected]>
---
 drivers/video/fbdev/Kconfig            | 1 -
 drivers/video/fbdev/sh_mobile_lcdcfb.c | 6 ++++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 085d3a202148..762c4369e00f 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -1521,7 +1521,6 @@ config FB_SH_MOBILE_LCDC
        tristate "SuperH Mobile LCDC framebuffer support"
        depends on FB && HAVE_CLK && HAS_IOMEM
        depends on SUPERH || COMPILE_TEST
-       depends on FB_DEVICE
        depends on BACKLIGHT_CLASS_DEVICE
        select FB_BACKLIGHT
        select FB_DEFERRED_IO
diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c 
b/drivers/video/fbdev/sh_mobile_lcdcfb.c
index 72969fe8e513..b522b76b402d 100644
--- a/drivers/video/fbdev/sh_mobile_lcdcfb.c
+++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c
@@ -1511,7 +1511,7 @@ sh_mobile_lcdc_overlay_fb_unregister(struct 
sh_mobile_lcdc_overlay *ovl)
 {
        struct fb_info *info = ovl->info;
 
-       if (info == NULL || info->dev == NULL)
+       if (!info || !refcount_read(&info->count))
                return;
 
        unregister_framebuffer(ovl->info);
@@ -1983,7 +1983,7 @@ static const struct fb_ops sh_mobile_lcdc_ops = {
 static void
 sh_mobile_lcdc_channel_fb_unregister(struct sh_mobile_lcdc_chan *ch)
 {
-       if (ch->info && ch->info->dev)
+       if (ch->info && refcount_read(&ch->info->count))
                unregister_framebuffer(ch->info);
 }
 
@@ -2640,7 +2640,9 @@ static int sh_mobile_lcdc_probe(struct platform_device 
*pdev)
 static struct platform_driver sh_mobile_lcdc_driver = {
        .driver         = {
                .name           = "sh_mobile_lcdc_fb",
+#ifdef CONFIG_FB_DEVICE
                .dev_groups     = overlay_sysfs_groups,
+#endif
                .pm             = &sh_mobile_lcdc_dev_pm_ops,
        },
        .probe          = sh_mobile_lcdc_probe,
-- 
2.54.0

Reply via email to