linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sukrut Heroorkar <hsukrut3@gmail.com>
To: Helge Deller <deller@gmx.de>,
	Bernie Thompson <bernie@plugable.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Arnd Bergmann <arnd@arndb.de>,
	Randy Dunlap <rdunlap@infradead.org>,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	Sukrut Heroorkar <hsukrut3@gmail.com>,
	Zsolt Kajtar <soci@c64.rulez.org>,
	Gonzalo Silvalde Blanco <gonzalo.silvalde@gmail.com>,
	linux-fbdev@vger.kernel.org (open list:FRAMEBUFFER LAYER),
	dri-devel@lists.freedesktop.org (open list:FRAMEBUFFER LAYER),
	linux-kernel@vger.kernel.org (open list)
Cc: skhan@linuxfoundation.org, david.hunter.linux@gmail.com
Subject: [PATCH] fbdev: udlfb: make CONFIG_FB_DEVICE optional
Date: Wed, 24 Sep 2025 19:57:38 +0200	[thread overview]
Message-ID: <20250924175743.6790-1-hsukrut3@gmail.com> (raw)

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 <hsukrut3@gmail.com>
---
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


             reply	other threads:[~2025-09-24 17:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 17:57 Sukrut Heroorkar [this message]
2025-09-26 20:58 ` [PATCH] fbdev: udlfb: make CONFIG_FB_DEVICE optional kernel test robot
2025-09-27 16:12 ` kernel test robot
2025-09-28 23:29   ` David Hunter
2025-10-02  6:35     ` sukrut heroorkar
2025-10-02  6:41       ` Helge Deller
2025-10-02  6:52         ` Thomas Zimmermann
2025-10-03 18:43           ` sukrut heroorkar
2025-10-03 19:50             ` Helge Deller
2025-10-07  7:35               ` Thomas Zimmermann
2025-10-10 15:11                 ` Mikulas Patocka
2025-10-06 13:49       ` David Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250924175743.6790-1-hsukrut3@gmail.com \
    --to=hsukrut3@gmail.com \
    --cc=arnd@arndb.de \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=bernie@plugable.com \
    --cc=david.hunter.linux@gmail.com \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gonzalo.silvalde@gmail.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=soci@c64.rulez.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).