linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
@ 2019-10-01 14:20 Arnd Bergmann
  2019-10-01 14:45 ` Daniel Baluta
  2019-10-01 15:31 ` [alsa-devel] " Pierre-Louis Bossart
  0 siblings, 2 replies; 6+ messages in thread
From: Arnd Bergmann @ 2019-10-01 14:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Arnd Bergmann, Hulk Robot, YueHaibing, Daniel Baluta,
	Pierre-Louis Bossart, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, alsa-devel, linux-arm-kernel,
	linux-kernel

CONFIG_SND_SOC_SOF_IMX depends on CONFIG_SND_SOC_SOF, but is in
turn referenced by the sof-of-dev driver. This creates a reverse
dependency that manifests in a link error when CONFIG_SND_SOC_SOF_OF
is built-in but CONFIG_SND_SOC_SOF_IMX=m:

sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'

Make the latter a 'bool' symbol and change the Makefile so the imx8
driver is compiled the same way as the driver using it.

A nicer way would be to reverse the layering and move all
the imx specific bits of sof-of-dev.c into the imx driver
itself, which can then call into the common code. Doing this
would need more testing and can be done if we add another
driver like the first one.

Fixes: f4df4e4042b0 ("ASoC: SOF: imx8: Fix COMPILE_TEST error")
Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/soc/sof/imx/Kconfig  | 2 +-
 sound/soc/sof/imx/Makefile | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/imx/Kconfig b/sound/soc/sof/imx/Kconfig
index 5acae75f5750..a3891654a1fc 100644
--- a/sound/soc/sof/imx/Kconfig
+++ b/sound/soc/sof/imx/Kconfig
@@ -12,7 +12,7 @@ config SND_SOC_SOF_IMX_TOPLEVEL
 if SND_SOC_SOF_IMX_TOPLEVEL
 
 config SND_SOC_SOF_IMX8
-	tristate "SOF support for i.MX8"
+	bool "SOF support for i.MX8"
 	depends on IMX_SCU
 	depends on IMX_DSP
 	help
diff --git a/sound/soc/sof/imx/Makefile b/sound/soc/sof/imx/Makefile
index 6ef908e8c807..9e8f35df0ff2 100644
--- a/sound/soc/sof/imx/Makefile
+++ b/sound/soc/sof/imx/Makefile
@@ -1,4 +1,6 @@
 # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
 snd-sof-imx8-objs := imx8.o
 
-obj-$(CONFIG_SND_SOC_SOF_IMX8) += snd-sof-imx8.o
+ifdef CONFIG_SND_SOC_SOF_IMX8
+obj-$(CONFIG_SND_SOC_SOF_OF) += snd-sof-imx8.o
+endif
-- 
2.20.0


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

* Re: [PATCH] ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
  2019-10-01 14:20 [PATCH] ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency Arnd Bergmann
@ 2019-10-01 14:45 ` Daniel Baluta
  2019-10-01 15:31 ` [alsa-devel] " Pierre-Louis Bossart
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Baluta @ 2019-10-01 14:45 UTC (permalink / raw)
  To: broonie, arnd
  Cc: dl-linux-imx, linux-kernel, yuehaibing, pierre-louis.bossart,
	festevam, hulkci, tiwai, shawnguo, lgirdwood, linux-arm-kernel,
	perex, kernel, alsa-devel, s.hauer

