Skip to contentSkip to conversation

drm/sun4i: link in front-end code if needed

PATCH Superseded Arnd Bergmann 3 participants 6 messages Feb 23, 2018 – Mar 1, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/sun4i: link in front-end code if needed

When the base sun4i DRM driver is built-in but the back-end is a loadable module, we run into a link error:

drivers/gpu/drm/sun4i/sun4i_drv.o: In function `sun4i_drv_probe':
sun4i_drv.c:(.text+0x60c): undefined reference to `sun4i_frontend_of_table'

The dependency is a bit tricky, the best workaround I have come up with is to use a Makefile hack to to interpret both CONFIG_DRM_SUN4I_BACKEND=m and CONFIG_DRM_SUN4I_BACKEND=y as a directive to build the front-end the same way as the main module.

Fixes dd0421f47505 ("drm/sun4i: Add a driver for the display frontend")
---
 drivers/gpu/drm/sun4i/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/Makefile +4 -1
index 582607c0c488..db14e023256b 100644
@@ -25,6 +25,9 @@ obj-$(CONFIG_DRM_SUN4I)		+= sun4i-tcon.o
 obj-$(CONFIG_DRM_SUN4I)		+= sun4i_tv.o
 obj-$(CONFIG_DRM_SUN4I)		+= sun6i_drc.o
 
-obj-$(CONFIG_DRM_SUN4I_BACKEND)	+= sun4i-backend.o sun4i-frontend.o
+obj-$(CONFIG_DRM_SUN4I_BACKEND)	+= sun4i-backend.o
+ifdef CONFIG_DRM_SUN4I_BACKEND
+obj-$(CONFIG_DRM_SUN4I)		+= sun4i-frontend.o
+endif
 obj-$(CONFIG_DRM_SUN4I_HDMI)	+= sun4i-drm-hdmi.o
 obj-$(CONFIG_DRM_SUN8I_MIXER)	+= sun8i-mixer.o
Signature · 1 line
2.9.0
#1 lore raw

Hi,

Quoted 22 lines · Arnd Bergmann

When the base sun4i DRM driver is built-in but the back-end is a loadable module, we run into a link error:

drivers/gpu/drm/sun4i/sun4i_drv.o: In function `sun4i_drv_probe':
sun4i_drv.c:(.text+0x60c): undefined reference to `sun4i_frontend_of_table'

The dependency is a bit tricky, the best workaround I have come up with is to use a Makefile hack to to interpret both CONFIG_DRM_SUN4I_BACKEND=m and CONFIG_DRM_SUN4I_BACKEND=y as a directive to build the front-end the same way as the main module.

Fixes dd0421f47505 ("drm/sun4i: Add a driver for the display frontend")
---
 drivers/gpu/drm/sun4i/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/Makefile +0 -0
index 582607c0c488..db14e023256b 100644

drivers/gpu/drm/sun4i/Makefile obj-$(CONFIG_DRM_SUN4I) += sun4i-tcon.o · line 31

Quoted 8 lines
drivers/gpu/drm/sun4i/Makefile +4 -1
@@ -25,6 +25,9 @@ obj-$(CONFIG_DRM_SUN4I)		+= sun4i-tcon.o
 obj-$(CONFIG_DRM_SUN4I)		+= sun4i_tv.o
 obj-$(CONFIG_DRM_SUN4I)		+= sun6i_drc.o
 
-obj-$(CONFIG_DRM_SUN4I_BACKEND)	+= sun4i-backend.o sun4i-frontend.o
+obj-$(CONFIG_DRM_SUN4I_BACKEND)	+= sun4i-backend.o
+ifdef CONFIG_DRM_SUN4I_BACKEND
+obj-$(CONFIG_DRM_SUN4I)		+= sun4i-frontend.o
+endif

Can we just create a Kconfig symbol, selected by DRM_SUN4I_BACKEND, and we would export the symbol?

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180226/a8044cad/attachment-0001.sig>
#2 lore raw
Quoted 28 lines · Maxime Ripard

Hi,

Quoted 25 lines · Arnd Bergmann

When the base sun4i DRM driver is built-in but the back-end is a loadable module, we run into a link error:

drivers/gpu/drm/sun4i/sun4i_drv.o: In function `sun4i_drv_probe':
sun4i_drv.c:(.text+0x60c): undefined reference to `sun4i_frontend_of_table'

The dependency is a bit tricky, the best workaround I have come up with is to use a Makefile hack to to interpret both CONFIG_DRM_SUN4I_BACKEND=m and CONFIG_DRM_SUN4I_BACKEND=y as a directive to build the front-end the same way as the main module.

