fbdev: sstfb: Make CONFIG_FB_DEVICE optional
authorGonzalo Silvalde Blanco <gonzalo.silvalde@gmail.com>
Fri, 4 Oct 2024 15:24:29 +0000 (17:24 +0200)
committerHelge Deller <deller@gmx.de>
Tue, 15 Oct 2024 08:07:31 +0000 (10:07 +0200)
The sstfb driver currently depends on CONFIG_FB_DEVICE to create sysfs
entries and access info->dev. This patch wraps the relevant code blocks
with #ifdef CONFIG_FB_DEVICE, allowing the driver to be built and used
even if CONFIG_FB_DEVICE is not selected.

The sysfs setting only controls the VGA pass-through state and is not
required for the display to work correctly.
(See: http://vogonswiki.com/index.php/VGA_passthrough_cable
for more information.)

Added some fixes from Thomas Zimmermann.

Signed-off-by: Gonzalo Silvalde Blanco <gonzalo.silvalde@gmail.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/Kconfig
drivers/video/fbdev/sstfb.c

index ea36c6956bf36103772c576e8fc0d29c830958e2..44a8fdbab6df8a2530bd6c45a247360ea995c249 100644 (file)
@@ -1236,7 +1236,6 @@ config FB_3DFX_I2C
 config FB_VOODOO1
        tristate "3Dfx Voodoo Graphics (sst1) support"
        depends on FB && PCI
-       depends on FB_DEVICE
        select FB_IOMEM_HELPERS
        help
          Say Y here if you have a 3Dfx Voodoo Graphics (Voodoo1/sst1) or
index f8ae54ca0cc34f2e10735857bcfc05d504b46db5..2ea947f57efb3dd7eae170f3a44da1ffc191a08b 100644 (file)
@@ -716,6 +716,7 @@ static void sstfb_setvgapass( struct fb_info *info, int enable )
        pci_write_config_dword(sst_dev, PCI_INIT_ENABLE, tmp);
 }
 
+#ifdef CONFIG_FB_DEVICE
 static ssize_t store_vgapass(struct device *device, struct device_attribute *attr,
                        const char *buf, size_t count)
 {
@@ -739,7 +740,8 @@ static ssize_t show_vgapass(struct device *device, struct device_attribute *attr
 
 static struct device_attribute device_attrs[] = {
        __ATTR(vgapass, S_IRUGO|S_IWUSR, show_vgapass, store_vgapass)
-       };
+};
+#endif
 
 static int sstfb_ioctl(struct fb_info *info, unsigned int cmd,
                        unsigned long arg)
@@ -1436,9 +1438,10 @@ static int sstfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        sstfb_clear_screen(info);
 
+#ifdef CONFIG_FB_DEVICE
        if (device_create_file(info->dev, &device_attrs[0]))
                printk(KERN_WARNING "sstfb: can't create sysfs entry.\n");
-
+#endif
 
        fb_info(info, "%s frame buffer device at 0x%p\n",
                fix->id, info->screen_base);
@@ -1468,7 +1471,9 @@ static void sstfb_remove(struct pci_dev *pdev)
        info = pci_get_drvdata(pdev);
        par = info->par;
 
+#ifdef CONFIG_FB_DEVICE
        device_remove_file(info->dev, &device_attrs[0]);
+#endif
        sst_shutdown(info);
        iounmap(info->screen_base);
        iounmap(par->mmio_vbase);