linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerry Snitselaar <dev@snitselaar.org>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Simran Rai <ssimran@broadcom.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] dma: remove bad_dma_ops to fix build fail
Date: Sun, 12 Jun 2016 14:32:24 -0700	[thread overview]
Message-ID: <20160612213224.fcjalhwmjqwpjhui@rhwork> (raw)
In-Reply-To: <1465763104-6227-1-git-send-email-sudipm.mukherjee@gmail.com>

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)

  reply	other threads:[~2016-06-12 21:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-12 20:25 [PATCH] dma: remove bad_dma_ops to fix build fail Sudip Mukherjee
2016-06-12 21:32 ` Jerry Snitselaar [this message]
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

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=20160612213224.fcjalhwmjqwpjhui@rhwork \
    --to=dev@snitselaar.org \
    --cc=akpm@linux-foundation.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ssimran@broadcom.com \
    --cc=sudipm.mukherjee@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 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).