All of lore.kernel.org
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] sh: declared coherent memory fixes
Date: Sun, 13 Jan 2008 14:01:37 +0000	[thread overview]
Message-ID: <20080113140137.30501.95132.sendpatchset@clockwork.opensource.se> (raw)

sh: declared coherent memory fixes

Two minor fixes for the recently added declared coherent memory implementation:
 - move the WARN_ON() to avoid triggering with usb storage and bounce buffer
 - add a BUG_ON() to make sure DMA_MEMORY_EXCLUSIVE isn't set

These may be of interest for x86 as well.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 arch/sh/mm/consistent.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- 0005/arch/sh/mm/consistent.c
+++ work/arch/sh/mm/consistent.c	2008-01-13 21:30:11.000000000 +0900
@@ -64,13 +64,15 @@ void dma_free_coherent(struct device *de
 	struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
 	int order = get_order(size);
 
-	WARN_ON(irqs_disabled());	/* for portability */
 	if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) {
 		int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
 
 		bitmap_release_region(mem->bitmap, page, order);
-	} else
+	} else {
+		WARN_ON(irqs_disabled());	/* for portability */
+		BUG_ON(mem && mem->flags & DMA_MEMORY_EXCLUSIVE);
 		free_pages((unsigned long)vaddr, order);
+	}
 }
 EXPORT_SYMBOL(dma_free_coherent);
 

                 reply	other threads:[~2008-01-13 14:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080113140137.30501.95132.sendpatchset@clockwork.opensource.se \
    --to=magnus.damm@gmail.com \
    --cc=linux-sh@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.