Fixes dd0421f47505 ("drm/sun4i: Add a driver for the display frontend")
---
 drivers/gpu/drm/sun4i/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/Makefile +0 -0
index 582607c0c488..db14e023256b 100644
@@ -25,6 +25,9 @@ obj-$(CONFIG_DRM_SUN4I)             += sun4i-tcon.o
 obj-$(CONFIG_DRM_SUN4I)              += sun4i_tv.o
 obj-$(CONFIG_DRM_SUN4I)              += sun6i_drc.o
 
Quoted 8 lines

drivers/gpu/drm/sun4i/Makefile obj-$(CONFIG_DRM_SUN4I) += sun4i-tcon.o · line 31

Quoted 5 lines
drivers/gpu/drm/sun4i/Makefile +4 -1
-obj-$(CONFIG_DRM_SUN4I_BACKEND)      += sun4i-backend.o sun4i-frontend.o
+obj-$(CONFIG_DRM_SUN4I_BACKEND)      += sun4i-backend.o
+ifdef CONFIG_DRM_SUN4I_BACKEND
+obj-$(CONFIG_DRM_SUN4I)              += sun4i-frontend.o
+endif

Can we just create a Kconfig symbol, selected by DRM_SUN4I_BACKEND, and we would export the symbol?

Yes, I think that would work just as well. Something like

config DRM_SUN4I_FRONTEND

      tristate
      default DRM_SUN4I if CONFIG_DRM_SUN4I_BACKEND != n

should do the trick.

Arnd

#3 lore raw
Quoted 39 lines · Arnd Bergmann
Quoted 28 lines · Maxime Ripard

Hi,

Quoted 25 lines · Arnd Bergmann

When the base sun4i DRM driver is built-in but the back-end is a loadable module, we run into a link error:

drivers/gpu/drm/sun4i/sun4i_drv.o: In function `sun4i_drv_probe':
sun4i_drv.c:(.text+0x60c): undefined reference to `sun4i_frontend_of_table'

The dependency is a bit tricky, the best workaround I have come up with is to use a Makefile hack to to interpret both CONFIG_DRM_SUN4I_BACKEND=m and CONFIG_DRM_SUN4I_BACKEND=y as a directive to build the front-end the same way as the main module.

Fixes dd0421f47505 ("drm/sun4i: Add a driver for the display frontend")
---
 drivers/gpu/drm/sun4i/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/Makefile +0 -0
index 582607c0c488..db14e023256b 100644
@@ -25,6 +25,9 @@ obj-$(CONFIG_DRM_SUN4I)             += sun4i-tcon.o
 obj-$(CONFIG_DRM_SUN4I)              += sun4i_tv.o
 obj-$(CONFIG_DRM_SUN4I)              += sun6i_drc.o
 
Quoted 8 lines

drivers/gpu/drm/sun4i/Makefile obj-$(CONFIG_DRM_SUN4I) += sun4i-tcon.o · line 31

Quoted 5 lines
drivers/gpu/drm/sun4i/Makefile +4 -1
-obj-$(CONFIG_DRM_SUN4I_BACKEND)      += sun4i-backend.o sun4i-frontend.o
+obj-$(CONFIG_DRM_SUN4I_BACKEND)      += sun4i-backend.o
+ifdef CONFIG_DRM_SUN4I_BACKEND
+obj-$(CONFIG_DRM_SUN4I)              += sun4i-frontend.o
+endif

Can we just create a Kconfig symbol, selected by DRM_SUN4I_BACKEND, and we would export the symbol?

Quoted 7 lines

Yes, I think that would work just as well. Something like

config DRM_SUN4I_FRONTEND

      tristate
      default DRM_SUN4I if CONFIG_DRM_SUN4I_BACKEND != n

should do the trick.

I had more something like this in mind:
https://pastebin.com/raw/XydvzAtz

Maxime

Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180226/b12de33e/attachment.sig>
#4 lore raw
Quoted 42 lines · Maxime Ripard
Quoted 41 lines · Arnd Bergmann
Quoted 28 lines · Maxime Ripard

Hi,

Quoted 25 lines · Arnd Bergmann

When the base sun4i DRM driver is built-in but the back-end is a loadable module, we run into a link error:

drivers/gpu/drm/sun4i/sun4i_drv.o: In function `sun4i_drv_probe':
sun4i_drv.c:(.text+0x60c): undefined reference to `sun4i_frontend_of_table'

The dependency is a bit tricky, the best workaround I have come up with is to use a Makefile hack to to interpret both CONFIG_DRM_SUN4I_BACKEND=m and CONFIG_DRM_SUN4I_BACKEND=y as a directive to build the front-end the same way as the main module.

