aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-09-05 04:35:20 -0400
committerJaroslav Kysela <perex@suse.cz>2005-09-12 04:41:16 -0400
commit4d23359b7ec8b03da2154df935af7d625075f6cf (patch)
treeba0ddfae17312fb449fb4c1f1a294c4f7db0f998 /sound
parent49045d3d4dc7c43310b1fca693e29fcdbe68faba (diff)
[ALSA] sparse address space annotations
ALSA Core,RawMidi Midlevel,ALSA<-OSS emulation,ALSA sequencer RME32 driver,RME96 driver,EMU10K1/EMU10K2 driver,NM256 driver Add sparse annotations where we do strange this with __iomem/__user pointers. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/memory.c4
-rw-r--r--sound/core/oss/pcm_oss.c7
-rw-r--r--sound/core/rawmidi.c8
-rw-r--r--sound/core/seq/seq_clientmgr.c7
-rw-r--r--sound/pci/emu10k1/emufx.c12
-rw-r--r--sound/pci/nm256/nm256.c2
-rw-r--r--sound/pci/rme32.c6
-rw-r--r--sound/pci/rme96.c6
8 files changed, 33 insertions, 19 deletions
diff --git a/sound/core/memory.c b/sound/core/memory.c
index 291b4769bde3..8fa888fc53a0 100644
--- a/sound/core/memory.c
+++ b/sound/core/memory.c
@@ -249,7 +249,7 @@ int __exit snd_memory_info_done(void)
249int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count) 249int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count)
250{ 250{
251#if defined(__i386__) || defined(CONFIG_SPARC32) 251#if defined(__i386__) || defined(CONFIG_SPARC32)
252 return copy_to_user(dst, (const void*)src, count) ? -EFAULT : 0; 252 return copy_to_user(dst, (const void __force*)src, count) ? -EFAULT : 0;
253#else 253#else
254 char buf[256]; 254 char buf[256];
255 while (count) { 255 while (count) {
@@ -280,7 +280,7 @@ int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size
280int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count) 280int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count)
281{ 281{
282#if defined(__i386__) || defined(CONFIG_SPARC32) 282#if defined(__i386__) || defined(CONFIG_SPARC32)
283 return copy_from_user((void*)dst, src, count) ? -EFAULT : 0; 283 return copy_from_user((void __force *)dst, src, count) ? -EFAULT : 0;
284#else 284#else
285 char buf[256]; 285 char buf[256];
286 while (count) { 286 while (count) {
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index a13bd7bb4c9f..1e606399d74a 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -850,7 +850,9 @@ static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char __u
850 return xfer > 0 ? xfer : -EAGAIN; 850 return xfer > 0 ? xfer : -EAGAIN;
851 } 851 }
852 } else { 852 } else {
853 tmp = snd_pcm_oss_write2(substream, (const char *)buf, runtime->oss.period_bytes, 0); 853 tmp = snd_pcm_oss_write2(substream,
854 (const char __force *)buf,
855 runtime->oss.period_bytes, 0);
854 if (tmp <= 0) 856 if (tmp <= 0)
855 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; 857 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
856 runtime->oss.bytes += tmp; 858 runtime->oss.bytes += tmp;
@@ -926,7 +928,8 @@ static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *bu
926 xfer += tmp; 928 xfer += tmp;
927 runtime->oss.buffer_used -= tmp; 929 runtime->oss.buffer_used -= tmp;
928 } else { 930 } else {
929 tmp = snd_pcm_oss_read2(substream, (char *)buf, runtime->oss.period_bytes, 0); 931 tmp = snd_pcm_oss_read2(substream, (char __force *)buf,
932 runtime->oss.period_bytes, 0);
930 if (tmp <= 0) 933 if (tmp <= 0)
931 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; 934 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
932 runtime->oss.bytes += tmp; 935 runtime->oss.bytes += tmp;
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index edba4118271c..d705ec79429b 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -984,7 +984,9 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun
984 spin_lock_irq(&runtime->lock); 984 spin_lock_irq(&runtime->lock);
985 } 985 }
986 spin_unlock_irq(&runtime->lock); 986 spin_unlock_irq(&runtime->lock);
987 count1 = snd_rawmidi_kernel_read1(substream, (unsigned char *)buf, count, 0); 987 count1 = snd_rawmidi_kernel_read1(substream,
988 (unsigned char __force *)buf,
989 count, 0);
988 if (count1 < 0) 990 if (count1 < 0)
989 return result > 0 ? result : count1; 991 return result > 0 ? result : count1;
990 result += count1; 992 result += count1;
@@ -1213,7 +1215,9 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size
1213 spin_lock_irq(&runtime->lock); 1215 spin_lock_irq(&runtime->lock);
1214 } 1216 }
1215 spin_unlock_irq(&runtime->lock); 1217 spin_unlock_irq(&runtime->lock);
1216 count1 = snd_rawmidi_kernel_write1(substream, (unsigned char *)buf, count, 0); 1218 count1 = snd_rawmidi_kernel_write1(substream,
1219 (unsigned char __force *)buf,
1220 count, 0);
1217 if (count1 < 0) 1221 if (count1 < 0)
1218 return result > 0 ? result : count1; 1222 return result > 0 ? result : count1;
1219 result += count1; 1223 result += count1;
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index d8f76afd284b..bd106625a783 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -413,7 +413,9 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l
413 } 413 }
414 count -= sizeof(snd_seq_event_t); 414 count -= sizeof(snd_seq_event_t);
415 buf += sizeof(snd_seq_event_t); 415 buf += sizeof(snd_seq_event_t);
416 err = snd_seq_expand_var_event(&cell->event, count, (char *)buf, 0, sizeof(snd_seq_event_t)); 416 err = snd_seq_expand_var_event(&cell->event, count,
417 (char __force *)buf, 0,
418 sizeof(snd_seq_event_t));
417 if (err < 0) 419 if (err < 0)
418 break; 420 break;
419 result += err; 421 result += err;
@@ -1009,7 +1011,8 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
1009 } 1011 }
1010 /* set user space pointer */ 1012 /* set user space pointer */
1011 event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR; 1013 event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR;
1012 event.data.ext.ptr = (char*)buf + sizeof(snd_seq_event_t); 1014 event.data.ext.ptr = (char __force *)buf
1015 + sizeof(snd_seq_event_t);
1013 len += extlen; /* increment data length */ 1016 len += extlen; /* increment data length */
1014 } else { 1017 } else {
1015#ifdef CONFIG_COMPAT 1018#ifdef CONFIG_COMPAT
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 637c555cfdb1..2f7a03103c91 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -470,7 +470,7 @@ static void snd_emu10k1_write_op(emu10k1_fx8010_code_t *icode, unsigned int *ptr
470{ 470{
471 u_int32_t *code; 471 u_int32_t *code;
472 snd_assert(*ptr < 512, return); 472 snd_assert(*ptr < 512, return);
473 code = (u_int32_t *)icode->code + (*ptr) * 2; 473 code = (u_int32_t __force *)icode->code + (*ptr) * 2;
474 set_bit(*ptr, icode->code_valid); 474 set_bit(*ptr, icode->code_valid);
475 code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff); 475 code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff);
476 code[1] = ((op & 0x0f) << 20) | ((r & 0x3ff) << 10) | (a & 0x3ff); 476 code[1] = ((op & 0x0f) << 20) | ((r & 0x3ff) << 10) | (a & 0x3ff);
@@ -485,7 +485,7 @@ static void snd_emu10k1_audigy_write_op(emu10k1_fx8010_code_t *icode, unsigned i
485{ 485{
486 u_int32_t *code; 486 u_int32_t *code;
487 snd_assert(*ptr < 1024, return); 487 snd_assert(*ptr < 1024, return);
488 code = (u_int32_t *)icode->code + (*ptr) * 2; 488 code = (u_int32_t __force *)icode->code + (*ptr) * 2;
489 set_bit(*ptr, icode->code_valid); 489 set_bit(*ptr, icode->code_valid);
490 code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff); 490 code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff);
491 code[1] = ((op & 0x0f) << 24) | ((r & 0x7ff) << 12) | (a & 0x7ff); 491 code[1] = ((op & 0x0f) << 24) | ((r & 0x7ff) << 12) | (a & 0x7ff);
@@ -1042,7 +1042,7 @@ static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu)
1042 err = -ENOMEM; 1042 err = -ENOMEM;
1043 goto __err; 1043 goto __err;
1044 } 1044 }
1045 gpr_map = (u32 *)icode->gpr_map; 1045 gpr_map = (u32 __force *)icode->gpr_map;
1046 1046
1047 icode->tram_data_map = icode->gpr_map + 512; 1047 icode->tram_data_map = icode->gpr_map + 512;
1048 icode->tram_addr_map = icode->tram_data_map + 256; 1048 icode->tram_addr_map = icode->tram_data_map + 256;
@@ -1431,7 +1431,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1431 __err: 1431 __err:
1432 kfree(controls); 1432 kfree(controls);
1433 if (icode != NULL) { 1433 if (icode != NULL) {
1434 kfree((void *)icode->gpr_map); 1434 kfree((void __force *)icode->gpr_map);
1435 kfree(icode); 1435 kfree(icode);
1436 } 1436 }
1437 return err; 1437 return err;
@@ -1511,7 +1511,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
1511 err = -ENOMEM; 1511 err = -ENOMEM;
1512 goto __err; 1512 goto __err;
1513 } 1513 }
1514 gpr_map = (u32 *)icode->gpr_map; 1514 gpr_map = (u32 __force *)icode->gpr_map;
1515 1515
1516 icode->tram_data_map = icode->gpr_map + 256; 1516 icode->tram_data_map = icode->gpr_map + 256;
1517 icode->tram_addr_map = icode->tram_data_map + 160; 1517 icode->tram_addr_map = icode->tram_data_map + 160;
@@ -2032,7 +2032,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
2032 kfree(ipcm); 2032 kfree(ipcm);
2033 kfree(controls); 2033 kfree(controls);
2034 if (icode != NULL) { 2034 if (icode != NULL) {
2035 kfree((void *)icode->gpr_map); 2035 kfree((void __force *)icode->gpr_map);
2036 kfree(icode); 2036 kfree(icode);
2037 } 2037 }
2038 return err; 2038 return err;
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 2bbeb10ff7c4..24f146b6ebab 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -840,7 +840,7 @@ static void snd_nm256_setup_stream(nm256_t *chip, nm256_stream_t *s,
840 runtime->hw = *hw_ptr; 840 runtime->hw = *hw_ptr;
841 runtime->hw.buffer_bytes_max = s->bufsize; 841 runtime->hw.buffer_bytes_max = s->bufsize;
842 runtime->hw.period_bytes_max = s->bufsize / 2; 842 runtime->hw.period_bytes_max = s->bufsize / 2;
843 runtime->dma_area = (void*) s->bufptr; 843 runtime->dma_area = (void __force *) s->bufptr;
844 runtime->dma_addr = s->bufptr_addr; 844 runtime->dma_addr = s->bufptr_addr;
845 runtime->dma_bytes = s->bufsize; 845 runtime->dma_bytes = s->bufsize;
846 runtime->private_data = s; 846 runtime->private_data = s;
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 456be39e8e4a..cfb5f44b2d43 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -692,7 +692,8 @@ snd_rme32_playback_hw_params(snd_pcm_substream_t * substream,
692 if (err < 0) 692 if (err < 0)
693 return err; 693 return err;
694 } else { 694 } else {
695 runtime->dma_area = (void *)(rme32->iobase + RME32_IO_DATA_BUFFER); 695 runtime->dma_area = (void __force *)(rme32->iobase +
696 RME32_IO_DATA_BUFFER);
696 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER; 697 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER;
697 runtime->dma_bytes = RME32_BUFFER_SIZE; 698 runtime->dma_bytes = RME32_BUFFER_SIZE;
698 } 699 }
@@ -746,7 +747,8 @@ snd_rme32_capture_hw_params(snd_pcm_substream_t * substream,
746 if (err < 0) 747 if (err < 0)
747 return err; 748 return err;
748 } else { 749 } else {
749 runtime->dma_area = (void *)rme32->iobase + RME32_IO_DATA_BUFFER; 750 runtime->dma_area = (void __force *)rme32->iobase +
751 RME32_IO_DATA_BUFFER;
750 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER; 752 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER;
751 runtime->dma_bytes = RME32_BUFFER_SIZE; 753 runtime->dma_bytes = RME32_BUFFER_SIZE;
752 } 754 }
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 9645e9004a48..2da33138fa4b 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -985,7 +985,8 @@ snd_rme96_playback_hw_params(snd_pcm_substream_t *substream,
985 snd_pcm_runtime_t *runtime = substream->runtime; 985 snd_pcm_runtime_t *runtime = substream->runtime;
986 int err, rate, dummy; 986 int err, rate, dummy;
987 987
988 runtime->dma_area = (void *)(rme96->iobase + RME96_IO_PLAY_BUFFER); 988 runtime->dma_area = (void __force *)(rme96->iobase +
989 RME96_IO_PLAY_BUFFER);
989 runtime->dma_addr = rme96->port + RME96_IO_PLAY_BUFFER; 990 runtime->dma_addr = rme96->port + RME96_IO_PLAY_BUFFER;
990 runtime->dma_bytes = RME96_BUFFER_SIZE; 991 runtime->dma_bytes = RME96_BUFFER_SIZE;
991 992
@@ -1037,7 +1038,8 @@ snd_rme96_capture_hw_params(snd_pcm_substream_t *substream,
1037 snd_pcm_runtime_t *runtime = substream->runtime; 1038 snd_pcm_runtime_t *runtime = substream->runtime;
1038 int err, isadat, rate; 1039 int err, isadat, rate;
1039 1040
1040 runtime->dma_area = (void *)(rme96->iobase + RME96_IO_REC_BUFFER); 1041 runtime->dma_area = (void __force *)(rme96->iobase +
1042 RME96_IO_REC_BUFFER);
1041 runtime->dma_addr = rme96->port + RME96_IO_REC_BUFFER; 1043 runtime->dma_addr = rme96->port + RME96_IO_REC_BUFFER;
1042 runtime->dma_bytes = RME96_BUFFER_SIZE; 1044 runtime->dma_bytes = RME96_BUFFER_SIZE;
1043 1045