diff mbox

[5/6] ASoC: samsung idma: Add proper annotation for casting iomem pointers

Message ID 1408285102-24538-6-git-send-email-lars@metafoo.de (mailing list archive)
State Accepted
Commit e8a70c25b809367fc314743e1ba1dbf0159398a7
Headers show

Commit Message

Lars-Peter Clausen Aug. 17, 2014, 2:18 p.m. UTC
It is not always possible to interchange iomem pointers with normal pointers,
which why we have annotations for iomem pointers and warn when casting them to a
normal pointer or vice versa. In this case the casting is fine and unfortunately
necessary so add the proper annotations to tell code checkers that it is
intentional. This silences the following warnings from sparse:
	sound/soc/samsung/idma.c:354:20: warning: incorrect type in argument 1
	 (different address spaces) expected void volatile [noderef]
	  <asn:2>*addr got unsigned char *area
	sound/soc/samsung/idma.c:372:22: warning: cast removes address space of
	 expression

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/samsung/idma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Brown Aug. 17, 2014, 2:35 p.m. UTC | #1
On Sun, Aug 17, 2014 at 04:18:21PM +0200, Lars-Peter Clausen wrote:
> It is not always possible to interchange iomem pointers with normal pointers,
> which why we have annotations for iomem pointers and warn when casting them to a
> normal pointer or vice versa. In this case the casting is fine and unfortunately

Applied, thanks.  As I've said on a number of occasions you should word
wrap your changelogs below 80 columns not at exactly 80 columns so that
replies to the mails are readable.
diff mbox

Patch

diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c
index db6cefa..0e8dd98 100644
--- a/sound/soc/samsung/idma.c
+++ b/sound/soc/samsung/idma.c
@@ -351,7 +351,7 @@  static void idma_free(struct snd_pcm *pcm)
 	if (!buf->area)
 		return;
 
-	iounmap(buf->area);
+	iounmap((void __iomem *)buf->area);
 
 	buf->area = NULL;
 	buf->addr = 0;
@@ -369,7 +369,7 @@  static int preallocate_idma_buffer(struct snd_pcm *pcm, int stream)
 	buf->dev.type = SNDRV_DMA_TYPE_CONTINUOUS;
 	buf->addr = idma.lp_tx_addr;
 	buf->bytes = idma_hardware.buffer_bytes_max;
-	buf->area = (unsigned char *)ioremap(buf->addr, buf->bytes);
+	buf->area = (unsigned char * __force)ioremap(buf->addr, buf->bytes);
 
 	return 0;
 }