Skip to contentSkip to conversation

drm/sysfb: Fix unused function simpledrm_device_of_dev()

PATCH In review Jocelyn Falempe 2 participants 2 messages Apr 7, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/sysfb: Fix unused function simpledrm_device_of_dev()

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.

Fixes 177dfbdb7e67 ("drm/sysfb: Merge primary-plane functions")
---
 drivers/gpu/drm/sysfb/simpledrm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/sysfb/simpledrm.c +2 -0
index cfb1fe07704d..82b1a669a42e 100644
@@ -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

Signature · 1 line
2.49.0
#1 lore raw

Hi,

thanks for the patch.

Am 07.04.25 um 15:13 schrieb Jocelyn Falempe:

Quoted 21 lines

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.

Fixes 177dfbdb7e67 ("drm/sysfb: Merge primary-plane functions")
---
  drivers/gpu/drm/sysfb/simpledrm.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/sysfb/simpledrm.c +0 -0
index cfb1fe07704d..82b1a669a42e 100644
@@ -244,10 +244,12 @@ struct simpledrm_device {
  	struct drm_connector connector;
  };

drivers/gpu/drm/sysfb/simpledrm.c struct simpledrm_device { · line 255

Quoted 10 lines
drivers/gpu/drm/sysfb/simpledrm.c +2 -0
 
+#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

There's the same #if right below this comment. Please move the function there.

The helper used to be used throughout  the driver, but that is no longer the case. Apologies for missing it.

Best regards
Thomas

Quoted 2 lines

base-commit: fbe43810d563a293e3de301141d33caf1f5d5c5a

Signature · 7 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)