aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/c-qcam.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-03-25 07:19:53 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-03-25 07:29:23 -0500
commitd56410e0a594150c5ca06319da7bc8901c4d455e (patch)
treef1462651ac1bcc5cec48219dbb422ac615231423 /drivers/media/video/c-qcam.c
parent9f6933be665ce3b049c274c99810ac754edabf19 (diff)
V4L/DVB (3599b): Whitespace cleanups under drivers/media
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/c-qcam.c')
-rw-r--r--drivers/media/video/c-qcam.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c
index 8211fd8d7cbf..22a7386bbea6 100644
--- a/drivers/media/video/c-qcam.c
+++ b/drivers/media/video/c-qcam.c
@@ -16,7 +16,7 @@
16 * 16 *
17 * The parport parameter controls which parports will be scanned. 17 * The parport parameter controls which parports will be scanned.
18 * Scanning all parports causes some printers to print a garbage page. 18 * Scanning all parports causes some printers to print a garbage page.
19 * -- March 14, 1999 Billy Donahue <billy@escape.com> 19 * -- March 14, 1999 Billy Donahue <billy@escape.com>
20 * 20 *
21 * Fixed data format to BGR, added force_rgb parameter. Added missing 21 * Fixed data format to BGR, added force_rgb parameter. Added missing
22 * parport_unregister_driver() on module removal. 22 * parport_unregister_driver() on module removal.
@@ -88,7 +88,7 @@ static inline unsigned int qcam_ready2(struct qcam_device *qcam)
88 return (parport_read_data(qcam->pport) & 0x1)?1:0; 88 return (parport_read_data(qcam->pport) & 0x1)?1:0;
89} 89}
90 90
91static unsigned int qcam_await_ready1(struct qcam_device *qcam, 91static unsigned int qcam_await_ready1(struct qcam_device *qcam,
92 int value) 92 int value)
93{ 93{
94 unsigned long oldjiffies = jiffies; 94 unsigned long oldjiffies = jiffies;
@@ -98,7 +98,7 @@ static unsigned int qcam_await_ready1(struct qcam_device *qcam,
98 if (qcam_ready1(qcam) == value) 98 if (qcam_ready1(qcam) == value)
99 return 0; 99 return 0;
100 100
101 /* If the camera didn't respond within 1/25 second, poll slowly 101 /* If the camera didn't respond within 1/25 second, poll slowly
102 for a while. */ 102 for a while. */
103 for (i = 0; i < 50; i++) 103 for (i = 0; i < 50; i++)
104 { 104 {
@@ -123,7 +123,7 @@ static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value)
123 if (qcam_ready2(qcam) == value) 123 if (qcam_ready2(qcam) == value)
124 return 0; 124 return 0;
125 125
126 /* If the camera didn't respond within 1/25 second, poll slowly 126 /* If the camera didn't respond within 1/25 second, poll slowly
127 for a while. */ 127 for a while. */
128 for (i = 0; i < 50; i++) 128 for (i = 0; i < 50; i++)
129 { 129 {
@@ -157,12 +157,12 @@ static int qcam_write_data(struct qcam_device *qcam, unsigned int data)
157 unsigned int idata; 157 unsigned int idata;
158 parport_write_data(qcam->pport, data); 158 parport_write_data(qcam->pport, data);
159 idata = qcam_read_data(qcam); 159 idata = qcam_read_data(qcam);
160 if (data != idata) 160 if (data != idata)
161 { 161 {
162 printk(KERN_WARNING "cqcam: sent %x but received %x\n", data, 162 printk(KERN_WARNING "cqcam: sent %x but received %x\n", data,
163 idata); 163 idata);
164 return 1; 164 return 1;
165 } 165 }
166 return 0; 166 return 0;
167} 167}
168 168
@@ -193,12 +193,12 @@ static int qc_detect(struct qcam_device *qcam)
193 no device was found". Fix this one day. */ 193 no device was found". Fix this one day. */
194 if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA 194 if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA
195 && qcam->pport->probe_info[0].model 195 && qcam->pport->probe_info[0].model
196 && !strcmp(qcam->pdev->port->probe_info[0].model, 196 && !strcmp(qcam->pdev->port->probe_info[0].model,
197 "Color QuickCam 2.0")) { 197 "Color QuickCam 2.0")) {
198 printk(KERN_DEBUG "QuickCam: Found by IEEE1284 probe.\n"); 198 printk(KERN_DEBUG "QuickCam: Found by IEEE1284 probe.\n");
199 return 1; 199 return 1;
200 } 200 }
201 201
202 if (probe < 2) 202 if (probe < 2)
203 return 0; 203 return 0;
204 204
@@ -206,11 +206,11 @@ static int qc_detect(struct qcam_device *qcam)
206 206
207 /* look for a heartbeat */ 207 /* look for a heartbeat */
208 ostat = stat = parport_read_status(qcam->pport); 208 ostat = stat = parport_read_status(qcam->pport);
209 for (i=0; i<250; i++) 209 for (i=0; i<250; i++)
210 { 210 {
211 mdelay(1); 211 mdelay(1);
212 stat = parport_read_status(qcam->pport); 212 stat = parport_read_status(qcam->pport);
213 if (ostat != stat) 213 if (ostat != stat)
214 { 214 {
215 if (++count >= 3) return 1; 215 if (++count >= 3) return 1;
216 ostat = stat; 216 ostat = stat;
@@ -226,11 +226,11 @@ static int qc_detect(struct qcam_device *qcam)
226 count = 0; 226 count = 0;
227 227
228 ostat = stat = parport_read_status(qcam->pport); 228 ostat = stat = parport_read_status(qcam->pport);
229 for (i=0; i<250; i++) 229 for (i=0; i<250; i++)
230 { 230 {
231 mdelay(1); 231 mdelay(1);
232 stat = parport_read_status(qcam->pport); 232 stat = parport_read_status(qcam->pport);
233 if (ostat != stat) 233 if (ostat != stat)
234 { 234 {
235 if (++count >= 3) return 1; 235 if (++count >= 3) return 1;
236 ostat = stat; 236 ostat = stat;
@@ -247,7 +247,7 @@ static void qc_reset(struct qcam_device *qcam)
247 parport_write_control(qcam->pport, 0x8); 247 parport_write_control(qcam->pport, 0x8);
248 mdelay(1); 248 mdelay(1);
249 parport_write_control(qcam->pport, 0xc); 249 parport_write_control(qcam->pport, 0xc);
250 mdelay(1); 250 mdelay(1);
251} 251}
252 252
253/* Reset the QuickCam and program for brightness, contrast, 253/* Reset the QuickCam and program for brightness, contrast,
@@ -258,7 +258,7 @@ static void qc_setup(struct qcam_device *q)
258 qc_reset(q); 258 qc_reset(q);
259 259
260 /* Set the brightness. */ 260 /* Set the brightness. */
261 qcam_set(q, 11, q->brightness); 261 qcam_set(q, 11, q->brightness);
262 262
263 /* Set the height and width. These refer to the actual 263 /* Set the height and width. These refer to the actual
264 CCD area *before* applying the selected decimation. */ 264 CCD area *before* applying the selected decimation. */
@@ -272,12 +272,12 @@ static void qc_setup(struct qcam_device *q)
272 /* Set contrast and white balance. */ 272 /* Set contrast and white balance. */
273 qcam_set(q, 0x19, q->contrast); 273 qcam_set(q, 0x19, q->contrast);
274 qcam_set(q, 0x1f, q->whitebal); 274 qcam_set(q, 0x1f, q->whitebal);
275 275
276 /* Set the speed. */ 276 /* Set the speed. */
277 qcam_set(q, 45, 2); 277 qcam_set(q, 45, 2);
278} 278}
279 279
280/* Read some bytes from the camera and put them in the buffer. 280/* Read some bytes from the camera and put them in the buffer.
281 nbytes should be a multiple of 3, because bidirectional mode gives 281 nbytes should be a multiple of 3, because bidirectional mode gives
282 us three bytes at a time. */ 282 us three bytes at a time. */
283 283
@@ -383,7 +383,7 @@ static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long le
383 383
384 if (qcam_set(q, 7, (q->mode | (is_bi_dir?1:0)) + 1)) 384 if (qcam_set(q, 7, (q->mode | (is_bi_dir?1:0)) + 1))
385 return -EIO; 385 return -EIO;
386 386
387 lines = q->height; 387 lines = q->height;
388 pixelsperline = q->width; 388 pixelsperline = q->width;
389 bitsperxfer = (is_bi_dir) ? 24 : 8; 389 bitsperxfer = (is_bi_dir) ? 24 : 8;
@@ -499,7 +499,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
499{ 499{
500 struct video_device *dev = video_devdata(file); 500 struct video_device *dev = video_devdata(file);
501 struct qcam_device *qcam=(struct qcam_device *)dev; 501 struct qcam_device *qcam=(struct qcam_device *)dev;
502 502
503 switch(cmd) 503 switch(cmd)
504 { 504 {
505 case VIDIOCGCAP: 505 case VIDIOCGCAP:
@@ -574,7 +574,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
574 */ 574 */
575 if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24) 575 if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24)
576 return -EINVAL; 576 return -EINVAL;
577 577
578 /* 578 /*
579 * Now load the camera. 579 * Now load the camera.
580 */ 580 */
@@ -584,7 +584,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
584 584
585 mutex_lock(&qcam->lock); 585 mutex_lock(&qcam->lock);
586 parport_claim_or_block(qcam->pdev); 586 parport_claim_or_block(qcam->pdev);
587 qc_setup(qcam); 587 qc_setup(qcam);
588 parport_release(qcam->pdev); 588 parport_release(qcam->pdev);
589 mutex_unlock(&qcam->lock); 589 mutex_unlock(&qcam->lock);
590 return 0; 590 return 0;
@@ -601,11 +601,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
601 return -EINVAL; 601 return -EINVAL;
602 if(vw->width<80||vw->width>320) 602 if(vw->width<80||vw->width>320)
603 return -EINVAL; 603 return -EINVAL;
604 604
605 qcam->width = 80; 605 qcam->width = 80;
606 qcam->height = 60; 606 qcam->height = 60;
607 qcam->mode = QC_DECIMATION_4; 607 qcam->mode = QC_DECIMATION_4;
608 608
609 if(vw->width>=160 && vw->height>=120) 609 if(vw->width>=160 && vw->height>=120)
610 { 610 {
611 qcam->width = 160; 611 qcam->width = 160;
@@ -627,7 +627,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file,
627 qcam->mode = QC_BILLIONS | QC_DECIMATION_1; 627 qcam->mode = QC_BILLIONS | QC_DECIMATION_1;
628 } 628 }
629#endif 629#endif
630 /* Ok we figured out what to use from our 630 /* Ok we figured out what to use from our
631 wide choice */ 631 wide choice */
632 mutex_lock(&qcam->lock); 632 mutex_lock(&qcam->lock);
633 parport_claim_or_block(qcam->pdev); 633 parport_claim_or_block(qcam->pdev);
@@ -676,7 +676,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf,
676 mutex_lock(&qcam->lock); 676 mutex_lock(&qcam->lock);
677 parport_claim_or_block(qcam->pdev); 677 parport_claim_or_block(qcam->pdev);
678 /* Probably should have a semaphore against multiple users */ 678 /* Probably should have a semaphore against multiple users */
679 len = qc_capture(qcam, buf,count); 679 len = qc_capture(qcam, buf,count);
680 parport_release(qcam->pdev); 680 parport_release(qcam->pdev);
681 mutex_unlock(&qcam->lock); 681 mutex_unlock(&qcam->lock);
682 return len; 682 return len;
@@ -707,7 +707,7 @@ static struct video_device qcam_template=
707static struct qcam_device *qcam_init(struct parport *port) 707static struct qcam_device *qcam_init(struct parport *port)
708{ 708{
709 struct qcam_device *q; 709 struct qcam_device *q;
710 710
711 q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); 711 q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL);
712 if(q==NULL) 712 if(q==NULL)
713 return NULL; 713 return NULL;
@@ -718,14 +718,14 @@ static struct qcam_device *qcam_init(struct parport *port)
718 718
719 q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0; 719 q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0;
720 720
721 if (q->pdev == NULL) 721 if (q->pdev == NULL)
722 { 722 {
723 printk(KERN_ERR "c-qcam: couldn't register for %s.\n", 723 printk(KERN_ERR "c-qcam: couldn't register for %s.\n",
724 port->name); 724 port->name);
725 kfree(q); 725 kfree(q);
726 return NULL; 726 return NULL;
727 } 727 }
728 728
729 memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); 729 memcpy(&q->vdev, &qcam_template, sizeof(qcam_template));
730 730
731 mutex_init(&q->lock); 731 mutex_init(&q->lock);
@@ -766,11 +766,11 @@ static int init_cqcam(struct parport *port)
766 qcam = qcam_init(port); 766 qcam = qcam_init(port);
767 if (qcam==NULL) 767 if (qcam==NULL)
768 return -ENODEV; 768 return -ENODEV;
769 769
770 parport_claim_or_block(qcam->pdev); 770 parport_claim_or_block(qcam->pdev);
771 771
772 qc_reset(qcam); 772 qc_reset(qcam);
773 773
774 if (probe && qc_detect(qcam)==0) 774 if (probe && qc_detect(qcam)==0)
775 { 775 {
776 parport_release(qcam->pdev); 776 parport_release(qcam->pdev);
@@ -782,7 +782,7 @@ static int init_cqcam(struct parport *port)
782 qc_setup(qcam); 782 qc_setup(qcam);
783 783
784 parport_release(qcam->pdev); 784 parport_release(qcam->pdev);
785 785
786 if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) 786 if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1)
787 { 787 {
788 printk(KERN_ERR "Unable to register Colour QuickCam on %s\n", 788 printk(KERN_ERR "Unable to register Colour QuickCam on %s\n",
@@ -792,9 +792,9 @@ static int init_cqcam(struct parport *port)
792 return -ENODEV; 792 return -ENODEV;
793 } 793 }
794 794
795 printk(KERN_INFO "video%d: Colour QuickCam found on %s\n", 795 printk(KERN_INFO "video%d: Colour QuickCam found on %s\n",
796 qcam->vdev.minor, qcam->pport->name); 796 qcam->vdev.minor, qcam->pport->name);
797 797
798 qcams[num_cams++] = qcam; 798 qcams[num_cams++] = qcam;
799 799
800 return 0; 800 return 0;