Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / media / radio / radio-cadet.c
index fd3f100..f1b5ac8 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <linux/module.h>      /* Modules                      */
 #include <linux/init.h>                /* Initdata                     */
-#include <linux/ioport.h>      /* check_region, request_region */
+#include <linux/ioport.h>      /* request_region               */
 #include <linux/delay.h>       /* udelay                       */
 #include <asm/io.h>            /* outb, outb_p                 */
 #include <asm/uaccess.h>       /* copy to/from user            */
@@ -45,8 +45,8 @@ static int users=0;
 static int curtuner=0;
 static int tunestat=0;
 static int sigstrength=0;
-static wait_queue_head_t readq;
-struct timer_list tunertimer,rdstimer,readtimer;
+static wait_queue_head_t read_queue;
+static struct timer_list readtimer;
 static __u8 rdsin=0,rdsout=0,rdsstat=0;
 static unsigned char rdsbuf[RDS_BUFFER];
 static spinlock_t cadet_io_lock;
@@ -69,8 +69,7 @@ static int cadet_getrds(void)
        outb(inb(io+1)&0x7f,io+1);  /* Reset RDS detection */
        spin_unlock(&cadet_io_lock);
        
-       set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout(HZ/10);
+       msleep(100);
 
        spin_lock(&cadet_io_lock);      
         outb(3,io);                 /* Select Decoder Control/Status */
@@ -243,8 +242,7 @@ static void cadet_setfreq(unsigned freq)
                outb(curvol,io+1);
                spin_unlock(&cadet_io_lock);
                
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(HZ/10);
+               msleep(100);
 
                cadet_gettune();
                if((tunestat & 0x40) == 0) {   /* Tuned */
@@ -282,7 +280,7 @@ static void cadet_setvol(int vol)
        spin_unlock(&cadet_io_lock);
 }  
 
-void cadet_handler(unsigned long data)
+static void cadet_handler(unsigned long data)
 {
        /*
         * Service the RDS fifo
@@ -309,7 +307,7 @@ void cadet_handler(unsigned long data)
         * Service pending read
         */
        if( rdsin!=rdsout)
-               wake_up_interruptible(&readq);
+               wake_up_interruptible(&read_queue);
 
        /* 
         * Clean up and exit
@@ -323,7 +321,7 @@ void cadet_handler(unsigned long data)
 
 
 
-static ssize_t cadet_read(struct file *file, char *data,
+static ssize_t cadet_read(struct file *file, char __user *data,
                          size_t count, loff_t *ppos)
 {
         int i=0;
@@ -343,7 +341,7 @@ static ssize_t cadet_read(struct file *file, char *data,
        if(rdsin==rdsout) {
                if (file->f_flags & O_NONBLOCK)
                        return -EWOULDBLOCK;
-               interruptible_sleep_on(&readq);
+               interruptible_sleep_on(&read_queue);
        }               
        while( i<count && rdsin!=rdsout)
                readbuf[i++]=rdsbuf[rdsout++];
@@ -473,7 +471,7 @@ static int cadet_open(struct inode *inode, struct file *file)
        if(users)
                return -EBUSY;
        users++;
-       init_waitqueue_head(&readq);
+       init_waitqueue_head(&read_queue);
        return 0;
 }
 
@@ -492,6 +490,7 @@ static struct file_operations cadet_fops = {
        .release        = cadet_release,
        .read           = cadet_read,
        .ioctl          = cadet_ioctl,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .llseek         = no_llseek,
 };
 
@@ -545,7 +544,7 @@ static int cadet_probe(void)
 
        for(i=0;i<8;i++) {
                io=iovals[i];
-               if(request_region(io,2, "cadet-probe")>=0) {
+               if (request_region(io, 2, "cadet-probe")) {
                        cadet_setfreq(1410);
                        if(cadet_getfreq()==1410) {
                                release_region(io, 2);
@@ -606,9 +605,9 @@ MODULE_AUTHOR("Fred Gleason, Russell Kroll, Quay Lu, Donald Song, Jason Lewis, S
 MODULE_DESCRIPTION("A driver for the ADS Cadet AM/FM/RDS radio card.");
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(io, "i");
+module_param(io, int, 0);
 MODULE_PARM_DESC(io, "I/O address of Cadet card (0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e)");
-MODULE_PARM(radio_nr, "i");
+module_param(radio_nr, int, 0);
 
 static void __exit cadet_cleanup_module(void)
 {