linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma: remove bad_dma_ops to fix build fail
@ 2016-06-12 20:25 Sudip Mukherjee
  2016-06-12 21:32 ` Jerry Snitselaar
  0 siblings, 1 reply; 8+ messages in thread
From: Sudip Mukherjee @ 2016-06-12 20:25 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Sudip Mukherjee

m32r allmodconfig is failng with errors like:
ERROR: "bad_dma_ops" [sound/soc/bcm/snd-soc-cygnus.ko] undefined!

On checking the code it turns out that struct bad_dma_ops has been
declared as extern but no one has actually defined struct bad_dma_ops.
Lets remove that and return NULL from get_dma_ops() if HAS_DMA is not
defined.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---

This patch has been build tested with m32r allmodconfig,
x86_64 allmodconfig and i386 allmodconfig.

 include/linux/dma-mapping.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 71c1b21..583795a 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -113,10 +113,9 @@ int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma,
  * dma dependent code.  Code that depends on the dma-mapping
  * API needs to set 'depends on HAS_DMA' in its Kconfig
  */
-extern struct dma_map_ops bad_dma_ops;
 static inline struct dma_map_ops *get_dma_ops(struct device *dev)
 {
-	return &bad_dma_ops;
+	return NULL;
 }
 #endif
 
-- 
1.9.1

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

* Re: [PATCH] dma: remove bad_dma_ops to fix build fail
  2016-06-12 20:25 [PATCH] dma: remove bad_dma_ops to fix build fail Sudip Mukherjee
@ 2016-06-12 21:32 ` Jerry Snitselaar
  2016-06-13  7:41   ` Sudip Mukherjee
  2016-06-13  7:59   ` Christoph Hellwig
  0 siblings, 2 replies; 8+ messages in thread
From: Jerry Snitselaar @ 2016-06-12 21:32 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Andrew Morton, linux-kernel, Simran Rai, Christoph Hellwig

On Sun Jun 12 16, Sudip Mukherjee wrote:
>m32r allmodconfig is failng with errors like:
>ERROR: "bad_dma_ops" [sound/soc/bcm/snd-soc-cygnus.ko] undefined!
>
>On checking the code it turns out that struct bad_dma_ops has been
>declared as extern but no one has actually defined struct bad_dma_ops.
>Lets remove that and return NULL from get_dma_ops() if HAS_DMA is not
>defined.
>
>Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
>---
>
>This patch has been build tested with m32r allmodconfig,
>x86_64 allmodconfig and i386 allmodconfig.
>
> include/linux/dma-mapping.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
>index 71c1b21..583795a 100644
>--- a/include/linux/dma-mapping.h
>+++ b/include/linux/dma-mapping.h
>@@ -113,10 +113,9 @@ int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma,
>  * dma dependent code.  Code that depends on the dma-mapping
>  * API needs to set 'depends on HAS_DMA' in its Kconfig
>  */
>-extern struct dma_map_ops bad_dma_ops;
> static inline struct dma_map_ops *get_dma_ops(struct device *dev)
> {
>-	return &bad_dma_ops;
>+	return NULL;
> }
> #endif
>
>-- 
>1.9.1
>


Ccing Christoph since his commit introduced bad_dma_ops, and Simran
who wrote that cygnus code.

I'm thinking that is there to complain loudly when someone is trying
to use dma without HAS_DMA, correct Christoph?

cygnus_pcm_preallocate_dma_buffer() is calling dma_alloc_coherent(),
which ends up in a call to get_dma_ops() and tripping over the above.

Possibly this instead:

diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig
index d528aac..edf3671 100644
--- a/sound/soc/bcm/Kconfig
+++ b/sound/soc/bcm/Kconfig
@@ -11,6 +11,7 @@ config SND_BCM2835_SOC_I2S
 config SND_SOC_CYGNUS
 	tristate "SoC platform audio for Broadcom Cygnus chips"
 	depends on ARCH_BCM_CYGNUS || COMPILE_TEST
+	depends on HAS_DMA
 	help
 	  Say Y if you want to add support for ASoC audio on Broadcom
 	  Cygnus chips (bcm958300, bcm958305, bcm911360)

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

* Re: [PATCH] dma: remove bad_dma_ops to fix build fail
  2016-06-12 21:32 ` Jerry Snitselaar
@ 2016-06-13  7:41   ` Sudip Mukherjee
  2016-06-13  9:29     ` Mark Brown
  2016-06-13  7:59   ` Christoph Hellwig
  1 sibling, 1 reply; 8+ messages in thread
From: Sudip Mukherjee @ 2016-06-13  7:41 UTC (permalink / raw)
  To: Andrew Morton, linux-kernel, Simran Rai, Christoph Hellwig; +Cc: Mark Brown