On Tue, 2019-10-01 at 16:20 +0200, Arnd Bergmann wrote:
> CONFIG_SND_SOC_SOF_IMX depends on CONFIG_SND_SOC_SOF, but is in
> turn referenced by the sof-of-dev driver. This creates a reverse
> dependency that manifests in a link error when CONFIG_SND_SOC_SOF_OF
> is built-in but CONFIG_SND_SOC_SOF_IMX=m:
> 
> sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to
> `sof_imx8_ops'
> 
> Make the latter a 'bool' symbol and change the Makefile so the imx8
> driver is compiled the same way as the driver using it.
> 
> A nicer way would be to reverse the layering and move all
> the imx specific bits of sof-of-dev.c into the imx driver
> itself, which can then call into the common code. Doing this
> would need more testing and can be done if we add another
> driver like the first one.
> 
> Fixes: f4df4e4042b0 ("ASoC: SOF: imx8: Fix COMPILE_TEST error")
> Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Daniel Baluta <daniel.baluta@nxp.com>

Indeed we will need to somehow avoid getting sof_imx8_ops from 
sof-of-dev.c by directly referencing it. 

Will keep this in mind for the next platform.

Thanks a lot Arnd!

> ---
>  sound/soc/sof/imx/Kconfig  | 2 +-
>  sound/soc/sof/imx/Makefile | 4 +++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/sof/imx/Kconfig b/sound/soc/sof/imx/Kconfig
> index 5acae75f5750..a3891654a1fc 100644
> --- a/sound/soc/sof/imx/Kconfig
> +++ b/sound/soc/sof/imx/Kconfig
> @@ -12,7 +12,7 @@ config SND_SOC_SOF_IMX_TOPLEVEL
>  if SND_SOC_SOF_IMX_TOPLEVEL
>  
>  config SND_SOC_SOF_IMX8
> -	tristate "SOF support for i.MX8"
> +	bool "SOF support for i.MX8"
>  	depends on IMX_SCU
>  	depends on IMX_DSP
>  	help
> diff --git a/sound/soc/sof/imx/Makefile b/sound/soc/sof/imx/Makefile
> index 6ef908e8c807..9e8f35df0ff2 100644
> --- a/sound/soc/sof/imx/Makefile
> +++ b/sound/soc/sof/imx/Makefile
> @@ -1,4 +1,6 @@
>  # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
>  snd-sof-imx8-objs := imx8.o
>  
> -obj-$(CONFIG_SND_SOC_SOF_IMX8) += snd-sof-imx8.o
> +ifdef CONFIG_SND_SOC_SOF_IMX8
> +obj-$(CONFIG_SND_SOC_SOF_OF) += snd-sof-imx8.o
> +endif

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

* Re: [alsa-devel] [PATCH] ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
  2019-10-01 14:20 [PATCH] ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency Arnd Bergmann
  2019-10-01 14:45 ` Daniel Baluta
@ 2019-10-01 15:31 ` Pierre-Louis Bossart
  2019-10-01 15:41   ` Arnd Bergmann
  1 sibling, 1 reply; 6+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-01 15:31 UTC (permalink / raw)
  To: Arnd Bergmann, Mark Brown
  Cc: Hulk Robot, YueHaibing, Daniel Baluta, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	alsa-devel, linux-arm-kernel, linux-kernel

On 10/1/19 9:20 AM, Arnd Bergmann wrote:
> CONFIG_SND_SOC_SOF_IMX depends on CONFIG_SND_SOC_SOF, but is in
> turn referenced by the sof-of-dev driver. This creates a reverse
> dependency that manifests in a link error when CONFIG_SND_SOC_SOF_OF
> is built-in but CONFIG_SND_SOC_SOF_IMX=m:
> 
> sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'
> 
> Make the latter a 'bool' symbol and change the Makefile so the imx8
> driver is compiled the same way as the driver using it.
> 
> A nicer way would be to reverse the layering and move all
> the imx specific bits of sof-of-dev.c into the imx driver
> itself, which can then call into the common code. Doing this
> would need more testing and can be done if we add another
> driver like the first one.

Or use something like

config SND_SOC_SOF_IMX8_SUPPORT
	bool "SOF support for i.MX8"
    	depends on IMX_SCU
    	depends on IMX_DSP

config SND_SOC_SOF_IMX8
	tristate
	<i.mx selects>

config SND_SOC_SOF_OF
	depends on OF
	select SND_SOC_SOF_IMX8 if SND_SOC_SOF_IMX8_SUPPORT

That way you propagate the module/built-in information. That's how we 
fixed those issues for the Intel parts.

