[PATCH] drm/sysfb: Fix unused function simpledrm_device_of_dev()

Jocelyn Falempe jfalempe at redhat.com
Mon Apr 7 13:13:26 UTC 2025


When building with clang, with CONFIG_OF unset, I got the following
error:

drivers/gpu/drm/sysfb/simpledrm.c:247:33: error: unused function 'simpledrm_device_of_dev' [-Werror,-Wunused-function]
  247 | static struct simpledrm_device *simpledrm_device_of_dev(struct drm_device *dev)

Add #if to define the function only when needed.

Signed-off-by: Jocelyn Falempe <jfalempe at redhat.com>
Fixes: 177dfbdb7e67 ("drm/sysfb: Merge primary-plane functions")
---
 drivers/gpu/drm/sysfb/simpledrm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/sysfb/simpledrm.c b/drivers/gpu/drm/sysfb/simpledrm.c
index cfb1fe07704d..82b1a669a42e 100644
--- a/drivers/gpu/drm/sysfb/simpledrm.c
+++ b/drivers/gpu/drm/sysfb/simpledrm.c
@@ -244,10 +244,12 @@ struct simpledrm_device {
 	struct drm_connector connector;
 };
 
+#if defined CONFIG_OF && (defined CONFIG_COMMON_CLK || defined CONFIG_REGULATOR)
 static struct simpledrm_device *simpledrm_device_of_dev(struct drm_device *dev)
 {
 	return container_of(to_drm_sysfb_device(dev), struct simpledrm_device, sysfb);
 }
+#endif
 
 /*
  * Hardware

base-commit: fbe43810d563a293e3de301141d33caf1f5d5c5a
-- 
2.49.0



More information about the dri-devel mailing list