Re: [PATCH v2] drm: rcar-du: fix linker undefined references

From: Randy Dunlap
Date: Fri May 14 2021 - 20:37:38 EST


ping?
thanks.

On 4/23/21 5:12 PM, Randy Dunlap wrote:
> When DRM_RCAR_DU=y and DRM_RCAR_LVDS=m, there are several build errors
> as reported by 'kernel test robot'. These can be corrected by changing
> source code occurrences of IS_ENABLED(...) to IS_REACHABLE(...).
>
> In looking at this, the same problem (build errors) happens when
> DRM_RCAR_DU=y and DRM_RCAR_CMM=m, so again change an IS_ENABLED()
> to IS_REACHABLE() for this case as well.
>
> These changes fix the following 8 build/link errors:
>
> aarch64-linux-ld: drivers/gpu/drm/rcar-du/rcar_du_crtc.o: in function `rcar_du_crtc_atomic_enable':
> rcar_du_crtc.c:(.text+0x1be8): undefined reference to `rcar_lvds_clk_enable'
> aarch64-linux-ld: drivers/gpu/drm/rcar-du/rcar_du_crtc.o: in function `rcar_du_crtc_atomic_disable':
> rcar_du_crtc.c:(.text+0x2438): undefined reference to `rcar_lvds_clk_disable'
> aarch64-linux-ld: drivers/gpu/drm/rcar-du/rcar_du_drv.o: in function `rcar_du_init':
> rcar_du_drv.c:(.init.text+0x14): undefined reference to `rcar_du_of_init'
> aarch64-linux-ld: drivers/gpu/drm/rcar-du/rcar_du_encoder.o: in function `rcar_du_encoder_init':
> rcar_du_encoder.c:(.text+0x1d4): undefined reference to `rcar_lvds_dual_link'
>
> aarch64-linux-ld: drivers/gpu/drm/rcar-du/rcar_du_crtc.o: in function `rcar_du_cmm_setup':
> rcar_du_crtc.c:(.text+0x380): undefined reference to `rcar_cmm_setup'
> aarch64-linux-ld: drivers/gpu/drm/rcar-du/rcar_du_crtc.o: in function `rcar_du_crtc_atomic_enable':
> rcar_du_crtc.c:(.text+0x1c08): undefined reference to `rcar_cmm_enable'
> aarch64-linux-ld: drivers/gpu/drm/rcar-du/rcar_du_crtc.o: in function `rcar_du_crtc_atomic_disable':
> rcar_du_crtc.c:(.text+0x231c): undefined reference to `rcar_cmm_disable'
> aarch64-linux-ld: drivers/gpu/drm/rcar-du/rcar_du_kms.o: in function `rcar_du_modeset_init':
> rcar_du_kms.c:(.text+0xd08): undefined reference to `rcar_cmm_init'
>
> All RCAR kconfig combinations now build for me.
>
> Fixes: e08e934d6c28 ("drm: rcar-du: Add support for CMM")
> Fixes: 02f2b30032c1 ("drm: rcar-du: lvds: Add API to enable/disable clock output")
> Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> Cc: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> Cc: Kieran Bingham <kieran.bingham+renesas@xxxxxxxxxxxxxxxx>
> Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
> Cc: linux-renesas-soc@xxxxxxxxxxxxxxx
> Cc: Jacopo Mondi <jacopo+renesas@xxxxxxxxxx>
> ---
> v2: also send to LKML;
> don't change Kconfig "imply" to "select" since not all platforms
> with DU have CMM and/or LVDS support. Use IS_REACHABLE() instead.
>
> drivers/gpu/drm/rcar-du/rcar_cmm.h | 4 ++--
> drivers/gpu/drm/rcar-du/rcar_du_of.h | 2 +-
> drivers/gpu/drm/rcar-du/rcar_lvds.h | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> --- linux-next-20210420.orig/drivers/gpu/drm/rcar-du/rcar_lvds.h
> +++ linux-next-20210420/drivers/gpu/drm/rcar-du/rcar_lvds.h
> @@ -12,7 +12,7 @@
>
> struct drm_bridge;
>
> -#if IS_ENABLED(CONFIG_DRM_RCAR_LVDS)
> +#if IS_REACHABLE(CONFIG_DRM_RCAR_LVDS)
> int rcar_lvds_clk_enable(struct drm_bridge *bridge, unsigned long freq);
> void rcar_lvds_clk_disable(struct drm_bridge *bridge);
> bool rcar_lvds_dual_link(struct drm_bridge *bridge);
> --- linux-next-20210420.orig/drivers/gpu/drm/rcar-du/rcar_du_of.h
> +++ linux-next-20210420/drivers/gpu/drm/rcar-du/rcar_du_of.h
> @@ -11,7 +11,7 @@
>
> struct of_device_id;
>
> -#if IS_ENABLED(CONFIG_DRM_RCAR_LVDS)
> +#if IS_REACHABLE(CONFIG_DRM_RCAR_LVDS)
> void __init rcar_du_of_init(const struct of_device_id *of_ids);
> #else
> static inline void rcar_du_of_init(const struct of_device_id *of_ids) { }
> --- linux-next-20210420.orig/drivers/gpu/drm/rcar-du/rcar_cmm.h
> +++ linux-next-20210420/drivers/gpu/drm/rcar-du/rcar_cmm.h
> @@ -25,7 +25,7 @@ struct rcar_cmm_config {
> } lut;
> };
>
> -#if IS_ENABLED(CONFIG_DRM_RCAR_CMM)
> +#if IS_REACHABLE(CONFIG_DRM_RCAR_CMM)
> int rcar_cmm_init(struct platform_device *pdev);
>
> int rcar_cmm_enable(struct platform_device *pdev);
> @@ -53,6 +53,6 @@ static inline int rcar_cmm_setup(struct
> {
> return 0;
> }
> -#endif /* IS_ENABLED(CONFIG_DRM_RCAR_CMM) */
> +#endif /* IS_REACHABLE(CONFIG_DRM_RCAR_CMM) */
>
> #endif /* __RCAR_CMM_H__ */
>


--
~Randy