> 
> Fixes: f4df4e4042b0 ("ASoC: SOF: imx8: Fix COMPILE_TEST error")
> Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   sound/soc/sof/imx/Kconfig  | 2 +-
>   sound/soc/sof/imx/Makefile | 4 +++-
>   2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/sof/imx/Kconfig b/sound/soc/sof/imx/Kconfig
> index 5acae75f5750..a3891654a1fc 100644
> --- a/sound/soc/sof/imx/Kconfig
> +++ b/sound/soc/sof/imx/Kconfig
> @@ -12,7 +12,7 @@ config SND_SOC_SOF_IMX_TOPLEVEL
>   if SND_SOC_SOF_IMX_TOPLEVEL
>   
>   config SND_SOC_SOF_IMX8
> -	tristate "SOF support for i.MX8"
> +	bool "SOF support for i.MX8"
>   	depends on IMX_SCU
>   	depends on IMX_DSP
>   	help
> diff --git a/sound/soc/sof/imx/Makefile b/sound/soc/sof/imx/Makefile
> index 6ef908e8c807..9e8f35df0ff2 100644
> --- a/sound/soc/sof/imx/Makefile
> +++ b/sound/soc/sof/imx/Makefile
> @@ -1,4 +1,6 @@
>   # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
>   snd-sof-imx8-objs := imx8.o
>   
> -obj-$(CONFIG_SND_SOC_SOF_IMX8) += snd-sof-imx8.o
> +ifdef CONFIG_SND_SOC_SOF_IMX8
> +obj-$(CONFIG_SND_SOC_SOF_OF) += snd-sof-imx8.o
> +endif
> 


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

* Re: [alsa-devel] [PATCH] ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
  2019-10-01 15:31 ` [alsa-devel] " Pierre-Louis Bossart
@ 2019-10-01 15:41   ` Arnd Bergmann
  2019-10-01 16:03     ` Pierre-Louis Bossart
  0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2019-10-01 15:41 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Mark Brown, Hulk Robot, YueHaibing, Daniel Baluta, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	ALSA Development Mailing List, Linux ARM, linux-kernel

On Tue, Oct 1, 2019 at 5:32 PM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
> On 10/1/19 9:20 AM, Arnd Bergmann wrote:
> > CONFIG_SND_SOC_SOF_IMX depends on CONFIG_SND_SOC_SOF, but is in
> > turn referenced by the sof-of-dev driver. This creates a reverse
> > dependency that manifests in a link error when CONFIG_SND_SOC_SOF_OF
> > is built-in but CONFIG_SND_SOC_SOF_IMX=m:
> >
> > sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'
> >
> > Make the latter a 'bool' symbol and change the Makefile so the imx8
> > driver is compiled the same way as the driver using it.
> >
> > A nicer way would be to reverse the layering and move all
> > the imx specific bits of sof-of-dev.c into the imx driver
> > itself, which can then call into the common code. Doing this
> > would need more testing and can be done if we add another
> > driver like the first one.
>
> Or use something like
>
> config SND_SOC_SOF_IMX8_SUPPORT
>         bool "SOF support for i.MX8"
>         depends on IMX_SCU
>         depends on IMX_DSP
>
> config SND_SOC_SOF_IMX8
>         tristate
>         <i.mx selects>
>
> config SND_SOC_SOF_OF
>         depends on OF
>         select SND_SOC_SOF_IMX8 if SND_SOC_SOF_IMX8_SUPPORT
>
> That way you propagate the module/built-in information. That's how we
> fixed those issues for the Intel parts.

Yes, I think that would work here as well, but it keeps even more
information about the specific drivers in the generic code. It also
requires adding more 'select' statements that tend to cause more
problems.

The same could be done with a Kconfig-only solution avoiding
'select' such as:

config SND_SOC_SOF_IMX8_SUPPORT
         bool "SOF support for i.MX8"
         depends on IMX_SCU
         depends on IMX_DSP

 config SND_SOC_SOF_IMX8
         def_tristate SND_SOC_SOF_OF
         depends on SND_SOC_SOF_IMX8_SUPPORT

      Arnd

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

* Re: [alsa-devel] [PATCH] ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
  2019-10-01 15:41   ` Arnd Bergmann
