On Tue, Sep 11, 2018 at 01:33:25PM +0200, Maxime Ripard wrote:
> Having DRM_SUN4I built-in but DRM_SUN8I_MIXER as a loadable module results in
> a link error, as we try to access a symbol from the sun8i_tcon_top.ko module:
> 
> ERROR: "sun8i_tcon_top_de_config" [drivers/gpu/drm/sun4i/sun4i-tcon.ko] 
> undefined!
> ERROR: "sun8i_tcon_top_set_hdmi_src" [drivers/gpu/drm/sun4i/sun4i-tcon.ko] 
> undefined!
> ERROR: "sun8i_tcon_top_of_table" [drivers/gpu/drm/sun4i/sun4i-tcon.ko] 
> undefined!
> 
> This solves the problem by adding a silent symbol for the tcon_top module,
> building it as a separate module in exactly the cases that we need it,
> but in a way that it is reachable by the other modules.
> 
> Fixes: cf77d79b4e29 ("drm/sun4i: tcon: Add another way for matching mixers 
> with tcon")
> Fixes: 0305189afb32 ("drm/sun4i: tcon: Add support for R40 TCON")
> Tested-by: Jon Hunter <jonath...@nvidia.com>
> Signed-off-by: Maxime Ripard <maxime.rip...@bootlin.com>

Reviewed-by: Daniel Vetter <daniel.vet...@ffwll.ch>

But I can't help myself and drop the usual questions when I see a small
soc driver with more Kconfigs than anything else ... is all this pain
worth it? I know that maybe the desktop approach of stuffing half a
million lines of driver code into one .ko might be a bit too much for
socs, but this seems overkill.

I'm also pretty sure it's not justified by any real data, compared to
overall code size of a drm stack, that shows it's a substantial enough
saving that it's worth it.

Imo, if you really care about building a minimal driver, stuff everything
into one .ko and then LTO out the uneeded bits. We've done these
experiments for i915, that _actually_ saves a ton of binary size, with
fairly minimal code and maintenance impact. Still, we decided the payoff
is simply too small to bother making it a production thing.

Cheers, Daniel

> ---
>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c 
> b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index 4834c90b4912..c78cd35a1294 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -974,7 +974,8 @@ static bool sun4i_tcon_connected_to_tcon_top(struct 
> device_node *node)
>  
>       remote = of_graph_get_remote_node(node, 0, -1);
>       if (remote) {
> -             ret = !!of_match_node(sun8i_tcon_top_of_table, remote);
> +             ret = !!(IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP) &&
> +                      of_match_node(sun8i_tcon_top_of_table, remote));
>               of_node_put(remote);
>       }
>  
> @@ -1402,13 +1403,20 @@ static int sun8i_r40_tcon_tv_set_mux(struct 
> sun4i_tcon *tcon,
>       if (!pdev)
>               return -EINVAL;
>  
> -     if (encoder->encoder_type == DRM_MODE_ENCODER_TMDS) {
> +     if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP) &&
> +         encoder->encoder_type == DRM_MODE_ENCODER_TMDS) {
>               ret = sun8i_tcon_top_set_hdmi_src(&pdev->dev, id);
>               if (ret)
>                       return ret;
>       }
>  
> -     return sun8i_tcon_top_de_config(&pdev->dev, tcon->id, id);
> +     if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP)) {
> +             ret = sun8i_tcon_top_de_config(&pdev->dev, tcon->id, id);
> +             if (ret)
> +                     return ret;
> +     }
> +
> +     return 0;
>  }
>  
>  static const struct sun4i_tcon_quirks sun4i_a10_quirks = {
> -- 
> 2.17.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to