[PATCH] fbdev: sstfb: Fix build after CONFIG_FB_DEVICE changes

From: Thomas Zimmermann
Date: Tue Oct 15 2024 - 03:10:45 EST


Commit 7c0510bb3452 ("fbdev: sstfb: Make CONFIG_FB_DEVICE optional")
made sstfb's dependency on CONFIG_FB_DEVICE optional. Fix the build
error

drivers/video/fbdev/sstfb.c: In function 'sstfb_probe':
drivers/video/fbdev/sstfb.c:1439:2: error: invalid preprocessing directive #fdef; did you mean #ifdef?
1439 | #fdef CONFIG_FB_DEVICE
| ^~~~
| ifdef
drivers/video/fbdev/sstfb.c:1442:2: error: #endif without #if
1442 | #endif
| ^~~~~

plus some formatting changes.

Also remove the dependency in the Kconfig rule, so that the driver
can be selected without FB_DEVICE enabled.

Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Closes: https://lore.kernel.org/lkml/20241015120119.533e65e8@xxxxxxxxxxxxxxxx/raw
Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
Fixes: 7c0510bb3452 ("fbdev: sstfb: Make CONFIG_FB_DEVICE optional")
Cc: Gonzalo Silvalde Blanco <gonzalo.silvalde@xxxxxxxxx>
Cc: Thomas Zimmermann <tzimmermann@xxxxxxx>
Cc: Helge Deller <deller@xxxxxx>
---
drivers/video/fbdev/Kconfig | 1 -
drivers/video/fbdev/sstfb.c | 6 ++++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index ea36c6956bf3..44a8fdbab6df 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -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
diff --git a/drivers/video/fbdev/sstfb.c b/drivers/video/fbdev/sstfb.c
index 8d2e9d1f8d80..50e9d2e64d4a 100644
--- a/drivers/video/fbdev/sstfb.c
+++ b/drivers/video/fbdev/sstfb.c
@@ -739,7 +739,7 @@ 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,
@@ -1436,7 +1436,8 @@ static int sstfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
}

sstfb_clear_screen(info);
-#fdef CONFIG_FB_DEVICE
+
+#ifdef CONFIG_FB_DEVICE
if (device_create_file(info->dev, &device_attrs[0]))
printk(KERN_WARNING "sstfb: can't create sysfs entry.\n");
#endif
@@ -1468,6 +1469,7 @@ 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
--
2.46.0