linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/sun4i: link in front-end code if needed
@ 2018-02-23 13:06 Arnd Bergmann
  2018-02-26  9:21 ` Maxime Ripard
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2018-02-23 13:06 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai
  Cc: Arnd Bergmann, David Airlie, Jernej Skrabec, Icenowy Zheng,
	Greg Kroah-Hartman, Jonathan Liu, dri-devel, linux-arm-kernel,
	linux-kernel

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/sun4i/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
index 582607c0c488..db14e023256b 100644
--- a/drivers/gpu/drm/sun4i/Makefile
+++ b/drivers/gpu/drm/sun4i/Makefile
@@ -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
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/sun4i: link in front-end code if needed
  2018-02-23 13:06 [PATCH] drm/sun4i: link in front-end code if needed Arnd Bergmann
@ 2018-02-26  9:21 ` Maxime Ripard
  2018-02-26  9:31   ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime Ripard @ 2018-02-26  9:21 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Chen-Yu Tsai, David Airlie, Jernej Skrabec, Icenowy Zheng,
	Greg Kroah-Hartman, Jonathan Liu, dri-devel, linux-arm-kernel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]

Hi,

On Fri, Feb 23, 2018 at 02:06:52PM +0100, Arnd Bergmann wrote:
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/sun4i/Makefile | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
> index 582607c0c488..db14e023256b 100644
> --- a/drivers/gpu/drm/sun4i/Makefile
> +++ b/drivers/gpu/drm/sun4i/Makefile
> @@ -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

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/sun4i: link in front-end code if needed
  2018-02-26  9:21 ` Maxime Ripard
@ 2018-02-26  9:31   ` Arnd Bergmann
  2018-02-26 10:53     ` Maxime Ripard
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2018-02-26  9:31 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, David Airlie, Jernej Skrabec, Icenowy Zheng,
	Greg Kroah-Hartman, Jonathan Liu, dri-devel, Linux ARM,
	Linux Kernel Mailing List

On Mon, Feb 26, 2018 at 10:21 AM, Maxime Ripard
<maxime.ripard@bootlin.com> wrote:
> Hi,
>
> On Fri, Feb 23, 2018 at 02:06:52PM +0100, Arnd Bergmann wrote:
>> 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")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>  drivers/gpu/drm/sun4i/Makefile | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
>> index 582607c0c488..db14e023256b 100644
>> --- a/drivers/gpu/drm/sun4i/Makefile
>> +++ b/drivers/gpu/drm/sun4i/Makefile
>> @@ -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?

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/sun4i: link in front-end code if needed
  2018-02-26  9:31   ` Arnd Bergmann
@ 2018-02-26 10:53     ` Maxime Ripard
  2018-02-26 10:55       ` Chen-Yu Tsai
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime Ripard @ 2018-02-26 10:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Chen-Yu Tsai, David Airlie, Jernej Skrabec, Icenowy Zheng,
	Greg Kroah-Hartman, Jonathan Liu, dri-devel, Linux ARM,
	Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 2243 bytes --]

On Mon, Feb 26, 2018 at 10:31:51AM +0100, Arnd Bergmann wrote:
> On Mon, Feb 26, 2018 at 10:21 AM, Maxime Ripard
> <maxime.ripard@bootlin.com> wrote:
> > Hi,
> >
> > On Fri, Feb 23, 2018 at 02:06:52PM +0100, Arnd Bergmann wrote:
> >> 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")
> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >> ---
> >>  drivers/gpu/drm/sun4i/Makefile | 5 ++++-
> >>  1 file changed, 4 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
> >> index 582607c0c488..db14e023256b 100644
> >> --- a/drivers/gpu/drm/sun4i/Makefile
> >> +++ b/drivers/gpu/drm/sun4i/Makefile
> >> @@ -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?
> 
> 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

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/sun4i: link in front-end code if needed
  2018-02-26 10:53     ` Maxime Ripard
@ 2018-02-26 10:55       ` Chen-Yu Tsai
  2018-03-01  9:19         ` Maxime Ripard
  0 siblings, 1 reply; 6+ messages in thread
From: Chen-Yu Tsai @ 2018-02-26 10:55 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Arnd Bergmann, David Airlie, Jernej Skrabec, Icenowy Zheng,
	Greg Kroah-Hartman, Jonathan Liu, dri-devel, Linux ARM,
	Linux Kernel Mailing List

On Mon, Feb 26, 2018 at 6:53 PM, Maxime Ripard
<maxime.ripard@bootlin.com> wrote:
> On Mon, Feb 26, 2018 at 10:31:51AM +0100, Arnd Bergmann wrote:
>> On Mon, Feb 26, 2018 at 10:21 AM, Maxime Ripard
>> <maxime.ripard@bootlin.com> wrote:
>> > Hi,
>> >
>> > On Fri, Feb 23, 2018 at 02:06:52PM +0100, Arnd Bergmann wrote:
>> >> 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")
>> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> >> ---
>> >>  drivers/gpu/drm/sun4i/Makefile | 5 ++++-
>> >>  1 file changed, 4 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
>> >> index 582607c0c488..db14e023256b 100644
>> >> --- a/drivers/gpu/drm/sun4i/Makefile
>> >> +++ b/drivers/gpu/drm/sun4i/Makefile
>> >> @@ -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?
>>
>> 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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/sun4i: link in front-end code if needed
  2018-02-26 10:55       ` Chen-Yu Tsai
@ 2018-03-01  9:19         ` Maxime Ripard
  0 siblings, 0 replies; 6+ messages in thread
From: Maxime Ripard @ 2018-03-01  9:19 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Arnd Bergmann, David Airlie, Jernej Skrabec, Icenowy Zheng,
	Greg Kroah-Hartman, Jonathan Liu, dri-devel, Linux ARM,
	Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 2887 bytes --]

On Mon, Feb 26, 2018 at 06:55:49PM +0800, Chen-Yu Tsai wrote:
> On Mon, Feb 26, 2018 at 6:53 PM, Maxime Ripard
> <maxime.ripard@bootlin.com> wrote:
> > On Mon, Feb 26, 2018 at 10:31:51AM +0100, Arnd Bergmann wrote:
> >> On Mon, Feb 26, 2018 at 10:21 AM, Maxime Ripard
> >> <maxime.ripard@bootlin.com> wrote:
> >> > Hi,
> >> >
> >> > On Fri, Feb 23, 2018 at 02:06:52PM +0100, Arnd Bergmann wrote:
> >> >> 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")
> >> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >> >> ---
> >> >>  drivers/gpu/drm/sun4i/Makefile | 5 ++++-
> >> >>  1 file changed, 4 insertions(+), 1 deletion(-)
> >> >>
> >> >> diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
> >> >> index 582607c0c488..db14e023256b 100644
> >> >> --- a/drivers/gpu/drm/sun4i/Makefile
> >> >> +++ b/drivers/gpu/drm/sun4i/Makefile
> >> >> @@ -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?
> >>
> >> 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
> 
> 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

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-03-01  9:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-23 13:06 [PATCH] drm/sun4i: link in front-end code if needed Arnd Bergmann
2018-02-26  9:21 ` Maxime Ripard
2018-02-26  9:31   ` Arnd Bergmann
2018-02-26 10:53     ` Maxime Ripard
2018-02-26 10:55       ` Chen-Yu Tsai
2018-03-01  9:19         ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).