On Sun, Jun 12, 2016 at 02:32:24PM -0700, Jerry Snitselaar wrote:
> On Sun Jun 12 16, Sudip Mukherjee wrote:
> >m32r allmodconfig is failng with errors like:
> >ERROR: "bad_dma_ops" [sound/soc/bcm/snd-soc-cygnus.ko] undefined!
> >
> >On checking the code it turns out that struct bad_dma_ops has been
> >declared as extern but no one has actually defined struct bad_dma_ops.
> >Lets remove that and return NULL from get_dma_ops() if HAS_DMA is not
> >defined.
> >
> >Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> >---
> >
<snip>
> 
> Ccing Christoph since his commit introduced bad_dma_ops, and Simran
> who wrote that cygnus code.
> 
> I'm thinking that is there to complain loudly when someone is trying
> to use dma without HAS_DMA, correct Christoph?
> 
> cygnus_pcm_preallocate_dma_buffer() is calling dma_alloc_coherent(),
> which ends up in a call to get_dma_ops() and tripping over the above.
> 
> Possibly this instead:
> 
> diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig
> index d528aac..edf3671 100644
> --- a/sound/soc/bcm/Kconfig
> +++ b/sound/soc/bcm/Kconfig
> @@ -11,6 +11,7 @@ config SND_BCM2835_SOC_I2S
> config SND_SOC_CYGNUS
> 	tristate "SoC platform audio for Broadcom Cygnus chips"
> 	depends on ARCH_BCM_CYGNUS || COMPILE_TEST
> +	depends on HAS_DMA
> 	help
> 	  Say Y if you want to add support for ASoC audio on Broadcom
> 	  Cygnus chips (bcm958300, bcm958305, bcm911360)

well, I have been doing the exact same thing for all the drivers that was
failing to build but in my last patch Mark suggested to have stub
implementation in the arch [1]. So while looking for that I noticed
bad_dma_ops is not defined by anyone. So what will you suggest?

addind Cc to Mark Brown also.

[1] http://www.spinics.net/lists/alsa-devel/msg50931.html

regards
sudip

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

* Re: [PATCH] dma: remove bad_dma_ops to fix build fail
  2016-06-12 21:32 ` Jerry Snitselaar
  2016-06-13  7:41   ` Sudip Mukherjee
@ 2016-06-13  7:59   ` Christoph Hellwig
  1 sibling, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2016-06-13  7:59 UTC (permalink / raw)
  To: Sudip Mukherjee, Andrew Morton, linux-kernel, Simran Rai,
	Christoph Hellwig

On Sun, Jun 12, 2016 at 02:32:24PM -0700, Jerry Snitselaar wrote:
> Ccing Christoph since his commit introduced bad_dma_ops, and Simran
> who wrote that cygnus code.
>
> I'm thinking that is there to complain loudly when someone is trying
> to use dma without HAS_DMA, correct Christoph?

Yes.  Note that I just refactored the code - before my commit
we simply had prototypes for the various DMA API functions that
never had an implementation to back them.

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

* Re: [PATCH] dma: remove bad_dma_ops to fix build fail
  2016-06-13  7:41   ` Sudip Mukherjee
@ 2016-06-13  9:29     ` Mark Brown
  2016-06-13 10:51       ` Sudip Mukherjee
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2016-06-13  9:29 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Andrew Morton, linux-kernel, Simran Rai, Christoph Hellwig

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

On Mon, Jun 13, 2016 at 08:41:12AM +0100, Sudip Mukherjee wrote:
> On Sun, Jun 12, 2016 at 02:32:24PM -0700, Jerry Snitselaar wrote:

> > config SND_SOC_CYGNUS
> > 	tristate "SoC platform audio for Broadcom Cygnus chips"
> > 	depends on ARCH_BCM_CYGNUS || COMPILE_TEST
> > +	depends on HAS_DMA
> > 	help
> > 	  Say Y if you want to add support for ASoC audio on Broadcom
> > 	  Cygnus chips (bcm958300, bcm958305, bcm911360)

> well, I have been doing the exact same thing for all the drivers that was
> failing to build but in my last patch Mark suggested to have stub
> implementation in the arch [1]. So while looking for that I noticed
> bad_dma_ops is not defined by anyone. So what will you suggest?

Right, we've got a couple of obscure architectures with no DMA support
which are leading to a constant stream of patches like this that are
being triggered by compile coverage stuff.  In situations like this we
very often provide stubs rather than having to handle this in lots of
different places in the code.

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

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

* Re: [PATCH] dma: remove bad_dma_ops to fix build fail
  2016-06-13  9:29     ` Mark Brown
@ 2016-06-13 10:51       ` Sudip Mukherjee
  2016-06-13 11:59         ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Sudip Mukherjee @ 2016-06-13 10:51 UTC (permalink / raw)
  To: Mark Brown; +Cc: Andrew Morton, linux-kernel, Simran Rai, Christoph Hellwig

