aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/planb.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/planb.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/planb.c')
-rw-r--r--drivers/media/video/planb.c128
1 files changed, 64 insertions, 64 deletions
diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c
index 15fd85acabda..522e9ddeb089 100644
--- a/drivers/media/video/planb.c
+++ b/drivers/media/video/planb.c
@@ -1,4 +1,4 @@
1/* 1/*
2 planb - PlanB frame grabber driver 2 planb - PlanB frame grabber driver
3 3
4 PlanB is used in the 7x00/8x00 series of PowerMacintosh 4 PlanB is used in the 7x00/8x00 series of PowerMacintosh
@@ -584,7 +584,7 @@ finish:
584 wake_up_interruptible(&pb->suspendq); 584 wake_up_interruptible(&pb->suspendq);
585} 585}
586 586
587static void add_clip(struct planb *pb, struct video_clip *clip) 587static void add_clip(struct planb *pb, struct video_clip *clip)
588{ 588{
589 volatile unsigned char *base; 589 volatile unsigned char *base;
590 int xc = clip->x, yc = clip->y; 590 int xc = clip->x, yc = clip->y;
@@ -758,7 +758,7 @@ static void cmd_buff(struct planb *pb)
758 PLANB_SET(CH_SYNC)); 758 PLANB_SET(CH_SYNC));
759 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), 759 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
760 PLANB_SET(DMA_ABORT)); 760 PLANB_SET(DMA_ABORT));
761 761
762 /* odd field data: */ 762 /* odd field data: */
763 jump = virt_to_bus(c1 + nlines / 2); 763 jump = virt_to_bus(c1 + nlines / 2);
764 for (i=1; i < nlines; i += stepsize, c1++) 764 for (i=1; i < nlines; i += stepsize, c1++)
@@ -1247,7 +1247,7 @@ static volatile struct dbdma_cmd *setup_grab_cmd(int fr, struct planb *pb)
1247 tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++; 1247 tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++;
1248 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), 1248 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
1249 PLANB_SET(DMA_ABORT)); 1249 PLANB_SET(DMA_ABORT));
1250 1250
1251 /* odd field data: */ 1251 /* odd field data: */
1252 jump_addr = c1 + TAB_FACTOR * nlines / 2; 1252 jump_addr = c1 + TAB_FACTOR * nlines / 2;
1253 jump = virt_to_bus(jump_addr); 1253 jump = virt_to_bus(jump_addr);
@@ -1383,7 +1383,7 @@ static int planb_open(struct video_device *dev, int mode)
1383 pb->user++; 1383 pb->user++;
1384 1384
1385 DEBUG("PlanB: device opened\n"); 1385 DEBUG("PlanB: device opened\n");
1386 return 0; 1386 return 0;
1387} 1387}
1388 1388
1389static void planb_close(struct video_device *dev) 1389static void planb_close(struct video_device *dev)
@@ -1424,9 +1424,9 @@ static long planb_write(struct video_device *v, const char *buf,
1424static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) 1424static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
1425{ 1425{
1426 struct planb *pb=(struct planb *)dev; 1426 struct planb *pb=(struct planb *)dev;
1427 1427
1428 switch (cmd) 1428 switch (cmd)
1429 { 1429 {
1430 case VIDIOCGCAP: 1430 case VIDIOCGCAP:
1431 { 1431 {
1432 struct video_capability b; 1432 struct video_capability b;
@@ -1440,26 +1440,26 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
1440 b.channels = 2; /* composite & svhs */ 1440 b.channels = 2; /* composite & svhs */
1441 b.audios = 0; 1441 b.audios = 0;
1442 b.maxwidth = PLANB_MAXPIXELS; 1442 b.maxwidth = PLANB_MAXPIXELS;
1443 b.maxheight = PLANB_MAXLINES; 1443 b.maxheight = PLANB_MAXLINES;
1444 b.minwidth = 32; /* wild guess */ 1444 b.minwidth = 32; /* wild guess */
1445 b.minheight = 32; 1445 b.minheight = 32;
1446 if (copy_to_user(arg,&b,sizeof(b))) 1446 if (copy_to_user(arg,&b,sizeof(b)))
1447 return -EFAULT; 1447 return -EFAULT;
1448 return 0; 1448 return 0;
1449 } 1449 }
1450 case VIDIOCSFBUF: 1450 case VIDIOCSFBUF:
1451 { 1451 {
1452 struct video_buffer v; 1452 struct video_buffer v;
1453 unsigned short bpp; 1453 unsigned short bpp;
1454 unsigned int fmt; 1454 unsigned int fmt;
1455 1455
1456 DEBUG("PlanB: IOCTL VIDIOCSFBUF\n"); 1456 DEBUG("PlanB: IOCTL VIDIOCSFBUF\n");
1457 1457
1458 if (!capable(CAP_SYS_ADMIN) 1458 if (!capable(CAP_SYS_ADMIN)
1459 || !capable(CAP_SYS_RAWIO)) 1459 || !capable(CAP_SYS_RAWIO))
1460 return -EPERM; 1460 return -EPERM;
1461 if (copy_from_user(&v, arg,sizeof(v))) 1461 if (copy_from_user(&v, arg,sizeof(v)))
1462 return -EFAULT; 1462 return -EFAULT;
1463 planb_lock(pb); 1463 planb_lock(pb);
1464 switch(v.depth) { 1464 switch(v.depth) {
1465 case 8: 1465 case 8:
@@ -1478,7 +1478,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
1478 break; 1478 break;
1479 default: 1479 default:
1480 planb_unlock(pb); 1480 planb_unlock(pb);
1481 return -EINVAL; 1481 return -EINVAL;
1482 } 1482 }
1483 if (bpp * v.width > v.bytesperline) { 1483 if (bpp * v.width > v.bytesperline) {
1484 planb_unlock(pb); 1484 planb_unlock(pb);
@@ -1493,7 +1493,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
1493 pb->win.bpl = pb->win.bpp * pb->win.swidth; 1493 pb->win.bpl = pb->win.bpp * pb->win.swidth;
1494 pb->win.pad = v.bytesperline - pb->win.bpl; 1494 pb->win.pad = v.bytesperline - pb->win.bpl;
1495 1495
1496 DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d," 1496 DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d,"
1497 " bpl %d (+ %d)\n", v.base, v.width,v.height, 1497 " bpl %d (+ %d)\n", v.base, v.width,v.height,
1498 pb->win.bpp, pb->win.bpl, pb->win.pad); 1498 pb->win.bpp, pb->win.bpl, pb->win.pad);
1499 1499
@@ -1504,11 +1504,11 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
1504 resume_overlay(pb); 1504 resume_overlay(pb);
1505 } 1505 }
1506 planb_unlock(pb); 1506 planb_unlock(pb);
1507 return 0; 1507 return 0;
1508 } 1508 }
1509 case VIDIOCGFBUF: 1509 case VIDIOCGFBUF:
1510 { 1510 {
1511 struct video_buffer v; 1511 struct video_buffer v;
1512 1512
1513 DEBUG("PlanB: IOCTL VIDIOCGFBUF\n"); 1513 DEBUG("PlanB: IOCTL VIDIOCGFBUF\n");
1514 1514
@@ -1518,15 +1518,15 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
1518 v.depth = pb->win.depth; 1518 v.depth = pb->win.depth;
1519 v.bytesperline = pb->win.bpl + pb->win.pad; 1519 v.bytesperline = pb->win.bpl + pb->win.pad;
1520 if (copy_to_user(arg, &v, sizeof(v))) 1520 if (copy_to_user(arg, &v, sizeof(v)))
1521 return -EFAULT; 1521 return -EFAULT;
1522 return 0; 1522 return 0;
1523 } 1523 }
1524 case VIDIOCCAPTURE: 1524 case VIDIOCCAPTURE:
1525 { 1525 {
1526 int i; 1526 int i;
1527 1527
1528 if(copy_from_user(&i, arg, sizeof(i))) 1528 if(copy_from_user(&i, arg, sizeof(i)))
1529 return -EFAULT; 1529 return -EFAULT;
1530 if(i==0) { 1530 if(i==0) {
1531 DEBUG("PlanB: IOCTL VIDIOCCAPTURE Stop\n"); 1531 DEBUG("PlanB: IOCTL VIDIOCCAPTURE Stop\n");
1532 1532
@@ -1695,7 +1695,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
1695 struct video_window vw; 1695 struct video_window vw;
1696 struct video_clip clip; 1696 struct video_clip clip;
1697 int i; 1697 int i;
1698 1698
1699 DEBUG("PlanB: IOCTL VIDIOCSWIN\n"); 1699 DEBUG("PlanB: IOCTL VIDIOCSWIN\n");
1700 1700
1701 if(copy_from_user(&vw,arg,sizeof(vw))) 1701 if(copy_from_user(&vw,arg,sizeof(vw)))
@@ -1749,7 +1749,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
1749 return -EFAULT; 1749 return -EFAULT;
1750 return 0; 1750 return 0;
1751 } 1751 }
1752 case VIDIOCSYNC: { 1752 case VIDIOCSYNC: {
1753 int i; 1753 int i;
1754 1754
1755 IDEBUG("PlanB: IOCTL VIDIOCSYNC\n"); 1755 IDEBUG("PlanB: IOCTL VIDIOCSYNC\n");
@@ -1759,42 +1759,42 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
1759 1759
1760 IDEBUG("PlanB: sync to frame %d\n", i); 1760 IDEBUG("PlanB: sync to frame %d\n", i);
1761 1761
1762 if(i > (MAX_GBUFFERS - 1) || i < 0) 1762 if(i > (MAX_GBUFFERS - 1) || i < 0)
1763 return -EINVAL; 1763 return -EINVAL;
1764chk_grab: 1764chk_grab:
1765 switch (pb->frame_stat[i]) { 1765 switch (pb->frame_stat[i]) {
1766 case GBUFFER_UNUSED: 1766 case GBUFFER_UNUSED:
1767 return -EINVAL; 1767 return -EINVAL;
1768 case GBUFFER_GRABBING: 1768 case GBUFFER_GRABBING:
1769 IDEBUG("PlanB: waiting for grab" 1769 IDEBUG("PlanB: waiting for grab"
1770 " done (%d)\n", i); 1770 " done (%d)\n", i);
1771 interruptible_sleep_on(&pb->capq); 1771 interruptible_sleep_on(&pb->capq);
1772 if(signal_pending(current)) 1772 if(signal_pending(current))
1773 return -EINTR; 1773 return -EINTR;
1774 goto chk_grab; 1774 goto chk_grab;
1775 case GBUFFER_DONE: 1775 case GBUFFER_DONE:
1776 pb->frame_stat[i] = GBUFFER_UNUSED; 1776 pb->frame_stat[i] = GBUFFER_UNUSED;
1777 break; 1777 break;
1778 } 1778 }
1779 return 0; 1779 return 0;
1780 } 1780 }
1781 1781
1782 case VIDIOCMCAPTURE: 1782 case VIDIOCMCAPTURE:
1783 { 1783 {
1784 struct video_mmap vm; 1784 struct video_mmap vm;
1785 volatile unsigned int status; 1785 volatile unsigned int status;
1786 1786
1787 IDEBUG("PlanB: IOCTL VIDIOCMCAPTURE\n"); 1787 IDEBUG("PlanB: IOCTL VIDIOCMCAPTURE\n");
1788 1788
1789 if(copy_from_user((void *) &vm,(void *)arg,sizeof(vm))) 1789 if(copy_from_user((void *) &vm,(void *)arg,sizeof(vm)))
1790 return -EFAULT; 1790 return -EFAULT;
1791 status = pb->frame_stat[vm.frame]; 1791 status = pb->frame_stat[vm.frame];
1792 if (status != GBUFFER_UNUSED) 1792 if (status != GBUFFER_UNUSED)
1793 return -EBUSY; 1793 return -EBUSY;
1794 1794
1795 return vgrab(pb, &vm); 1795 return vgrab(pb, &vm);
1796 } 1796 }
1797 1797
1798 case VIDIOCGMBUF: 1798 case VIDIOCGMBUF:
1799 { 1799 {
1800 int i; 1800 int i;
@@ -1811,7 +1811,7 @@ chk_grab:
1811 return -EFAULT; 1811 return -EFAULT;
1812 return 0; 1812 return 0;
1813 } 1813 }
1814 1814
1815 case PLANBIOCGSAAREGS: 1815 case PLANBIOCGSAAREGS:
1816 { 1816 {
1817 struct planb_saa_regs preg; 1817 struct planb_saa_regs preg;
@@ -1828,7 +1828,7 @@ chk_grab:
1828 return -EFAULT; 1828 return -EFAULT;
1829 return 0; 1829 return 0;
1830 } 1830 }
1831 1831
1832 case PLANBIOCSSAAREGS: 1832 case PLANBIOCSSAAREGS:
1833 { 1833 {
1834 struct planb_saa_regs preg; 1834 struct planb_saa_regs preg;
@@ -1842,7 +1842,7 @@ chk_grab:
1842 saa_set (preg.addr, preg.val, pb); 1842 saa_set (preg.addr, preg.val, pb);
1843 return 0; 1843 return 0;
1844 } 1844 }
1845 1845
1846 case PLANBIOCGSTAT: 1846 case PLANBIOCGSTAT:
1847 { 1847 {
1848 struct planb_stat_regs pstat; 1848 struct planb_stat_regs pstat;
@@ -1859,7 +1859,7 @@ chk_grab:
1859 return -EFAULT; 1859 return -EFAULT;
1860 return 0; 1860 return 0;
1861 } 1861 }
1862 1862
1863 case PLANBIOCSMODE: { 1863 case PLANBIOCSMODE: {
1864 int v; 1864 int v;
1865 1865
@@ -1985,10 +1985,10 @@ static int planb_mmap(struct vm_area_struct *vma, struct video_device *dev, cons
1985{ 1985{
1986 int i; 1986 int i;
1987 struct planb *pb = (struct planb *)dev; 1987 struct planb *pb = (struct planb *)dev;
1988 unsigned long start = (unsigned long)adr; 1988 unsigned long start = (unsigned long)adr;
1989 1989
1990 if (size > MAX_GBUFFERS * PLANB_MAX_FBUF) 1990 if (size > MAX_GBUFFERS * PLANB_MAX_FBUF)
1991 return -EINVAL; 1991 return -EINVAL;
1992 if (!pb->rawbuf) { 1992 if (!pb->rawbuf) {
1993 int err; 1993 int err;
1994 if((err=grabbuf_alloc(pb))) 1994 if((err=grabbuf_alloc(pb)))
@@ -2091,10 +2091,10 @@ static int init_planb(struct planb *pb)
2091 /* clear interrupt mask */ 2091 /* clear interrupt mask */
2092 pb->intr_mask = PLANB_CLR_IRQ; 2092 pb->intr_mask = PLANB_CLR_IRQ;
2093 2093
2094 result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb); 2094 result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb);
2095 if (result < 0) { 2095 if (result < 0) {
2096 if (result==-EINVAL) 2096 if (result==-EINVAL)
2097 printk(KERN_ERR "PlanB: Bad irq number (%d) " 2097 printk(KERN_ERR "PlanB: Bad irq number (%d) "
2098 "or handler\n", (int)pb->irq); 2098 "or handler\n", (int)pb->irq);
2099 else if (result==-EBUSY) 2099 else if (result==-EBUSY)
2100 printk(KERN_ERR "PlanB: I don't know why, " 2100 printk(KERN_ERR "PlanB: I don't know why, "
@@ -2102,7 +2102,7 @@ static int init_planb(struct planb *pb)
2102 return result; 2102 return result;
2103 } 2103 }
2104 disable_irq(pb->irq); 2104 disable_irq(pb->irq);
2105 2105
2106 /* Now add the template and register the device unit. */ 2106 /* Now add the template and register the device unit. */
2107 memcpy(&pb->video_dev,&planb_template,sizeof(planb_template)); 2107 memcpy(&pb->video_dev,&planb_template,sizeof(planb_template));
2108 2108
@@ -2143,7 +2143,7 @@ static int init_planb(struct planb *pb)
2143} 2143}
2144 2144
2145/* 2145/*
2146 * Scan for a PlanB controller, request the irq and map the io memory 2146 * Scan for a PlanB controller, request the irq and map the io memory
2147 */ 2147 */
2148 2148
2149static int find_planb(void) 2149static int find_planb(void)
@@ -2171,9 +2171,9 @@ static int find_planb(void)
2171 pb = &planbs[0]; 2171 pb = &planbs[0];
2172 planb_num = 1; 2172 planb_num = 1;
2173 2173
2174 if (planb_devices->n_addrs != 1) { 2174 if (planb_devices->n_addrs != 1) {
2175 printk (KERN_WARNING "PlanB: expecting 1 address for planb " 2175 printk (KERN_WARNING "PlanB: expecting 1 address for planb "
2176 "(got %d)", planb_devices->n_addrs); 2176 "(got %d)", planb_devices->n_addrs);
2177 return 0; 2177 return 0;
2178 } 2178 }
2179 2179
@@ -2236,7 +2236,7 @@ static int find_planb(void)
2236 pb->planb_base = planb_regs; 2236 pb->planb_base = planb_regs;
2237 pb->planb_base_phys = (struct planb_registers *)new_base; 2237 pb->planb_base_phys = (struct planb_registers *)new_base;
2238 pb->irq = irq; 2238 pb->irq = irq;
2239 2239
2240 return planb_num; 2240 return planb_num;
2241 2241
2242err_out_disable: 2242err_out_disable:
@@ -2251,7 +2251,7 @@ static void release_planb(void)
2251 int i; 2251 int i;
2252 struct planb *pb; 2252 struct planb *pb;
2253 2253
2254 for (i=0;i<planb_num; i++) 2254 for (i=0;i<planb_num; i++)
2255 { 2255 {
2256 pb=&planbs[i]; 2256 pb=&planbs[i];
2257 2257
@@ -2278,7 +2278,7 @@ static void release_planb(void)
2278static int __init init_planbs(void) 2278static int __init init_planbs(void)
2279{ 2279{
2280 int i; 2280 int i;
2281 2281
2282 if (find_planb()<=0) 2282 if (find_planb()<=0)
2283 return -EIO; 2283 return -EIO;
2284 2284
@@ -2288,9 +2288,9 @@ static int __init init_planbs(void)
2288 " with v4l\n", i); 2288 " with v4l\n", i);
2289 release_planb(); 2289 release_planb();
2290 return -EIO; 2290 return -EIO;
2291 } 2291 }
2292 printk(KERN_INFO "PlanB: registered device %d with v4l\n", i); 2292 printk(KERN_INFO "PlanB: registered device %d with v4l\n", i);
2293 } 2293 }
2294 return 0; 2294 return 0;
2295} 2295}
2296 2296