Commit 1d61aac0 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB: bw-qcam: coding style cleanup

Clean up the coding style before we convert this driver to V4L2.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 51224aa4
...@@ -80,8 +80,8 @@ OTHER DEALINGS IN THE SOFTWARE. ...@@ -80,8 +80,8 @@ OTHER DEALINGS IN THE SOFTWARE.
#include "bw-qcam.h" #include "bw-qcam.h"
static unsigned int maxpoll=250; /* Maximum busy-loop count for qcam I/O */ static unsigned int maxpoll = 250; /* Maximum busy-loop count for qcam I/O */
static unsigned int yieldlines=4; /* Yield after this many during capture */ static unsigned int yieldlines = 4; /* Yield after this many during capture */
static int video_nr = -1; static int video_nr = -1;
static unsigned int force_init; /* Whether to probe aggressively */ static unsigned int force_init; /* Whether to probe aggressively */
...@@ -156,7 +156,7 @@ static int qc_calibrate(struct qcam_device *q) ...@@ -156,7 +156,7 @@ static int qc_calibrate(struct qcam_device *q)
mdelay(1); mdelay(1);
schedule(); schedule();
count++; count++;
} while (value == 0xff && count<2048); } while (value == 0xff && count < 2048);
q->whitebal = value; q->whitebal = value;
return value; return value;
...@@ -170,14 +170,13 @@ static struct qcam_device *qcam_init(struct parport *port) ...@@ -170,14 +170,13 @@ static struct qcam_device *qcam_init(struct parport *port)
struct qcam_device *q; struct qcam_device *q;
q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL);
if(q==NULL) if (q == NULL)
return NULL; return NULL;
q->pport = port; q->pport = port;
q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL, q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL,
NULL, 0, NULL); NULL, 0, NULL);
if (q->pdev == NULL) if (q->pdev == NULL) {
{
printk(KERN_ERR "bw-qcam: couldn't register for %s.\n", printk(KERN_ERR "bw-qcam: couldn't register for %s.\n",
port->name); port->name);
kfree(q); kfree(q);
...@@ -247,12 +246,10 @@ static int qc_readparam(struct qcam_device *q) ...@@ -247,12 +246,10 @@ static int qc_readparam(struct qcam_device *q)
static int qc_waithand(struct qcam_device *q, int val) static int qc_waithand(struct qcam_device *q, int val)
{ {
int status; int status;
int runs=0; int runs = 0;
if (val) if (val) {
{ while (!((status = read_lpstatus(q)) & 8)) {
while (!((status = read_lpstatus(q)) & 8))
{
/* 1000 is enough spins on the I/O for all normal /* 1000 is enough spins on the I/O for all normal
cases, at that point we start to poll slowly cases, at that point we start to poll slowly
until the camera wakes up. However, we are until the camera wakes up. However, we are
...@@ -260,18 +257,13 @@ static int qc_waithand(struct qcam_device *q, int val) ...@@ -260,18 +257,13 @@ static int qc_waithand(struct qcam_device *q, int val)
setting it lower is much better for interactive setting it lower is much better for interactive
response. */ response. */
if(runs++>maxpoll) if (runs++ > maxpoll)
{
msleep_interruptible(5); msleep_interruptible(5);
} if (runs > (maxpoll + 1000)) /* 5 seconds */
if(runs>(maxpoll+1000)) /* 5 seconds */
return -1; return -1;
} }
} } else {
else while (((status = read_lpstatus(q)) & 8)) {
{
while (((status = read_lpstatus(q)) & 8))
{
/* 1000 is enough spins on the I/O for all normal /* 1000 is enough spins on the I/O for all normal
cases, at that point we start to poll slowly cases, at that point we start to poll slowly
until the camera wakes up. However, we are until the camera wakes up. However, we are
...@@ -279,11 +271,9 @@ static int qc_waithand(struct qcam_device *q, int val) ...@@ -279,11 +271,9 @@ static int qc_waithand(struct qcam_device *q, int val)
setting it lower is much better for interactive setting it lower is much better for interactive
response. */ response. */
if(runs++>maxpoll) if (runs++ > maxpoll)
{
msleep_interruptible(5); msleep_interruptible(5);
} if (runs++ > (maxpoll + 1000)) /* 5 seconds */
if(runs++>(maxpoll+1000)) /* 5 seconds */
return -1; return -1;
} }
} }
...@@ -299,10 +289,9 @@ static int qc_waithand(struct qcam_device *q, int val) ...@@ -299,10 +289,9 @@ static int qc_waithand(struct qcam_device *q, int val)
static unsigned int qc_waithand2(struct qcam_device *q, int val) static unsigned int qc_waithand2(struct qcam_device *q, int val)
{ {
unsigned int status; unsigned int status;
int runs=0; int runs = 0;
do do {
{
status = read_lpdata(q); status = read_lpdata(q);
/* 1000 is enough spins on the I/O for all normal /* 1000 is enough spins on the I/O for all normal
cases, at that point we start to poll slowly cases, at that point we start to poll slowly
...@@ -311,14 +300,11 @@ static unsigned int qc_waithand2(struct qcam_device *q, int val) ...@@ -311,14 +300,11 @@ static unsigned int qc_waithand2(struct qcam_device *q, int val)
setting it lower is much better for interactive setting it lower is much better for interactive
response. */ response. */
if(runs++>maxpoll) if (runs++ > maxpoll)
{
msleep_interruptible(5); msleep_interruptible(5);
} if (runs++ > (maxpoll + 1000)) /* 5 seconds */
if(runs++>(maxpoll+1000)) /* 5 seconds */
return 0; return 0;
} } while ((status & 1) != val);
while ((status & 1) != val);
return status; return status;
} }
...@@ -342,8 +328,7 @@ static int qc_detect(struct qcam_device *q) ...@@ -342,8 +328,7 @@ static int qc_detect(struct qcam_device *q)
lastreg = reg = read_lpstatus(q) & 0xf0; lastreg = reg = read_lpstatus(q) & 0xf0;
for (i = 0; i < 500; i++) for (i = 0; i < 500; i++) {
{
reg = read_lpstatus(q) & 0xf0; reg = read_lpstatus(q) & 0xf0;
if (reg != lastreg) if (reg != lastreg)
count++; count++;
...@@ -357,7 +342,7 @@ static int qc_detect(struct qcam_device *q) ...@@ -357,7 +342,7 @@ static int qc_detect(struct qcam_device *q)
won't be flashing these bits. Possibly unloading the module won't be flashing these bits. Possibly unloading the module
in the middle of a grab? Or some timeout condition? in the middle of a grab? Or some timeout condition?
I've seen this parameter as low as 19 on my 450Mhz box - mpc */ I've seen this parameter as low as 19 on my 450Mhz box - mpc */
printk("Debugging: QCam detection counter <30-200 counts as detected>: %d\n", count); printk(KERN_DEBUG "Debugging: QCam detection counter <30-200 counts as detected>: %d\n", count);
return 1; return 1;
#endif #endif
...@@ -381,8 +366,7 @@ static int qc_detect(struct qcam_device *q) ...@@ -381,8 +366,7 @@ static int qc_detect(struct qcam_device *q)
static void qc_reset(struct qcam_device *q) static void qc_reset(struct qcam_device *q)
{ {
switch (q->port_mode & QC_FORCE_MASK) switch (q->port_mode & QC_FORCE_MASK) {
{
case QC_FORCE_UNIDIR: case QC_FORCE_UNIDIR:
q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR;
break; break;
...@@ -395,11 +379,10 @@ static void qc_reset(struct qcam_device *q) ...@@ -395,11 +379,10 @@ static void qc_reset(struct qcam_device *q)
write_lpcontrol(q, 0x20); write_lpcontrol(q, 0x20);
write_lpdata(q, 0x75); write_lpdata(q, 0x75);
if (read_lpdata(q) != 0x75) { if (read_lpdata(q) != 0x75)
q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR;
} else { else
q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR;
}
break; break;
} }
...@@ -423,8 +406,7 @@ static int qc_setscanmode(struct qcam_device *q) ...@@ -423,8 +406,7 @@ static int qc_setscanmode(struct qcam_device *q)
{ {
int old_mode = q->mode; int old_mode = q->mode;
switch (q->transfer_scale) switch (q->transfer_scale) {
{
case 1: case 1:
q->mode = 0; q->mode = 0;
break; break;
...@@ -436,8 +418,7 @@ static int qc_setscanmode(struct qcam_device *q) ...@@ -436,8 +418,7 @@ static int qc_setscanmode(struct qcam_device *q)
break; break;
} }
switch (q->bpp) switch (q->bpp) {
{
case 4: case 4:
break; break;
case 6: case 6:
...@@ -445,8 +426,7 @@ static int qc_setscanmode(struct qcam_device *q) ...@@ -445,8 +426,7 @@ static int qc_setscanmode(struct qcam_device *q)
break; break;
} }
switch (q->port_mode & QC_MODE_MASK) switch (q->port_mode & QC_MODE_MASK) {
{
case QC_BIDIR: case QC_BIDIR:
q->mode += 1; q->mode += 1;
break; break;
...@@ -521,19 +501,17 @@ static void qc_set(struct qcam_device *q) ...@@ -521,19 +501,17 @@ static void qc_set(struct qcam_device *q)
static inline int qc_readbytes(struct qcam_device *q, char buffer[]) static inline int qc_readbytes(struct qcam_device *q, char buffer[])
{ {
int ret=1; int ret = 1;
unsigned int hi, lo; unsigned int hi, lo;
unsigned int hi2, lo2; unsigned int hi2, lo2;
static int state; static int state;
if (buffer == NULL) if (buffer == NULL) {
{
state = 0; state = 0;
return 0; return 0;
} }
switch (q->port_mode & QC_MODE_MASK) switch (q->port_mode & QC_MODE_MASK) {
{
case QC_BIDIR: /* Bi-directional Port */ case QC_BIDIR: /* Bi-directional Port */
write_lpcontrol(q, 0x26); write_lpcontrol(q, 0x26);
lo = (qc_waithand2(q, 1) >> 1); lo = (qc_waithand2(q, 1) >> 1);
...@@ -541,8 +519,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) ...@@ -541,8 +519,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[])
write_lpcontrol(q, 0x2e); write_lpcontrol(q, 0x2e);
lo2 = (qc_waithand2(q, 0) >> 1); lo2 = (qc_waithand2(q, 0) >> 1);
hi2 = (read_lpstatus(q) >> 3) & 0x1f; hi2 = (read_lpstatus(q) >> 3) & 0x1f;
switch (q->bpp) switch (q->bpp) {
{
case 4: case 4:
buffer[0] = lo & 0xf; buffer[0] = lo & 0xf;
buffer[1] = ((lo & 0x70) >> 4) | ((hi & 1) << 3); buffer[1] = ((lo & 0x70) >> 4) | ((hi & 1) << 3);
...@@ -568,16 +545,14 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) ...@@ -568,16 +545,14 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[])
write_lpcontrol(q, 0xe); write_lpcontrol(q, 0xe);
hi = (qc_waithand(q, 0) & 0xf0) >> 4; hi = (qc_waithand(q, 0) & 0xf0) >> 4;
switch (q->bpp) switch (q->bpp) {
{
case 4: case 4:
buffer[0] = lo; buffer[0] = lo;
buffer[1] = hi; buffer[1] = hi;
ret = 2; ret = 2;
break; break;
case 6: case 6:
switch (state) switch (state) {
{
case 0: case 0:
buffer[0] = (lo << 2) | ((hi & 0xc) >> 2); buffer[0] = (lo << 2) | ((hi & 0xc) >> 2);
q->saved_bits = (hi & 3) << 4; q->saved_bits = (hi & 3) << 4;
...@@ -615,7 +590,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) ...@@ -615,7 +590,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[])
* n=2^(bit depth)-1. Ask me for more details if you don't understand * n=2^(bit depth)-1. Ask me for more details if you don't understand
* this. */ * this. */
static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long len) static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long len)
{ {
int i, j, k, yield; int i, j, k, yield;
int bytes; int bytes;
...@@ -623,9 +598,9 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l ...@@ -623,9 +598,9 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
int divisor; int divisor;
int pixels_per_line; int pixels_per_line;
int pixels_read = 0; int pixels_read = 0;
int got=0; int got = 0;
char buffer[6]; char buffer[6];
int shift=8-q->bpp; int shift = 8 - q->bpp;
char invert; char invert;
if (q->mode == -1) if (q->mode == -1)
...@@ -634,13 +609,12 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l ...@@ -634,13 +609,12 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
qc_command(q, 0x7); qc_command(q, 0x7);
qc_command(q, q->mode); qc_command(q, q->mode);
if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) {
{
write_lpcontrol(q, 0x2e); /* turn port around */ write_lpcontrol(q, 0x2e); /* turn port around */
write_lpcontrol(q, 0x26); write_lpcontrol(q, 0x26);
(void) qc_waithand(q, 1); qc_waithand(q, 1);
write_lpcontrol(q, 0x2e); write_lpcontrol(q, 0x2e);
(void) qc_waithand(q, 0); qc_waithand(q, 0);
} }
/* strange -- should be 15:63 below, but 4bpp is odd */ /* strange -- should be 15:63 below, but 4bpp is odd */
...@@ -653,30 +627,25 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l ...@@ -653,30 +627,25 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
q->transfer_scale; q->transfer_scale;
transperline = DIV_ROUND_UP(transperline, divisor); transperline = DIV_ROUND_UP(transperline, divisor);
for (i = 0, yield = yieldlines; i < linestotrans; i++) for (i = 0, yield = yieldlines; i < linestotrans; i++) {
{ for (pixels_read = j = 0; j < transperline; j++) {
for (pixels_read = j = 0; j < transperline; j++)
{
bytes = qc_readbytes(q, buffer); bytes = qc_readbytes(q, buffer);
for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) {
{
int o; int o;
if (buffer[k] == 0 && invert == 16) if (buffer[k] == 0 && invert == 16) {
{
/* 4bpp is odd (again) -- inverter is 16, not 15, but output /* 4bpp is odd (again) -- inverter is 16, not 15, but output
must be 0-15 -- bls */ must be 0-15 -- bls */
buffer[k] = 16; buffer[k] = 16;
} }
o=i*pixels_per_line + pixels_read + k; o = i * pixels_per_line + pixels_read + k;
if(o<len) if (o < len) {
{
got++; got++;
put_user((invert - buffer[k])<<shift, buf+o); put_user((invert - buffer[k]) << shift, buf + o);
} }
} }
pixels_read += bytes; pixels_read += bytes;
} }
(void) qc_readbytes(q, NULL); /* reset state machine */ qc_readbytes(q, NULL); /* reset state machine */
/* Grabbing an entire frame from the quickcam is a lengthy /* Grabbing an entire frame from the quickcam is a lengthy
process. We don't (usually) want to busy-block the process. We don't (usually) want to busy-block the
...@@ -690,14 +659,13 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l ...@@ -690,14 +659,13 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
} }
} }
if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) {
{
write_lpcontrol(q, 2); write_lpcontrol(q, 2);
write_lpcontrol(q, 6); write_lpcontrol(q, 6);
udelay(3); udelay(3);
write_lpcontrol(q, 0xe); write_lpcontrol(q, 0xe);
} }
if(got<len) if (got < len)
return got; return got;
return len; return len;
} }
...@@ -709,10 +677,9 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l ...@@ -709,10 +677,9 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l
static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct qcam_device *qcam=(struct qcam_device *)dev; struct qcam_device *qcam = (struct qcam_device *)dev;
switch(cmd) switch (cmd) {
{
case VIDIOCGCAP: case VIDIOCGCAP:
{ {
struct video_capability *b = arg; struct video_capability *b = arg;
...@@ -729,10 +696,10 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -729,10 +696,10 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg)
case VIDIOCGCHAN: case VIDIOCGCHAN:
{ {
struct video_channel *v = arg; struct video_channel *v = arg;
if(v->channel!=0) if (v->channel != 0)
return -EINVAL; return -EINVAL;
v->flags=0; v->flags = 0;
v->tuners=0; v->tuners = 0;
/* Good question.. its composite or SVHS so.. */ /* Good question.. its composite or SVHS so.. */
v->type = VIDEO_TYPE_CAMERA; v->type = VIDEO_TYPE_CAMERA;
strcpy(v->name, "Camera"); strcpy(v->name, "Camera");
...@@ -741,58 +708,58 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -741,58 +708,58 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg)
case VIDIOCSCHAN: case VIDIOCSCHAN:
{ {
struct video_channel *v = arg; struct video_channel *v = arg;
if(v->channel!=0) if (v->channel != 0)
return -EINVAL; return -EINVAL;
return 0; return 0;
} }
case VIDIOCGTUNER: case VIDIOCGTUNER:
{ {
struct video_tuner *v = arg; struct video_tuner *v = arg;
if(v->tuner) if (v->tuner)
return -EINVAL; return -EINVAL;
strcpy(v->name, "Format"); strcpy(v->name, "Format");
v->rangelow=0; v->rangelow = 0;
v->rangehigh=0; v->rangehigh = 0;
v->flags= 0; v->flags = 0;
v->mode = VIDEO_MODE_AUTO; v->mode = VIDEO_MODE_AUTO;
return 0; return 0;
} }
case VIDIOCSTUNER: case VIDIOCSTUNER:
{ {
struct video_tuner *v = arg; struct video_tuner *v = arg;
if(v->tuner) if (v->tuner)
return -EINVAL; return -EINVAL;
if(v->mode!=VIDEO_MODE_AUTO) if (v->mode != VIDEO_MODE_AUTO)
return -EINVAL; return -EINVAL;
return 0; return 0;
} }
case VIDIOCGPICT: case VIDIOCGPICT:
{ {
struct video_picture *p = arg; struct video_picture *p = arg;
p->colour=0x8000; p->colour = 0x8000;
p->hue=0x8000; p->hue = 0x8000;
p->brightness=qcam->brightness<<8; p->brightness = qcam->brightness << 8;
p->contrast=qcam->contrast<<8; p->contrast = qcam->contrast << 8;
p->whiteness=qcam->whitebal<<8; p->whiteness = qcam->whitebal << 8;
p->depth=qcam->bpp; p->depth = qcam->bpp;
p->palette=VIDEO_PALETTE_GREY; p->palette = VIDEO_PALETTE_GREY;
return 0; return 0;
} }
case VIDIOCSPICT: case VIDIOCSPICT:
{ {
struct video_picture *p = arg; struct video_picture *p = arg;
if(p->palette!=VIDEO_PALETTE_GREY) if (p->palette != VIDEO_PALETTE_GREY)
return -EINVAL; return -EINVAL;
if(p->depth!=4 && p->depth!=6) if (p->depth != 4 && p->depth != 6)
return -EINVAL; return -EINVAL;
/* /*
* Now load the camera. * Now load the camera.
*/ */
qcam->brightness = p->brightness>>8; qcam->brightness = p->brightness >> 8;
qcam->contrast = p->contrast>>8; qcam->contrast = p->contrast >> 8;
qcam->whitebal = p->whiteness>>8; qcam->whitebal = p->whiteness >> 8;
qcam->bpp = p->depth; qcam->bpp = p->depth;
mutex_lock(&qcam->lock); mutex_lock(&qcam->lock);
...@@ -805,25 +772,22 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -805,25 +772,22 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg)
case VIDIOCSWIN: case VIDIOCSWIN:
{ {
struct video_window *vw = arg; struct video_window *vw = arg;
if(vw->flags) if (vw->flags)
return -EINVAL; return -EINVAL;
if(vw->clipcount) if (vw->clipcount)
return -EINVAL; return -EINVAL;
if(vw->height<60||vw->height>240) if (vw->height < 60 || vw->height > 240)
return -EINVAL; return -EINVAL;
if(vw->width<80||vw->width>320) if (vw->width < 80 || vw->width > 320)
return -EINVAL; return -EINVAL;
qcam->width = 320; qcam->width = 320;
qcam->height = 240; qcam->height = 240;
qcam->transfer_scale = 4; qcam->transfer_scale = 4;
if(vw->width>=160 && vw->height>=120) if (vw->width >= 160 && vw->height >= 120)
{
qcam->transfer_scale = 2; qcam->transfer_scale = 2;
} if (vw->width >= 320 && vw->height >= 240) {
if(vw->width>=320 && vw->height>=240)
{
qcam->width = 320; qcam->width = 320;
qcam->height = 240; qcam->height = 240;
qcam->transfer_scale = 1; qcam->transfer_scale = 1;
...@@ -842,9 +806,10 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -842,9 +806,10 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg)
case VIDIOCGWIN: case VIDIOCGWIN:
{ {
struct video_window *vw = arg; struct video_window *vw = arg;
memset(vw, 0, sizeof(*vw)); memset(vw, 0, sizeof(*vw));
vw->width=qcam->width/qcam->transfer_scale; vw->width = qcam->width / qcam->transfer_scale;
vw->height=qcam->height/qcam->transfer_scale; vw->height = qcam->height / qcam->transfer_scale;
return 0; return 0;
} }
case VIDIOCKEY: case VIDIOCKEY:
...@@ -873,7 +838,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf, ...@@ -873,7 +838,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct video_device *v = video_devdata(file); struct video_device *v = video_devdata(file);
struct qcam_device *qcam=(struct qcam_device *)v; struct qcam_device *qcam = (struct qcam_device *)v;
int len; int len;
parport_claim_or_block(qcam->pdev); parport_claim_or_block(qcam->pdev);
...@@ -885,7 +850,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf, ...@@ -885,7 +850,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
if (qcam->status & QC_PARAM_CHANGE) if (qcam->status & QC_PARAM_CHANGE)
qc_set(qcam); qc_set(qcam);
len=qc_capture(qcam, buf,count); len = qc_capture(qcam, buf, count);
mutex_unlock(&qcam->lock); mutex_unlock(&qcam->lock);
...@@ -917,8 +882,7 @@ static const struct v4l2_file_operations qcam_fops = { ...@@ -917,8 +882,7 @@ static const struct v4l2_file_operations qcam_fops = {
.ioctl = qcam_ioctl, .ioctl = qcam_ioctl,
.read = qcam_read, .read = qcam_read,
}; };
static struct video_device qcam_template= static struct video_device qcam_template = {
{
.name = "Connectix Quickcam", .name = "Connectix Quickcam",
.fops = &qcam_fops, .fops = &qcam_fops,
.release = video_device_release_empty, .release = video_device_release_empty,
...@@ -932,22 +896,20 @@ static int init_bwqcam(struct parport *port) ...@@ -932,22 +896,20 @@ static int init_bwqcam(struct parport *port)
{ {
struct qcam_device *qcam; struct qcam_device *qcam;
if (num_cams == MAX_CAMS) if (num_cams == MAX_CAMS) {
{
printk(KERN_ERR "Too many Quickcams (max %d)\n", MAX_CAMS); printk(KERN_ERR "Too many Quickcams (max %d)\n", MAX_CAMS);
return -ENOSPC; return -ENOSPC;
} }
qcam=qcam_init(port); qcam = qcam_init(port);
if(qcam==NULL) if (qcam == NULL)
return -ENODEV; return -ENODEV;
parport_claim_or_block(qcam->pdev); parport_claim_or_block(qcam->pdev);
qc_reset(qcam); qc_reset(qcam);
if(qc_detect(qcam)==0) if (qc_detect(qcam) == 0) {
{
parport_release(qcam->pdev); parport_release(qcam->pdev);
parport_unregister_device(qcam->pdev); parport_unregister_device(qcam->pdev);
kfree(qcam); kfree(qcam);
...@@ -1045,12 +1007,12 @@ static int __init init_bw_qcams(void) ...@@ -1045,12 +1007,12 @@ static int __init init_bw_qcams(void)
#ifdef MODULE #ifdef MODULE
/* Do some sanity checks on the module parameters. */ /* Do some sanity checks on the module parameters. */
if (maxpoll > 5000) { if (maxpoll > 5000) {
printk("Connectix Quickcam max-poll was above 5000. Using 5000.\n"); printk(KERN_INFO "Connectix Quickcam max-poll was above 5000. Using 5000.\n");
maxpoll = 5000; maxpoll = 5000;
} }
if (yieldlines < 1) { if (yieldlines < 1) {
printk("Connectix Quickcam yieldlines was less than 1. Using 1.\n"); printk(KERN_INFO "Connectix Quickcam yieldlines was less than 1. Using 1.\n");
yieldlines = 1; yieldlines = 1;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment