The udlfb driver exposes sysfs attributes thus depends upon CONFIG_FB_DEVICE. This patch work wraps relavent code blocks with #ifdef CONFIG_FB_DEVICE so that the driver can still be built even when CONFIG_FB_DEVICE is not selected.
This addresses an item in Documentation/gpu/TODO.rst. Signed-off-by: Sukrut Heroorkar <[email protected]> --- Note: this change has only been compile-tested. drivers/video/fbdev/Kconfig | 1 - drivers/video/fbdev/udlfb.c | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 1500dca8c416..40442b80de17 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -1596,7 +1596,6 @@ config FB_SMSCUFX config FB_UDL tristate "Displaylink USB Framebuffer support" depends on FB && USB - depends on FB_DEVICE select FB_MODE_HELPERS select FB_SYSMEM_HELPERS_DEFERRED help diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index ccede85df1e1..de2e310054d4 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -1382,6 +1382,7 @@ static int dlfb_setup_modes(struct dlfb_data *dlfb, return result; } +#ifdef CONFIG_FB_DEVICE static ssize_t metrics_bytes_rendered_show(struct device *fbdev, struct device_attribute *a, char *buf) { struct fb_info *fb_info = dev_get_drvdata(fbdev); @@ -1413,6 +1414,7 @@ static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev, return sysfs_emit(buf, "%u\n", atomic_read(&dlfb->cpu_kcycles_used)); } +#endif static ssize_t edid_show( struct file *filp, @@ -1486,6 +1488,7 @@ static const struct bin_attribute edid_attr = { .write = edid_store }; +#ifdef CONFIG_FB_DEVICE static const struct device_attribute fb_device_attrs[] = { __ATTR_RO(metrics_bytes_rendered), __ATTR_RO(metrics_bytes_identical), @@ -1493,6 +1496,7 @@ static const struct device_attribute fb_device_attrs[] = { __ATTR_RO(metrics_cpu_kcycles_used), __ATTR(metrics_reset, S_IWUSR, NULL, metrics_reset_store), }; +#endif /* * This is necessary before we can communicate with the display controller. @@ -1702,6 +1706,7 @@ static int dlfb_usb_probe(struct usb_interface *intf, goto error; } +#ifdef CONFIG_FB_DEVICE for (i = 0; i < ARRAY_SIZE(fb_device_attrs); i++) { attr = &fb_device_attrs[i]; retval = device_create_file(info->dev, attr); @@ -1710,6 +1715,7 @@ static int dlfb_usb_probe(struct usb_interface *intf, "failed to create '%s' attribute: %d\n", attr->attr.name, retval); } +#endif retval = device_create_bin_file(info->dev, &edid_attr); if (retval) @@ -1753,9 +1759,11 @@ static void dlfb_usb_disconnect(struct usb_interface *intf) /* this function will wait for all in-flight urbs to complete */ dlfb_free_urb_list(dlfb); +#ifdef CONFIG_FB_DEVICE /* remove udlfb's sysfs interfaces */ for (i = 0; i < ARRAY_SIZE(fb_device_attrs); i++) device_remove_file(info->dev, &fb_device_attrs[i]); +#endif device_remove_bin_file(info->dev, &edid_attr); unregister_framebuffer(info); -- 2.43.0
