aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorBenjamin Adolphi <b.adolphi@googlemail.com>2010-02-21 15:44:57 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-03 19:43:03 -0500
commit669c930c8fe266917865f923db51c3b654ab78a3 (patch)
tree290bcf4d850c19381fc2715ed4bce6e933270379 /drivers/staging
parente20ad20d849eb902628553be1fd2dc9ccc40a4bd (diff)
Staging: comedi: amplc_dio200: Checkpatch cleanups
This fixes all checkpatch issues in the amplc_dio200 comedi driver. Signed-off-by: Benjamin Adolphi <b.adolphi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/comedi/drivers/amplc_dio200.c122
1 files changed, 51 insertions, 71 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c
index 69ab2813dd2..204f30ef6e9 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200.c
@@ -48,8 +48,8 @@ Passing a zero for an option is the same as leaving it unspecified.
48 48
49SUBDEVICES 49SUBDEVICES
50 50
51 PC218E PC212E PC215E/PCI215 51 PC218E PC212E PC215E/PCI215
52 ------------- ------------- ------------- 52 ------------- ------------- -------------
53 Subdevices 7 6 5 53 Subdevices 7 6 5
54 0 CTR-X1 PPI-X PPI-X 54 0 CTR-X1 PPI-X PPI-X
55 1 CTR-X2 CTR-Y1 PPI-Y 55 1 CTR-X2 CTR-Y1 PPI-Y
@@ -59,8 +59,8 @@ SUBDEVICES
59 5 CTR-Z2 INTERRUPT 59 5 CTR-Z2 INTERRUPT
60 6 INTERRUPT 60 6 INTERRUPT
61 61
62 PC214E PC272E/PCI272 62 PC214E PC272E/PCI272
63 ------------- ------------- 63 ------------- -------------
64 Subdevices 4 4 64 Subdevices 4 4
65 0 PPI-X PPI-X 65 0 PPI-X PPI-X
66 1 PPI-Y PPI-Y 66 1 PPI-Y PPI-Y
@@ -96,8 +96,8 @@ instructions are supported:
96 0 to 7 as follows: 96 0 to 7 as follows:
97 97
98 0. CLK n, the counter channel's dedicated CLK input from the SK1 98 0. CLK n, the counter channel's dedicated CLK input from the SK1
99 connector. (N.B. for other values, the counter channel's CLKn 99 connector. (N.B. for other values, the counter channel's CLKn
100 pin on the SK1 connector is an output!) 100 pin on the SK1 connector is an output!)
101 1. Internal 10 MHz clock. 101 1. Internal 10 MHz clock.
102 2. Internal 1 MHz clock. 102 2. Internal 1 MHz clock.
103 3. Internal 100 kHz clock. 103 3. Internal 100 kHz clock.
@@ -105,8 +105,8 @@ instructions are supported:
105 5. Internal 1 kHz clock. 105 5. Internal 1 kHz clock.
106 6. OUT n-1, the output of counter channel n-1 (see note 1 below). 106 6. OUT n-1, the output of counter channel n-1 (see note 1 below).
107 7. Ext Clock, the counter chip's dedicated Ext Clock input from 107 7. Ext Clock, the counter chip's dedicated Ext Clock input from
108 the SK1 connector. This pin is shared by all three counter 108 the SK1 connector. This pin is shared by all three counter
109 channels on the chip. 109 channels on the chip.
110 110
111 INSN_CONFIG_GET_CLOCK_SRC. Returns the counter channel's current 111 INSN_CONFIG_GET_CLOCK_SRC. Returns the counter channel's current
112 clock source in data[1]. For internal clock sources, data[2] is set 112 clock source in data[1]. For internal clock sources, data[2] is set
@@ -120,10 +120,10 @@ instructions are supported:
120 0. VCC (internal +5V d.c.), i.e. gate permanently enabled. 120 0. VCC (internal +5V d.c.), i.e. gate permanently enabled.
121 1. GND (internal 0V d.c.), i.e. gate permanently disabled. 121 1. GND (internal 0V d.c.), i.e. gate permanently disabled.
122 2. GAT n, the counter channel's dedicated GAT input from the SK1 122 2. GAT n, the counter channel's dedicated GAT input from the SK1
123 connector. (N.B. for other values, the counter channel's GATn 123 connector. (N.B. for other values, the counter channel's GATn
124 pin on the SK1 connector is an output!) 124 pin on the SK1 connector is an output!)
125 3. /OUT n-2, the inverted output of counter channel n-2 (see note 125 3. /OUT n-2, the inverted output of counter channel n-2 (see note
126 2 below). 126 2 below).
127 4. Reserved. 127 4. Reserved.
128 5. Reserved. 128 5. Reserved.
129 6. Reserved. 129 6. Reserved.
@@ -153,8 +153,8 @@ below.
153 153
154INTERRUPT SOURCES 154INTERRUPT SOURCES
155 155
156 PC218E PC212E PC215E/PCI215 156 PC218E PC212E PC215E/PCI215
157 ------------- ------------- ------------- 157 ------------- ------------- -------------
158 Sources 6 6 6 158 Sources 6 6 6
159 0 CTR-X1-OUT PPI-X-C0 PPI-X-C0 159 0 CTR-X1-OUT PPI-X-C0 PPI-X-C0
160 1 CTR-X2-OUT PPI-X-C3 PPI-X-C3 160 1 CTR-X2-OUT PPI-X-C3 PPI-X-C3
@@ -163,8 +163,8 @@ INTERRUPT SOURCES
163 4 CTR-Z1-OUT CTR-Z1-OUT CTR-Z1-OUT 163 4 CTR-Z1-OUT CTR-Z1-OUT CTR-Z1-OUT
164 5 CTR-Z2-OUT CTR-Z2-OUT CTR-Z2-OUT 164 5 CTR-Z2-OUT CTR-Z2-OUT CTR-Z2-OUT
165 165
166 PC214E PC272E/PCI272 166 PC214E PC272E/PCI272
167 ------------- ------------- 167 ------------- -------------
168 Sources 1 6 168 Sources 1 6
169 0 JUMPER-J5 PPI-X-C0 169 0 JUMPER-J5 PPI-X-C0
170 1 PPI-X-C3 170 1 PPI-X-C3
@@ -435,11 +435,13 @@ MODULE_DEVICE_TABLE(pci, dio200_pci_table);
435 * Useful for shorthand access to the particular board structure 435 * Useful for shorthand access to the particular board structure
436 */ 436 */
437#define thisboard ((const struct dio200_board *)dev->board_ptr) 437#define thisboard ((const struct dio200_board *)dev->board_ptr)
438#define thislayout (&dio200_layouts[((struct dio200_board *)dev->board_ptr)->layout]) 438#define thislayout (&dio200_layouts[((struct dio200_board *) \
439 dev->board_ptr)->layout])
439 440
440/* this structure is for data unique to this hardware driver. If 441/* this structure is for data unique to this hardware driver. If
441 several hardware drivers keep similar information in this structure, 442 several hardware drivers keep similar information in this structure,
442 feel free to suggest moving the variable to the struct comedi_device struct. */ 443 feel free to suggest moving the variable to the struct comedi_device struct.
444 */
443struct dio200_private { 445struct dio200_private {
444#ifdef CONFIG_COMEDI_PCI 446#ifdef CONFIG_COMEDI_PCI
445 struct pci_dev *pci_dev; /* PCI device */ 447 struct pci_dev *pci_dev; /* PCI device */
@@ -603,9 +605,8 @@ static void dio200_stop_intr(struct comedi_device *dev,
603 605
604 subpriv->active = 0; 606 subpriv->active = 0;
605 subpriv->enabled_isns = 0; 607 subpriv->enabled_isns = 0;
606 if (subpriv->has_int_sce) { 608 if (subpriv->has_int_sce)
607 outb(0, subpriv->iobase); 609 outb(0, subpriv->iobase);
608 }
609} 610}
610 611
611/* 612/*
@@ -629,16 +630,14 @@ static int dio200_start_intr(struct comedi_device *dev,
629 /* Determine interrupt sources to enable. */ 630 /* Determine interrupt sources to enable. */
630 isn_bits = 0; 631 isn_bits = 0;
631 if (cmd->chanlist) { 632 if (cmd->chanlist) {
632 for (n = 0; n < cmd->chanlist_len; n++) { 633 for (n = 0; n < cmd->chanlist_len; n++)
633 isn_bits |= (1U << CR_CHAN(cmd->chanlist[n])); 634 isn_bits |= (1U << CR_CHAN(cmd->chanlist[n]));
634 }
635 } 635 }
636 isn_bits &= subpriv->valid_isns; 636 isn_bits &= subpriv->valid_isns;
637 /* Enable interrupt sources. */ 637 /* Enable interrupt sources. */
638 subpriv->enabled_isns = isn_bits; 638 subpriv->enabled_isns = isn_bits;
639 if (subpriv->has_int_sce) { 639 if (subpriv->has_int_sce)
640 outb(isn_bits, subpriv->iobase); 640 outb(isn_bits, subpriv->iobase);
641 }
642 } 641 }
643 642
644 return retval; 643 return retval;
@@ -662,14 +661,13 @@ dio200_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s,
662 661
663 spin_lock_irqsave(&subpriv->spinlock, flags); 662 spin_lock_irqsave(&subpriv->spinlock, flags);
664 s->async->inttrig = 0; 663 s->async->inttrig = 0;
665 if (subpriv->active) { 664 if (subpriv->active)
666 event = dio200_start_intr(dev, s); 665 event = dio200_start_intr(dev, s);
667 } 666
668 spin_unlock_irqrestore(&subpriv->spinlock, flags); 667 spin_unlock_irqrestore(&subpriv->spinlock, flags);
669 668
670 if (event) { 669 if (event)
671 comedi_event(dev, s); 670 comedi_event(dev, s);
672 }
673 671
674 return 1; 672 return 1;
675} 673}
@@ -726,9 +724,8 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
726 * Reenable them NOW to minimize the time they are disabled. 724 * Reenable them NOW to minimize the time they are disabled.
727 */ 725 */
728 cur_enabled = subpriv->enabled_isns; 726 cur_enabled = subpriv->enabled_isns;
729 if (subpriv->has_int_sce) { 727 if (subpriv->has_int_sce)
730 outb(cur_enabled, subpriv->iobase); 728 outb(cur_enabled, subpriv->iobase);
731 }
732 729
733 if (subpriv->active) { 730 if (subpriv->active) {
734 /* 731 /*
@@ -747,9 +744,8 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
747 len = s->async->cmd.chanlist_len; 744 len = s->async->cmd.chanlist_len;
748 for (n = 0; n < len; n++) { 745 for (n = 0; n < len; n++) {
749 ch = CR_CHAN(s->async->cmd.chanlist[n]); 746 ch = CR_CHAN(s->async->cmd.chanlist[n]);
750 if (triggered & (1U << ch)) { 747 if (triggered & (1U << ch))
751 val |= (1U << n); 748 val |= (1U << n);
752 }
753 } 749 }
754 /* Write the scan to the buffer. */ 750 /* Write the scan to the buffer. */
755 if (comedi_buf_put(s->async, val)) { 751 if (comedi_buf_put(s->async, val)) {
@@ -781,9 +777,8 @@ static int dio200_handle_read_intr(struct comedi_device *dev,
781 } 777 }
782 spin_unlock_irqrestore(&subpriv->spinlock, flags); 778 spin_unlock_irqrestore(&subpriv->spinlock, flags);
783 779
784 if (oldevents != s->async->events) { 780 if (oldevents != s->async->events)
785 comedi_event(dev, s); 781 comedi_event(dev, s);
786 }
787 782
788 return (triggered != 0); 783 return (triggered != 0);
789} 784}
@@ -798,9 +793,9 @@ static int dio200_subdev_intr_cancel(struct comedi_device *dev,
798 unsigned long flags; 793 unsigned long flags;
799 794
800 spin_lock_irqsave(&subpriv->spinlock, flags); 795 spin_lock_irqsave(&subpriv->spinlock, flags);
801 if (subpriv->active) { 796 if (subpriv->active)
802 dio200_stop_intr(dev, s); 797 dio200_stop_intr(dev, s);
803 } 798
804 spin_unlock_irqrestore(&subpriv->spinlock, flags); 799 spin_unlock_irqrestore(&subpriv->spinlock, flags);
805 800
806 return 0; 801 return 0;
@@ -846,7 +841,8 @@ dio200_subdev_intr_cmdtest(struct comedi_device *dev,
846 if (err) 841 if (err)
847 return 1; 842 return 1;
848 843
849 /* step 2: make sure trigger sources are unique and mutually compatible */ 844 /* step 2: make sure trigger sources are unique and mutually
845 compatible */
850 846
851 /* these tests are true if more than one _src bit is set */ 847 /* these tests are true if more than one _src bit is set */
852 if ((cmd->start_src & (cmd->start_src - 1)) != 0) 848 if ((cmd->start_src & (cmd->start_src - 1)) != 0)
@@ -952,9 +948,8 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev,
952 } 948 }
953 spin_unlock_irqrestore(&subpriv->spinlock, flags); 949 spin_unlock_irqrestore(&subpriv->spinlock, flags);
954 950
955 if (event) { 951 if (event)
956 comedi_event(dev, s); 952 comedi_event(dev, s);
957 }
958 953
959 return 0; 954 return 0;
960} 955}
@@ -980,9 +975,8 @@ dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s,
980 subpriv->valid_isns = valid_isns; 975 subpriv->valid_isns = valid_isns;
981 spin_lock_init(&subpriv->spinlock); 976 spin_lock_init(&subpriv->spinlock);
982 977
983 if (has_int_sce) { 978 if (has_int_sce)
984 outb(0, subpriv->iobase); /* Disable interrupt sources. */ 979 outb(0, subpriv->iobase); /* Disable interrupt sources. */
985 }
986 980
987 s->private = subpriv; 981 s->private = subpriv;
988 s->type = COMEDI_SUBD_DI; 982 s->type = COMEDI_SUBD_DI;
@@ -1013,10 +1007,7 @@ dio200_subdev_intr_cleanup(struct comedi_device *dev,
1013 struct comedi_subdevice *s) 1007 struct comedi_subdevice *s)
1014{ 1008{
1015 struct dio200_subdev_intr *subpriv = s->private; 1009 struct dio200_subdev_intr *subpriv = s->private;
1016 1010 kfree(subpriv);
1017 if (subpriv) {
1018 kfree(subpriv);
1019 }
1020} 1011}
1021 1012
1022/* 1013/*
@@ -1027,9 +1018,8 @@ static irqreturn_t dio200_interrupt(int irq, void *d)
1027 struct comedi_device *dev = d; 1018 struct comedi_device *dev = d;
1028 int handled; 1019 int handled;
1029 1020
1030 if (!dev->attached) { 1021 if (!dev->attached)
1031 return IRQ_NONE; 1022 return IRQ_NONE;
1032 }
1033 1023
1034 if (devpriv->intr_sd >= 0) { 1024 if (devpriv->intr_sd >= 0) {
1035 handled = dio200_handle_read_intr(dev, 1025 handled = dio200_handle_read_intr(dev,
@@ -1266,10 +1256,7 @@ dio200_subdev_8254_cleanup(struct comedi_device *dev,
1266 struct comedi_subdevice *s) 1256 struct comedi_subdevice *s)
1267{ 1257{
1268 struct dio200_subdev_intr *subpriv = s->private; 1258 struct dio200_subdev_intr *subpriv = s->private;
1269 1259 kfree(subpriv);
1270 if (subpriv) {
1271 kfree(subpriv);
1272 }
1273} 1260}
1274 1261
1275/* 1262/*
@@ -1348,9 +1335,8 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
1348#endif 1335#endif
1349 { 1336 {
1350 ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE); 1337 ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE);
1351 if (ret < 0) { 1338 if (ret < 0)
1352 return ret; 1339 return ret;
1353 }
1354 } 1340 }
1355 dev->iobase = iobase; 1341 dev->iobase = iobase;
1356 1342
@@ -1371,17 +1357,17 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
1371 ret = dio200_subdev_8254_init(dev, s, iobase, 1357 ret = dio200_subdev_8254_init(dev, s, iobase,
1372 layout->sdinfo[n], 1358 layout->sdinfo[n],
1373 layout->has_clk_gat_sce); 1359 layout->has_clk_gat_sce);
1374 if (ret < 0) { 1360 if (ret < 0)
1375 return ret; 1361 return ret;
1376 } 1362
1377 break; 1363 break;
1378 case sd_8255: 1364 case sd_8255:
1379 /* digital i/o subdevice (8255) */ 1365 /* digital i/o subdevice (8255) */
1380 ret = subdev_8255_init(dev, s, 0, 1366 ret = subdev_8255_init(dev, s, 0,
1381 iobase + layout->sdinfo[n]); 1367 iobase + layout->sdinfo[n]);
1382 if (ret < 0) { 1368 if (ret < 0)
1383 return ret; 1369 return ret;
1384 } 1370
1385 break; 1371 break;
1386 case sd_intr: 1372 case sd_intr:
1387 /* 'INTERRUPT' subdevice */ 1373 /* 'INTERRUPT' subdevice */
@@ -1392,9 +1378,9 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
1392 layout->sdinfo[n], 1378 layout->sdinfo[n],
1393 layout-> 1379 layout->
1394 has_int_sce); 1380 has_int_sce);
1395 if (ret < 0) { 1381 if (ret < 0)
1396 return ret; 1382 return ret;
1397 } 1383
1398 devpriv->intr_sd = n; 1384 devpriv->intr_sd = n;
1399 } else { 1385 } else {
1400 s->type = COMEDI_SUBD_UNUSED; 1386 s->type = COMEDI_SUBD_UNUSED;
@@ -1407,9 +1393,8 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
1407 } 1393 }
1408 1394
1409 sdx = devpriv->intr_sd; 1395 sdx = devpriv->intr_sd;
1410 if (sdx >= 0 && sdx < dev->n_subdevices) { 1396 if (sdx >= 0 && sdx < dev->n_subdevices)
1411 dev->read_subdev = &dev->subdevices[sdx]; 1397 dev->read_subdev = &dev->subdevices[sdx];
1412 }
1413 1398
1414 dev->board_name = thisboard->name; 1399 dev->board_name = thisboard->name;
1415 1400
@@ -1434,11 +1419,10 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
1434 printk("(pci %s) ", pci_name(pci_dev)); 1419 printk("(pci %s) ", pci_name(pci_dev));
1435#endif 1420#endif
1436 } 1421 }
1437 if (irq) { 1422 if (irq)
1438 printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); 1423 printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE"));
1439 } else { 1424 else
1440 printk("(no irq) "); 1425 printk("(no irq) ");
1441 }
1442 1426
1443 printk("attached\n"); 1427 printk("attached\n");
1444 1428
@@ -1461,9 +1445,8 @@ static int dio200_detach(struct comedi_device *dev)
1461 printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor, 1445 printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor,
1462 DIO200_DRIVER_NAME); 1446 DIO200_DRIVER_NAME);
1463 1447
1464 if (dev->irq) { 1448 if (dev->irq)
1465 free_irq(dev->irq, dev); 1449 free_irq(dev->irq, dev);
1466 }
1467 if (dev->subdevices) { 1450 if (dev->subdevices) {
1468 layout = thislayout; 1451 layout = thislayout;
1469 for (n = 0; n < dev->n_subdevices; n++) { 1452 for (n = 0; n < dev->n_subdevices; n++) {
@@ -1486,22 +1469,19 @@ static int dio200_detach(struct comedi_device *dev)
1486 if (devpriv) { 1469 if (devpriv) {
1487#ifdef CONFIG_COMEDI_PCI 1470#ifdef CONFIG_COMEDI_PCI
1488 if (devpriv->pci_dev) { 1471 if (devpriv->pci_dev) {
1489 if (dev->iobase) { 1472 if (dev->iobase)
1490 comedi_pci_disable(devpriv->pci_dev); 1473 comedi_pci_disable(devpriv->pci_dev);
1491 }
1492 pci_dev_put(devpriv->pci_dev); 1474 pci_dev_put(devpriv->pci_dev);
1493 } else 1475 } else
1494#endif 1476#endif
1495 { 1477 {
1496 if (dev->iobase) { 1478 if (dev->iobase)
1497 release_region(dev->iobase, DIO200_IO_SIZE); 1479 release_region(dev->iobase, DIO200_IO_SIZE);
1498 }
1499 } 1480 }
1500 } 1481 }
1501 if (dev->board_name) { 1482 if (dev->board_name)
1502 printk(KERN_INFO "comedi%d: %s removed\n", 1483 printk(KERN_INFO "comedi%d: %s removed\n",
1503 dev->minor, dev->board_name); 1484 dev->minor, dev->board_name);
1504 }
1505 1485
1506 return 0; 1486 return 0;
1507} 1487}