On Mon, Jun 13, 2016 at 10:29:34AM +0100, Mark Brown wrote:
> On Mon, Jun 13, 2016 at 08:41:12AM +0100, Sudip Mukherjee wrote:
> > On Sun, Jun 12, 2016 at 02:32:24PM -0700, Jerry Snitselaar wrote:
> 
> > > config SND_SOC_CYGNUS
> > > 	tristate "SoC platform audio for Broadcom Cygnus chips"
> > > 	depends on ARCH_BCM_CYGNUS || COMPILE_TEST
> > > +	depends on HAS_DMA
> > > 	help
> > > 	  Say Y if you want to add support for ASoC audio on Broadcom
> > > 	  Cygnus chips (bcm958300, bcm958305, bcm911360)
> 
> > well, I have been doing the exact same thing for all the drivers that was
> > failing to build but in my last patch Mark suggested to have stub
> > implementation in the arch [1]. So while looking for that I noticed
> > bad_dma_ops is not defined by anyone. So what will you suggest?
> 
> Right, we've got a couple of obscure architectures with no DMA support
> which are leading to a constant stream of patches like this that are
> being triggered by compile coverage stuff.  In situations like this we
> very often provide stubs rather than having to handle this in lots of
> different places in the code.

Ok, I will do that. But I am seeing arch/m32r/include/asm/m32102.h is
defining the DMA Controller registers and also a MAX_DMA_ADDRESS is
defined in dma.h. Doesn't that mean that this arch is capable of DMA?

Regards
Sudip

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

* Re: [PATCH] dma: remove bad_dma_ops to fix build fail
  2016-06-13 10:51       ` Sudip Mukherjee
@ 2016-06-13 11:59         ` Mark Brown
  2016-06-13 12:11           ` Sudip Mukherjee
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2016-06-13 11:59 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Andrew Morton, linux-kernel, Simran Rai, Christoph Hellwig

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

On Mon, Jun 13, 2016 at 11:51:08AM +0100, Sudip Mukherjee wrote:
> On Mon, Jun 13, 2016 at 10:29:34AM +0100, Mark Brown wrote:

> > Right, we've got a couple of obscure architectures with no DMA support
> > which are leading to a constant stream of patches like this that are
> > being triggered by compile coverage stuff.  In situations like this we
> > very often provide stubs rather than having to handle this in lots of
> > different places in the code.

> Ok, I will do that. But I am seeing arch/m32r/include/asm/m32102.h is
> defining the DMA Controller registers and also a MAX_DMA_ADDRESS is
> defined in dma.h. Doesn't that mean that this arch is capable of DMA?

Quite possibly, but they don't seem to implement the standard interfaces
for generic code (this sort of thing is quite common for the less widely
used architectures sadly).

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

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

* Re: [PATCH] dma: remove bad_dma_ops to fix build fail
  2016-06-13 11:59         ` Mark Brown
@ 2016-06-13 12:11           ` Sudip Mukherjee
  0 siblings, 0 replies; 8+ messages in thread
From: Sudip Mukherjee @ 2016-06-13 12:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Andrew Morton, linux-kernel, Simran Rai, Christoph Hellwig

On Mon, Jun 13, 2016 at 12:59:11PM +0100, Mark Brown wrote:
> On Mon, Jun 13, 2016 at 11:51:08AM +0100, Sudip Mukherjee wrote:
> > On Mon, Jun 13, 2016 at 10:29:34AM +0100, Mark Brown wrote:
> 
> > > Right, we've got a couple of obscure architectures with no DMA support
> > > which are leading to a constant stream of patches like this that are
> > > being triggered by compile coverage stuff.  In situations like this we
> > > very often provide stubs rather than having to handle this in lots of
> > > different places in the code.
> 
> > Ok, I will do that. But I am seeing arch/m32r/include/asm/m32102.h is
> > defining the DMA Controller registers and also a MAX_DMA_ADDRESS is
> > defined in dma.h. Doesn't that mean that this arch is capable of DMA?
> 
> Quite possibly, but they don't seem to implement the standard interfaces
> for generic code (this sort of thing is quite common for the less widely
> used architectures sadly).

If only I had a board to play with the DMA code. :(

I will go for the stub like you said.

Regards
Sudip

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

end of thread, other threads:[~2016-06-13 12:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-12 20:25 [PATCH] dma: remove bad_dma_ops to fix build fail Sudip Mukherjee
2016-06-12 21:32 ` Jerry Snitselaar
2016-06-13  7:41   ` Sudip Mukherjee
2016-06-13  9:29     ` Mark Brown
2016-06-13 10:51       ` Sudip Mukherjee
2016-06-13 11:59         ` Mark Brown
2016-06-13 12:11           ` Sudip Mukherjee
2016-06-13  7:59   ` Christoph Hellwig

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