[PATCH] backlight: Define API stub when backlight support is disabled

From: Laurent Pinchart
Date: Wed Apr 19 2017 - 16:13:43 EST


The of_find_backlight_by_node() function has a stubbed when CONFIG_OF is
disabled, but drivers that use backlights optionally will still fail to
link if backlight support is disabled. Fix it by defining the stub when
CONFIG_BACKLIGHT_CLASS_DEVICE is disabled.

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
---
include/linux/backlight.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 5f2fd61ef4fb..fae0b189f7b4 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -162,7 +162,7 @@ struct generic_bl_info {
void (*kick_battery)(void);
};

-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
struct backlight_device *of_find_backlight_by_node(struct device_node *node);
#else
static inline struct backlight_device *


We might need to create stubs for backlight_force_update() and
backlight_device_set_brightness() too.

> Fixes: 39135a305a0f ("drm/omap: displays: panel-dpi: Support for handling
> backlight devices")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> drivers/gpu/drm/omapdrm/displays/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/omapdrm/displays/Kconfig
> b/drivers/gpu/drm/omapdrm/displays/Kconfig index c226da145fb3..a349cb61961e
> 100644
> --- a/drivers/gpu/drm/omapdrm/displays/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/displays/Kconfig
> @@ -35,6 +35,7 @@ config DRM_OMAP_CONNECTOR_ANALOG_TV
>
> config DRM_OMAP_PANEL_DPI
> tristate "Generic DPI panel"
> + depends on BACKLIGHT_CLASS_DEVICE
> help
> Driver for generic DPI panels.

--
Regards,

Laurent Pinchart