vserver 1.9.5.x5
[linux-2.6.git] / drivers / media / video / w9966.c
index 4c0a5bf..c318ba3 100644 (file)
@@ -127,18 +127,18 @@ static const char* pardev[] = {[0 ... W9966_MAXCAMS] = ""};
 #else
 static const char* pardev[] = {[0 ... W9966_MAXCAMS] = "aggressive"};
 #endif
-MODULE_PARM(pardev, "1-" __MODULE_STRING(W9966_MAXCAMS) "s");
+module_param_array(pardev, charp, NULL, 0);
 MODULE_PARM_DESC(pardev, "pardev: where to search for\n\
 \teach camera. 'aggressive' means brute-force search.\n\
 \tEg: >pardev=parport3,aggressive,parport2,parport1< would assign\n\
 \tcam 1 to parport3 and search every parport for cam 2 etc...");
 
 static int parmode = 0;
-MODULE_PARM(parmode, "i");
+module_param(parmode, int, 0);
 MODULE_PARM_DESC(parmode, "parmode: transfer mode (0=auto, 1=ecp, 2=epp");
 
 static int video_nr = -1;
-MODULE_PARM(video_nr, "i");
+module_param(video_nr, int, 0);
 
 /*
  *     Private data
@@ -179,7 +179,7 @@ static int w9966_i2c_rbyte(struct w9966_dev* cam);
 
 static int w9966_v4l_ioctl(struct inode *inode, struct file *file,
                           unsigned int cmd, unsigned long arg);
-static ssize_t w9966_v4l_read(struct file *file, char *buf,
+static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
                              size_t count, loff_t *ppos);
 
 static struct file_operations w9966_fops = {
@@ -330,7 +330,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port)
 
 // Fill in the video_device struct and register us to v4l
        memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device));
-       cam->vdev.priv = (void*)cam;
+       cam->vdev.priv = cam;
 
        if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1)                 
                return -1;
@@ -555,6 +555,14 @@ static inline void w9966_i2c_setsda(struct w9966_dev* cam, int state)
        udelay(5);
 }
 
+// Get peripheral clock line
+// Expects a claimed pdev.
+static inline int w9966_i2c_getscl(struct w9966_dev* cam)
+{
+       const unsigned char state = w9966_rReg(cam, 0x18);
+       return ((state & W9966_I2C_R_CLOCK) > 0);
+}
+
 // Sets the clock line on the i2c bus.
 // Expects a claimed pdev. -1 on error
 static inline int w9966_i2c_setscl(struct w9966_dev* cam, int state)
@@ -588,14 +596,6 @@ static inline int w9966_i2c_getsda(struct w9966_dev* cam)
        return ((state & W9966_I2C_R_DATA) > 0);
 }
 
-// Get peripheral clock line
-// Expects a claimed pdev.
-static inline int w9966_i2c_getscl(struct w9966_dev* cam)
-{
-       const unsigned char state = w9966_rReg(cam, 0x18);
-       return ((state & W9966_I2C_R_CLOCK) > 0);
-}
-
 // Write a byte with ack to the i2c bus.
 // Expects a claimed pdev. -1 on error
 static int w9966_i2c_wbyte(struct w9966_dev* cam, int data)
@@ -712,7 +712,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
                              unsigned int cmd, void *arg)
 {
        struct video_device *vdev = video_devdata(file);
-       struct w9966_dev *cam = (struct w9966_dev*)vdev->priv;
+       struct w9966_dev *cam = vdev->priv;
        
        switch(cmd)
        {
@@ -867,13 +867,13 @@ static int w9966_v4l_ioctl(struct inode *inode, struct file *file,
 }
 
 // Capture data
-static ssize_t w9966_v4l_read(struct file *file, char *buf,
+static ssize_t w9966_v4l_read(struct file *file, char  __user *buf,
                              size_t count, loff_t *ppos)
 {
        struct video_device *vdev = video_devdata(file);
-       struct w9966_dev *cam = (struct w9966_dev *)vdev->priv;
+       struct w9966_dev *cam = vdev->priv;
        unsigned char addr = 0xa0;      // ECP, read, CCD-transfer, 00000
-       unsigned char* dest = (unsigned char*)buf;
+       unsigned char __user *dest = (unsigned char __user *)buf;
        unsigned long dleft = count;
        unsigned char *tbuf;