@ 2019-10-01 16:03     ` Pierre-Louis Bossart
  2019-10-01 16:29       ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-01 16:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Mark Brown, Hulk Robot, YueHaibing, Daniel Baluta, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	ALSA Development Mailing List, Linux ARM, linux-kernel

On 10/1/19 10:41 AM, Arnd Bergmann wrote:
> On Tue, Oct 1, 2019 at 5:32 PM Pierre-Louis Bossart
> <pierre-louis.bossart@linux.intel.com> wrote:
>> On 10/1/19 9:20 AM, Arnd Bergmann wrote:
>>> CONFIG_SND_SOC_SOF_IMX depends on CONFIG_SND_SOC_SOF, but is in
>>> turn referenced by the sof-of-dev driver. This creates a reverse
>>> dependency that manifests in a link error when CONFIG_SND_SOC_SOF_OF
>>> is built-in but CONFIG_SND_SOC_SOF_IMX=m:
>>>
>>> sound/soc/sof/sof-of-dev.o:(.data+0x118): undefined reference to `sof_imx8_ops'
>>>
>>> Make the latter a 'bool' symbol and change the Makefile so the imx8
>>> driver is compiled the same way as the driver using it.
>>>
>>> A nicer way would be to reverse the layering and move all
>>> the imx specific bits of sof-of-dev.c into the imx driver
>>> itself, which can then call into the common code. Doing this
>>> would need more testing and can be done if we add another
>>> driver like the first one.
>>
>> Or use something like
>>
>> config SND_SOC_SOF_IMX8_SUPPORT
>>          bool "SOF support for i.MX8"
>>          depends on IMX_SCU
>>          depends on IMX_DSP
>>
>> config SND_SOC_SOF_IMX8
>>          tristate
>>          <i.mx selects>
>>
>> config SND_SOC_SOF_OF
>>          depends on OF
>>          select SND_SOC_SOF_IMX8 if SND_SOC_SOF_IMX8_SUPPORT
>>
>> That way you propagate the module/built-in information. That's how we
>> fixed those issues for the Intel parts.
> 
> Yes, I think that would work here as well, but it keeps even more
> information about the specific drivers in the generic code. It also
> requires adding more 'select' statements that tend to cause more
> problems.
> 
> The same could be done with a Kconfig-only solution avoiding
> 'select' such as:
> 
> config SND_SOC_SOF_IMX8_SUPPORT
>           bool "SOF support for i.MX8"
>           depends on IMX_SCU
>           depends on IMX_DSP
> 
>   config SND_SOC_SOF_IMX8
>           def_tristate SND_SOC_SOF_OF
>           depends on SND_SOC_SOF_IMX8_SUPPORT

Ah, nice, thanks for the suggestion! That would be my preference, we 
have a similar select for PCI and ACPI parts in sound/soc/sof/Kconfig 
and I was looking for a means to do this more elegantly.
I can submit a new fix or let you sent a v2, whatever is more convenient.


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

* Re: [alsa-devel] [PATCH] ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency
  2019-10-01 16:03     ` Pierre-Louis Bossart
@ 2019-10-01 16:29       ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2019-10-01 16:29 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Mark Brown, Hulk Robot, YueHaibing, Daniel Baluta, Liam Girdwood,
	Jaroslav Kysela, Takashi Iwai, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	ALSA Development Mailing List, Linux ARM, linux-kernel

On Tue, Oct 1, 2019 at 6:03 PM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
> On 10/1/19 10:41 AM, Arnd Bergmann wrote:
> > On Tue, Oct 1, 2019 at 5:32 PM Pierre-Louis Bossart
> > <pierre-louis.bossart@linux.intel.com> wrote:

> >
> > The same could be done with a Kconfig-only solution avoiding
> > 'select' such as:
> >
> > config SND_SOC_SOF_IMX8_SUPPORT
> >           bool "SOF support for i.MX8"
> >           depends on IMX_SCU
> >           depends on IMX_DSP
> >
> >   config SND_SOC_SOF_IMX8
> >           def_tristate SND_SOC_SOF_OF
> >           depends on SND_SOC_SOF_IMX8_SUPPORT
>
> Ah, nice, thanks for the suggestion! That would be my preference, we
> have a similar select for PCI and ACPI parts in sound/soc/sof/Kconfig
> and I was looking for a means to do this more elegantly.
> I can submit a new fix or let you sent a v2, whatever is more convenient.

Ok, please send a patch then, I can add it to my randconfig test tree to
make sure it covers all corner cases.

    Arnd

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

end of thread, other threads:[~2019-10-01 16:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 14:20 [PATCH] ASoC: SOF: imx: fix reverse CONFIG_SND_SOC_SOF_OF dependency Arnd Bergmann
2019-10-01 14:45 ` Daniel Baluta
2019-10-01 15:31 ` [alsa-devel] " Pierre-Louis Bossart
2019-10-01 15:41   ` Arnd Bergmann
2019-10-01 16:03     ` Pierre-Louis Bossart
2019-10-01 16:29       ` Arnd Bergmann

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).