Fixes dd0421f47505 ("drm/sun4i: Add a driver for the display frontend")
---
 drivers/gpu/drm/sun4i/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/Makefile +0 -0
index 582607c0c488..db14e023256b 100644
@@ -25,6 +25,9 @@ obj-$(CONFIG_DRM_SUN4I)             += sun4i-tcon.o
 obj-$(CONFIG_DRM_SUN4I)              += sun4i_tv.o
 obj-$(CONFIG_DRM_SUN4I)              += sun6i_drc.o
 
Quoted 8 lines

drivers/gpu/drm/sun4i/Makefile obj-$(CONFIG_DRM_SUN4I) += sun4i-tcon.o · line 31

Quoted 5 lines
drivers/gpu/drm/sun4i/Makefile +4 -1
-obj-$(CONFIG_DRM_SUN4I_BACKEND)      += sun4i-backend.o sun4i-frontend.o
+obj-$(CONFIG_DRM_SUN4I_BACKEND)      += sun4i-backend.o
+ifdef CONFIG_DRM_SUN4I_BACKEND
+obj-$(CONFIG_DRM_SUN4I)              += sun4i-frontend.o
+endif

Can we just create a Kconfig symbol, selected by DRM_SUN4I_BACKEND, and we would export the symbol?

Yes, I think that would work just as well. Something like

Quoted 8 lines
Quoted 5 lines

config DRM_SUN4I_FRONTEND

      tristate
      default DRM_SUN4I if CONFIG_DRM_SUN4I_BACKEND != n

should do the trick.

I had more something like this in mind:
https://pastebin.com/raw/XydvzAtz

This doesn't solve the issue at hand, which is sun4i-drv (CONFIG_DRM_SUN4I) requires something in sun4i-backend (CONFIG_DRM_SUN4I_BACKEND), and if sun4i-drv is built-in, then anything it uses must also be built-in.

ChenYu

#5 lore raw
Quoted 48 lines · Chen-Yu Tsai
Quoted 46 lines · Maxime Ripard
Quoted 45 lines · Arnd Bergmann
Quoted 28 lines · Maxime Ripard

Hi,

Quoted 25 lines · Arnd Bergmann

When the base sun4i DRM driver is built-in but the back-end is a loadable module, we run into a link error:

drivers/gpu/drm/sun4i/sun4i_drv.o: In function `sun4i_drv_probe':
sun4i_drv.c:(.text+0x60c): undefined reference to `sun4i_frontend_of_table'

The dependency is a bit tricky, the best workaround I have come up with is to use a Makefile hack to to interpret both CONFIG_DRM_SUN4I_BACKEND=m and CONFIG_DRM_SUN4I_BACKEND=y as a directive to build the front-end the same way as the main module.

Fixes dd0421f47505 ("drm/sun4i: Add a driver for the display frontend")
---
 drivers/gpu/drm/sun4i/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/Makefile +0 -0
index 582607c0c488..db14e023256b 100644
@@ -25,6 +25,9 @@ obj-$(CONFIG_DRM_SUN4I)             += sun4i-tcon.o
 obj-$(CONFIG_DRM_SUN4I)              += sun4i_tv.o
 obj-$(CONFIG_DRM_SUN4I)              += sun6i_drc.o
 
Quoted 8 lines

drivers/gpu/drm/sun4i/Makefile obj-$(CONFIG_DRM_SUN4I) += sun4i-tcon.o · line 31

Quoted 5 lines
drivers/gpu/drm/sun4i/Makefile +4 -1
-obj-$(CONFIG_DRM_SUN4I_BACKEND)      += sun4i-backend.o sun4i-frontend.o
+obj-$(CONFIG_DRM_SUN4I_BACKEND)      += sun4i-backend.o
+ifdef CONFIG_DRM_SUN4I_BACKEND
+obj-$(CONFIG_DRM_SUN4I)              += sun4i-frontend.o
+endif

Can we just create a Kconfig symbol, selected by DRM_SUN4I_BACKEND, and we would export the symbol?

Yes, I think that would work just as well. Something like

config DRM_SUN4I_FRONTEND

      tristate
      default DRM_SUN4I if CONFIG_DRM_SUN4I_BACKEND != n
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

should do the trick.

I had more something like this in mind:
https://pastebin.com/raw/XydvzAtz

This doesn't solve the issue at hand, which is sun4i-drv (CONFIG_DRM_SUN4I) requires something in sun4i-backend (CONFIG_DRM_SUN4I_BACKEND), and if sun4i-drv is built-in, then anything it uses must also be built-in.

Ah, right. Then I guess Arnd's suggestion is the best we can have. Arnd, can you resubmit that patch?

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180301/5ef8669f/attachment.sig>