All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kernel test robot <lkp@intel.com>, Arnd Bergmann <arnd@arndb.de>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Javier Martinez Canillas <javierm@redhat.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Douglas Anderson <dianders@chromium.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/panel-edp: modify Kconfig to prevent build error
Date: Wed, 17 Nov 2021 08:58:31 +0100	[thread overview]
Message-ID: <CAK8P3a1cayrsR9J+G6bAkZjK-hGaNzqSQAxB5LS4pvJm_rtpHQ@mail.gmail.com> (raw)
In-Reply-To: <20211117062704.14671-1-rdunlap@infradead.org>

On Wed, Nov 17, 2021 at 7:27 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> When CONFIG_DRM_KMS_HELPER=m and CONFIG_DRM_PANEL_EDP=y,
> there is a build error in gpu/drm/panel/panel-edp.o:
>
> arm-linux-gnueabi-ld: drivers/gpu/drm/panel/panel-edp.o: in function `panel_edp_probe':
> panel-edp.c:(.text+0xf38): undefined reference to `drm_panel_dp_aux_backlight'
>
> Fix this by limiting DRM_PANEL_DEP by the value of the DRM_KMS_HELPER
> symbol.

I think the analysis is correct, but this is not the correct fix since
DRM_KMS_HELPER
is not user-selectable. (Almost) all other drivers that rely on DRM_KMS_HELPER
use 'select' for this, and mixing the two risks running into circular
dependencies.

I see that there are already some 'depends on DRM_KMS_HELPER' in bridge
and panel drivers, so it's possible that we have to fix them all at the same to
do this right. I ran into another problem like this the other day and
I'm currently
testing with the patch below, but I have not posted that yet since I am not
fully convinced that this is the correct fix either.

        Arnd
---
commit a836092fedaac66af03ea9ed7cb13214fd2ab8a2
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Mon Nov 15 16:54:04 2021 +0100

    drm/mipi-dbi: select CONFIG_DRM_KMS_HELPER

    The driver fails to build when the KMS helpers are disabled:

    ld.lld: error: undefined symbol: drm_gem_fb_get_obj
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_fb_dirty) in
archive drivers/built-in.a

    ld.lld: error: undefined symbol: drm_gem_fb_begin_cpu_access
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

    ld.lld: error: undefined symbol: drm_fb_swab
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

    ld.lld: error: undefined symbol: drm_fb_xrgb8888_to_rgb565
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

    ld.lld: error: undefined symbol: drm_fb_memcpy
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

    This is fairly hard to hit in randconfig drivers, but it eventually
    did trigger for me in a configuration where all other DRM drivers
    are loadable modules, but DRM_PANEL_WIDECHIPS_WS2401 was built-in.

    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 0039df26854b..a03c2761c5f9 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -29,6 +29,7 @@ menuconfig DRM

 config DRM_MIPI_DBI
        tristate
+       select DRM_KMS_HELPER
        depends on DRM

 config DRM_MIPI_DSI
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 431b6e12a81f..17a8d603e7d8 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -8,7 +8,6 @@ config DRM_BRIDGE
 config DRM_PANEL_BRIDGE
        def_bool y
        depends on DRM_BRIDGE
-       depends on DRM_KMS_HELPER
        select DRM_PANEL
        help
          DRM bridge wrapper of DRM panels
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index cfc8d644cedf..40ec20f3552d 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -140,9 +140,8 @@ config DRM_PANEL_ILITEK_IL9322
 config DRM_PANEL_ILITEK_ILI9341
        tristate "Ilitek ILI9341 240x320 QVGA panels"
        depends on OF && SPI
-       depends on DRM_KMS_HELPER
-       depends on DRM_KMS_CMA_HELPER
        depends on BACKLIGHT_CLASS_DEVICE
+       select DRM_KMS_CMA_HELPER
        select DRM_MIPI_DBI
        help
          Say Y here if you want to enable support for Ilitek IL9341

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Douglas Anderson <dianders@chromium.org>,
	kernel test robot <lkp@intel.com>, Arnd Bergmann <arnd@arndb.de>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Javier Martinez Canillas <javierm@redhat.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH] drm/panel-edp: modify Kconfig to prevent build error
