[PATCH 4/4] video: backlight: add fallbacks for client functions

Lucas Stach l.stach at pengutronix.de
Wed Aug 12 01:46:45 PDT 2015


Add empty static inline function fallbacks if backlight support
is not enabled, so that drivers using the backlight don't fail to
build.

Fixes:
In function `simple_panel_ioctl':
undefined reference to `of_backlight_find'
undefined reference to `backlight_set_brightness_default'
undefined reference to `backlight_set_brightness'

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
 include/video/backlight.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/video/backlight.h b/include/video/backlight.h
index 56e0341ea470..8dc49dc113e3 100644
--- a/include/video/backlight.h
+++ b/include/video/backlight.h
@@ -1,6 +1,7 @@
 #ifndef __VIDEO_BACKLIGHT_H
 #define __VIDEO_BACKLIGHT_H
 
+#ifdef CONFIG_DRIVER_VIDEO_BACKLIGHT
 struct backlight_device {
 	int brightness;
 	int brightness_cur;
@@ -16,5 +17,21 @@ int backlight_set_brightness(struct backlight_device *, int brightness);
 int backlight_set_brightness_default(struct backlight_device *);
 int backlight_register(struct backlight_device *);
 struct backlight_device *of_backlight_find(struct device_node *node);
+#else
+struct backlight_device ;
+
+static inline int
+backlight_set_brightness(struct backlight_device *dev, int brightness)
+{
+	return 0;
+}
+static inline int
+backlight_set_brightness_default(struct backlight_device *dev)
+{
+	return 0;
+}
+static inline struct backlight_device *
+of_backlight_find(struct device_node *node) { return NULL; }
+#endif
 
 #endif /* __VIDEO_BACKLIGHT_H */
-- 
2.4.6




More information about the barebox mailing list