#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
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 = {
// 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;
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)
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)
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)
{
}
// 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;