Date: Wed, 17 Nov 2021 08:58:31 +0100	[thread overview]
Message-ID: <CAK8P3a1cayrsR9J+G6bAkZjK-hGaNzqSQAxB5LS4pvJm_rtpHQ@mail.gmail.com> (raw)
In-Reply-To: <20211117062704.14671-1-rdunlap@infradead.org>

On Wed, Nov 17, 2021 at 7:27 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> When CONFIG_DRM_KMS_HELPER=m and CONFIG_DRM_PANEL_EDP=y,
> there is a build error in gpu/drm/panel/panel-edp.o:
>
> arm-linux-gnueabi-ld: drivers/gpu/drm/panel/panel-edp.o: in function `panel_edp_probe':
> panel-edp.c:(.text+0xf38): undefined reference to `drm_panel_dp_aux_backlight'
>
> Fix this by limiting DRM_PANEL_DEP by the value of the DRM_KMS_HELPER
> symbol.

I think the analysis is correct, but this is not the correct fix since
DRM_KMS_HELPER
is not user-selectable. (Almost) all other drivers that rely on DRM_KMS_HELPER
use 'select' for this, and mixing the two risks running into circular
dependencies.

I see that there are already some 'depends on DRM_KMS_HELPER' in bridge
and panel drivers, so it's possible that we have to fix them all at the same to
do this right. I ran into another problem like this the other day and
I'm currently
testing with the patch below, but I have not posted that yet since I am not
fully convinced that this is the correct fix either.

        Arnd
---
commit a836092fedaac66af03ea9ed7cb13214fd2ab8a2
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Mon Nov 15 16:54:04 2021 +0100

    drm/mipi-dbi: select CONFIG_DRM_KMS_HELPER

    The driver fails to build when the KMS helpers are disabled:

    ld.lld: error: undefined symbol: drm_gem_fb_get_obj
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_fb_dirty) in
archive drivers/built-in.a

    ld.lld: error: undefined symbol: drm_gem_fb_begin_cpu_access
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

    ld.lld: error: undefined symbol: drm_fb_swab
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

    ld.lld: error: undefined symbol: drm_fb_xrgb8888_to_rgb565
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

    ld.lld: error: undefined symbol: drm_fb_memcpy
    >>> referenced by drm_mipi_dbi.c
    >>>               gpu/drm/drm_mipi_dbi.o:(mipi_dbi_buf_copy) in
archive drivers/built-in.a

    This is fairly hard to hit in randconfig drivers, but it eventually
    did trigger for me in a configuration where all other DRM drivers
    are loadable modules, but DRM_PANEL_WIDECHIPS_WS2401 was built-in.

    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 0039df26854b..a03c2761c5f9 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -29,6 +29,7 @@ menuconfig DRM

 config DRM_MIPI_DBI
        tristate
+       select DRM_KMS_HELPER
        depends on DRM

 config DRM_MIPI_DSI
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 431b6e12a81f..17a8d603e7d8 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -8,7 +8,6 @@ config DRM_BRIDGE
 config DRM_PANEL_BRIDGE
        def_bool y
        depends on DRM_BRIDGE
-       depends on DRM_KMS_HELPER
        select DRM_PANEL
        help
          DRM bridge wrapper of DRM panels
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index cfc8d644cedf..40ec20f3552d 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -140,9 +140,8 @@ config DRM_PANEL_ILITEK_IL9322
 config DRM_PANEL_ILITEK_ILI9341
        tristate "Ilitek ILI9341 240x320 QVGA panels"
        depends on OF && SPI
-       depends on DRM_KMS_HELPER
-       depends on DRM_KMS_CMA_HELPER
        depends on BACKLIGHT_CLASS_DEVICE
+       select DRM_KMS_CMA_HELPER
        select DRM_MIPI_DBI
        help
          Say Y here if you want to enable support for Ilitek IL9341

  reply	other threads:[~2021-11-17  7:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17  6:27 [PATCH] drm/panel-edp: modify Kconfig to prevent build error Randy Dunlap
2021-11-17  6:27 ` Randy Dunlap
2021-11-17  7:58 ` Arnd Bergmann [this message]
2021-11-17  7:58   ` Arnd Bergmann
2021-11-17 20:04   ` Randy Dunlap
2021-11-17 20:04     ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK8P3a1cayrsR9J+G6bAkZjK-hGaNzqSQAxB5LS4pvJm_rtpHQ@mail.gmail.com \
    --to=arnd@arndb.de \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=rdunlap@infradead.org \
    --cc=sam@ravnborg.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.