fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / sound / oss / dmasound / dmasound_atari.c
index da68171..285239d 100644 (file)
@@ -1,9 +1,9 @@
 /*
- *  linux/drivers/sound/dmasound/dmasound_atari.c
+ *  linux/sound/oss/dmasound/dmasound_atari.c
  *
  *  Atari TT and Falcon DMA Sound Driver
  *
- *  See linux/drivers/sound/dmasound/dmasound_core.c for copyright and credits
+ *  See linux/sound/oss/dmasound/dmasound_core.c for copyright and credits
  *  prior to 28/01/2001
  *
  *  28/01/2001 [0.1] Iain Sandoe
@@ -22,7 +22,6 @@
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
 
-#include <asm/pgalloc.h>
 #include <asm/uaccess.h>
 #include <asm/atariints.h>
 #include <asm/atari_stram.h>
@@ -68,46 +67,46 @@ static int expand_data;     /* Data for expanding */
  * ++geert: split in even more functions (one per format)
  */
 
-static ssize_t ata_ct_law(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_law(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft);
-static ssize_t ata_ct_s8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s8(const u_char __user *userPtr, size_t userCount,
                         u_char frame[], ssize_t *frameUsed,
                         ssize_t frameLeft);
-static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u8(const u_char __user *userPtr, size_t userCount,
                         u_char frame[], ssize_t *frameUsed,
                         ssize_t frameLeft);
-static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s16be(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft);
-static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u16be(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft);
-static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s16le(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft);
-static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u16le(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft);
-static ssize_t ata_ctx_law(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_law(const u_char __user *userPtr, size_t userCount,
                           u_char frame[], ssize_t *frameUsed,
                           ssize_t frameLeft);
-static ssize_t ata_ctx_s8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s8(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft);
-static ssize_t ata_ctx_u8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u8(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft);
-static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s16be(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft);
-static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u16be(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft);
-static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s16le(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft);
-static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u16le(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft);
 
@@ -115,7 +114,7 @@ static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
 /*** Low level stuff *********************************************************/
 
 
-static void *AtaAlloc(unsigned int size, int flags);
+static void *AtaAlloc(unsigned int size, gfp_t flags);
 static void AtaFree(void *, unsigned int size);
 static int AtaIrqInit(void);
 #ifdef MODULE
@@ -134,7 +133,7 @@ static int FalconSetFormat(int format);
 static int FalconSetVolume(int volume);
 static void AtaPlayNextFrame(int index);
 static void AtaPlay(void);
-static irqreturn_t AtaInterrupt(int irq, void *dummy, struct pt_regs *fp);
+static irqreturn_t AtaInterrupt(int irq, void *dummy);
 
 /*** Mid level stuff *********************************************************/
 
@@ -152,7 +151,7 @@ static int FalconStateInfo(char *buffer, size_t space);
 /*** Translations ************************************************************/
 
 
-static ssize_t ata_ct_law(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_law(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft)
 {
@@ -177,7 +176,7 @@ static ssize_t ata_ct_law(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_s8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s8(const u_char __user *userPtr, size_t userCount,
                         u_char frame[], ssize_t *frameUsed,
                         ssize_t frameLeft)
 {
@@ -195,7 +194,7 @@ static ssize_t ata_ct_s8(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u8(const u_char __user *userPtr, size_t userCount,
                         u_char frame[], ssize_t *frameUsed,
                         ssize_t frameLeft)
 {
@@ -218,8 +217,9 @@ static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
                used = count*2;
                while (count > 0) {
                        u_short data;
-                       if (get_user(data, ((u_short *)userPtr)++))
+                       if (get_user(data, (u_short __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 2;
                        *p++ = data ^ 0x8080;
                        count--;
                }
@@ -229,7 +229,7 @@ static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s16be(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft)
 {
@@ -241,8 +241,9 @@ static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
                used = count*2;
                while (count > 0) {
                        u_short data;
-                       if (get_user(data, ((u_short *)userPtr)++))
+                       if (get_user(data, (u_short __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 2;
                        *p++ = data;
                        *p++ = data;
                        count--;
@@ -260,7 +261,7 @@ static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u16be(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft)
 {
@@ -272,8 +273,9 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
                used = count*2;
                while (count > 0) {
                        u_short data;
-                       if (get_user(data, ((u_short *)userPtr)++))
+                       if (get_user(data, (u_short __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 2;
                        data ^= 0x8000;
                        *p++ = data;
                        *p++ = data;
@@ -285,9 +287,10 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
                count = min_t(unsigned long, userCount, frameLeft)>>2;
                used = count*4;
                while (count > 0) {
-                       u_long data;
-                       if (get_user(data, ((u_int *)userPtr)++))
+                       u_int data;
+                       if (get_user(data, (u_int __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 4;
                        *p++ = data ^ 0x80008000;
                        count--;
                }
@@ -297,7 +300,7 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s16le(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft)
 {
@@ -310,8 +313,9 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
                used = count*2;
                while (count > 0) {
                        u_short data;
-                       if (get_user(data, ((u_short *)userPtr)++))
+                       if (get_user(data, (u_short __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 2;
                        data = le2be16(data);
                        *p++ = data;
                        *p++ = data;
@@ -324,8 +328,9 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
                used = count*4;
                while (count > 0) {
                        u_long data;
-                       if (get_user(data, ((u_int *)userPtr)++))
+                       if (get_user(data, (u_int __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 4;
                        data = le2be16dbl(data);
                        *p++ = data;
                        count--;
@@ -336,7 +341,7 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u16le(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft)
 {
@@ -349,8 +354,9 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
                used = count*2;
                while (count > 0) {
                        u_short data;
-                       if (get_user(data, ((u_short *)userPtr)++))
+                       if (get_user(data, (u_short __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 2;
                        data = le2be16(data) ^ 0x8000;
                        *p++ = data;
                        *p++ = data;
@@ -362,8 +368,9 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
                used = count;
                while (count > 0) {
                        u_long data;
-                       if (get_user(data, ((u_int *)userPtr)++))
+                       if (get_user(data, (u_int __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 4;
                        data = le2be16dbl(data) ^ 0x80008000;
                        *p++ = data;
                        count--;
@@ -374,7 +381,7 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_law(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_law(const u_char __user *userPtr, size_t userCount,
                           u_char frame[], ssize_t *frameUsed,
                           ssize_t frameLeft)
 {
@@ -436,7 +443,7 @@ static ssize_t ata_ctx_law(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_s8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s8(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft)
 {
@@ -471,8 +478,9 @@ static ssize_t ata_ctx_s8(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                userCount -= 2;
                                bal += hSpeed;
                        }
@@ -489,7 +497,7 @@ static ssize_t ata_ctx_s8(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_u8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u8(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft)
 {
@@ -525,8 +533,9 @@ static ssize_t ata_ctx_u8(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                data ^= 0x8080;
                                userCount -= 2;
                                bal += hSpeed;
@@ -544,7 +553,7 @@ static ssize_t ata_ctx_u8(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s16be(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft)
 {
@@ -562,8 +571,9 @@ static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                userCount -= 2;
                                bal += hSpeed;
                        }
@@ -580,8 +590,9 @@ static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 4)
                                        break;
-                               if (get_user(data, ((u_int *)userPtr)++))
+                               if (get_user(data, (u_int __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 4;
                                userCount -= 4;
                                bal += hSpeed;
                        }
@@ -598,7 +609,7 @@ static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u16be(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft)
 {
@@ -616,8 +627,9 @@ static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                data ^= 0x8000;
                                userCount -= 2;
                                bal += hSpeed;
@@ -635,8 +647,9 @@ static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 4)
                                        break;
-                               if (get_user(data, ((u_int *)userPtr)++))
+                               if (get_user(data, (u_int __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 4;
                                data ^= 0x80008000;
                                userCount -= 4;
                                bal += hSpeed;
@@ -654,7 +667,7 @@ static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s16le(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft)
 {
@@ -672,8 +685,9 @@ static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                data = le2be16(data);
                                userCount -= 2;
                                bal += hSpeed;
@@ -691,8 +705,9 @@ static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 4)
                                        break;
-                               if (get_user(data, ((u_int *)userPtr)++))
+                               if (get_user(data, (u_int __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 4;
                                data = le2be16dbl(data);
                                userCount -= 4;
                                bal += hSpeed;
@@ -710,7 +725,7 @@ static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u16le(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft)
 {
@@ -728,8 +743,9 @@ static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                data = le2be16(data) ^ 0x8000;
                                userCount -= 2;
                                bal += hSpeed;
@@ -747,8 +763,9 @@ static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 4)
                                        break;
-                               if (get_user(data, ((u_int *)userPtr)++))
+                               if (get_user(data, (u_int __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 4;
                                data = le2be16dbl(data) ^ 0x80008000;
                                userCount -= 4;
                                bal += hSpeed;
@@ -811,7 +828,7 @@ static TRANS transFalconExpanding = {
  * Atari (TT/Falcon)
  */
 
-static void *AtaAlloc(unsigned int size, int flags)
+static void *AtaAlloc(unsigned int size, gfp_t flags)
 {
        return atari_stram_alloc(size, "dmasound");
 }
@@ -1240,7 +1257,7 @@ static void AtaPlay(void)
 }
 
 
-static irqreturn_t AtaInterrupt(int irq, void *dummy, struct pt_regs *fp)
+static irqreturn_t AtaInterrupt(int irq, void *dummy)
 {
 #if 0
        /* ++TeSche: if you should want to test this... */