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 / video / saa5246a.c
index ba69f09..dd830e0 100644 (file)
@@ -46,6 +46,8 @@
 #include <linux/i2c.h>
 #include <linux/videotext.h>
 #include <linux/videodev.h>
+#include <linux/mutex.h>
+
 #include "saa5246a.h"
 
 MODULE_AUTHOR("Michael Geng <linux@MichaelGeng.de>");
@@ -57,14 +59,13 @@ struct saa5246a_device
        u8     pgbuf[NUM_DAUS][VTX_VIRTUALSIZE];
        int    is_searching[NUM_DAUS];
        struct i2c_client *client;
-       struct semaphore lock;
+       struct mutex lock;
 };
 
 static struct video_device saa_template;       /* Declared near bottom */
 
 /* Addresses to scan */
 static unsigned short normal_i2c[]      = { I2C_ADDRESS, I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 I2C_CLIENT_INSMOD;
 
 static struct i2c_client client_template;
@@ -84,15 +85,14 @@ static int saa5246a_attach(struct i2c_adapter *adap, int addr, int kind)
        client_template.adapter = adap;
        client_template.addr = addr;
        memcpy(client, &client_template, sizeof(*client));
-       t = kmalloc(sizeof(*t), GFP_KERNEL);
+       t = kzalloc(sizeof(*t), GFP_KERNEL);
        if(t==NULL)
        {
                kfree(client);
                return -ENOMEM;
        }
-       memset(t, 0, sizeof(*t));
        strlcpy(client->name, IF_NAME, I2C_NAME_SIZE);
-       init_MUTEX(&t->lock);
+       mutex_init(&t->lock);
 
        /*
         *      Now create a video4linux device
@@ -152,25 +152,18 @@ static int saa5246a_detach(struct i2c_client *client)
        return 0;
 }
 
-static int saa5246a_command(struct i2c_client *device, unsigned int cmd,
-       void *arg)
-{
-       return -EINVAL;
-}
-
 /*
  *     I2C interfaces
  */
 
 static struct i2c_driver i2c_driver_videotext =
 {
-       .owner          = THIS_MODULE,
-       .name           = IF_NAME,              /* name */
+       .driver = {
+               .name   = IF_NAME,              /* name */
+       },
        .id             = I2C_DRIVERID_SAA5249, /* in i2c.h */
-       .flags          = I2C_DF_NOTIFY,
        .attach_adapter = saa5246a_probe,
        .detach_client  = saa5246a_detach,
-       .command        = saa5246a_command
 };
 
 static struct i2c_client client_template = {
@@ -728,9 +721,9 @@ static int saa5246a_ioctl(struct inode *inode, struct file *file,
        int err;
 
        cmd = vtx_fix_command(cmd);
-       down(&t->lock);
+       mutex_lock(&t->lock);
        err = video_usercopy(inode, file, cmd, arg, do_saa5246a_ioctl);
-       up(&t->lock);
+       mutex_unlock(&t->lock);
        return err;
 }