Commit b4ae23ce authored by Gustavo Silva's avatar Gustavo Silva Committed by Greg Kroah-Hartman

Staging: comedi: drivers: fix coding style issues in das08.c

This is a patch to the das08.c file that fixes up the following issues
found by the checkpatch.pl tool.

WARNING: line over 80 characters x 6
ERROR: code indent should use tabs where possible x 3
ERROR: spaces required around that '?' (ctx:VxV) x 4
ERROR: spaces required around that ':' (ctx:VxV) x 4
ERROR: that open brace { should be on the previous line x 1
WARNING: printk() should include KERN_ facility level x 9
WARNING: braces {} are not necessary for single statement blocks x 1
WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable x 2
Signed-off-by: default avatarGustavo Silva <silvagustavo@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3c0d681e
/* /*
comedi/drivers/das08.c * comedi/drivers/das08.c
DAS08 driver * DAS08 driver
*
COMEDI - Linux Control and Measurement Device Interface * COMEDI - Linux Control and Measurement Device Interface
Copyright (C) 2000 David A. Schleef <ds@schleef.org> * Copyright (C) 2000 David A. Schleef <ds@schleef.org>
Copyright (C) 2001,2002,2003 Frank Mori Hess <fmhess@users.sourceforge.net> * Copyright (C) 2001,2002,2003 Frank Mori Hess <fmhess@users.sourceforge.net>
Copyright (C) 2004 Salvador E. Tropea <set@users.sf.net> <set@ieee.org> * Copyright (C) 2004 Salvador E. Tropea <set@users.sf.net> <set@ieee.org>
*
This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. * (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
***************************************************************** *****************************************************************
*/
*/
/* /*
Driver: das08 * Driver: das08
Description: DAS-08 compatible boards * Description: DAS-08 compatible boards
Author: Warren Jasper, ds, Frank Hess * Author: Warren Jasper, ds, Frank Hess
Devices: [Keithley Metrabyte] DAS08 (isa-das08), [ComputerBoards] DAS08 (isa-das08), * Devices: [Keithley Metrabyte] DAS08 (isa-das08),
DAS08-PGM (das08-pgm), * [ComputerBoards] DAS08 (isa-das08), DAS08-PGM (das08-pgm),
DAS08-PGH (das08-pgh), DAS08-PGL (das08-pgl), DAS08-AOH (das08-aoh), * DAS08-PGH (das08-pgh), DAS08-PGL (das08-pgl), DAS08-AOH (das08-aoh),
DAS08-AOL (das08-aol), DAS08-AOM (das08-aom), DAS08/JR-AO (das08/jr-ao), * DAS08-AOL (das08-aol), DAS08-AOM (das08-aom), DAS08/JR-AO (das08/jr-ao),
DAS08/JR-16-AO (das08jr-16-ao), PCI-DAS08 (das08), * DAS08/JR-16-AO (das08jr-16-ao), PCI-DAS08 (das08),
PC104-DAS08 (pc104-das08), DAS08/JR/16 (das08jr/16) * PC104-DAS08 (pc104-das08), DAS08/JR/16 (das08jr/16)
Status: works * Status: works
*
This is a rewrite of the das08 and das08jr drivers. * This is a rewrite of the das08 and das08jr drivers.
*
Options (for ISA cards): * Options (for ISA cards):
[0] - base io address * [0] - base io address
*
Options (for pci-das08): * Options (for pci-das08):
[0] - bus (optional) * [0] - bus (optional)
[1] = slot (optional) * [1] = slot (optional)
*
The das08 driver doesn't support asynchronous commands, since * The das08 driver doesn't support asynchronous commands, since
the cheap das08 hardware doesn't really support them. The * the cheap das08 hardware doesn't really support them. The
comedi_rt_timer driver can be used to emulate commands for this * comedi_rt_timer driver can be used to emulate commands for this
driver. * driver.
*/ */
#include "../comedidev.h" #include "../comedidev.h"
...@@ -122,8 +122,8 @@ driver. ...@@ -122,8 +122,8 @@ driver.
*/ */
#define DAS08JR_DIO 3 #define DAS08JR_DIO 3
#define DAS08JR_AO_LSB(x) ((x)?6:4) #define DAS08JR_AO_LSB(x) ((x) ? 6 : 4)
#define DAS08JR_AO_MSB(x) ((x)?7:5) #define DAS08JR_AO_MSB(x) ((x) ? 7 : 5)
/* /*
cio-das08_aox.pdf cio-das08_aox.pdf
...@@ -148,8 +148,8 @@ driver. ...@@ -148,8 +148,8 @@ driver.
#define DAS08AO_GAIN_CONTROL 3 #define DAS08AO_GAIN_CONTROL 3
#define DAS08AO_GAIN_STATUS 3 #define DAS08AO_GAIN_STATUS 3
#define DAS08AO_AO_LSB(x) ((x)?0xa:8) #define DAS08AO_AO_LSB(x) ((x) ? 0xa : 8)
#define DAS08AO_AO_MSB(x) ((x)?0xb:9) #define DAS08AO_AO_MSB(x) ((x) ? 0xb : 9)
#define DAS08AO_AO_UPDATE 8 #define DAS08AO_AO_UPDATE 8
/* gainlist same as _pgx_ below */ /* gainlist same as _pgx_ below */
...@@ -239,8 +239,9 @@ static const struct comedi_lrange *const das08_ai_lranges[] = { ...@@ -239,8 +239,9 @@ static const struct comedi_lrange *const das08_ai_lranges[] = {
&range_das08_pgm, &range_das08_pgm,
}; };
static const int das08_pgh_gainlist[] = static const int das08_pgh_gainlist[] = {
{ 8, 0, 10, 2, 12, 4, 14, 6, 1, 3, 5, 7 }; 8, 0, 10, 2, 12, 4, 14, 6, 1, 3, 5, 7
};
static const int das08_pgl_gainlist[] = { 8, 0, 2, 4, 6, 1, 3, 5, 7 }; static const int das08_pgl_gainlist[] = { 8, 0, 2, 4, 6, 1, 3, 5, 7 };
static const int das08_pgm_gainlist[] = { 8, 0, 10, 12, 14, 9, 11, 13, 15 }; static const int das08_pgm_gainlist[] = { 8, 0, 10, 12, 14, 9, 11, 13, 15 };
...@@ -535,7 +536,8 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -535,7 +536,8 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
inb(dev->iobase + DAS08_MSB); inb(dev->iobase + DAS08_MSB);
/* set multiplexer */ /* set multiplexer */
spin_lock(&dev->spinlock); /* lock to prevent race with digital output */ /* lock to prevent race with digital output */
spin_lock(&dev->spinlock);
devpriv->do_mux_bits &= ~DAS08_MUX_MASK; devpriv->do_mux_bits &= ~DAS08_MUX_MASK;
devpriv->do_mux_bits |= DAS08_MUX(chan); devpriv->do_mux_bits |= DAS08_MUX(chan);
outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL); outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL);
...@@ -552,7 +554,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -552,7 +554,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
/* clear over-range bits for 16-bit boards */ /* clear over-range bits for 16-bit boards */
if (thisboard->ai_nbits == 16) if (thisboard->ai_nbits == 16)
if (inb(dev->iobase + DAS08_MSB) & 0x80) if (inb(dev->iobase + DAS08_MSB) & 0x80)
printk("das08: over-range\n"); printk(KERN_INFO "das08: over-range\n");
/* trigger conversion */ /* trigger conversion */
outb_p(0, dev->iobase + DAS08_TRIG_12BIT); outb_p(0, dev->iobase + DAS08_TRIG_12BIT);
...@@ -562,7 +564,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -562,7 +564,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
break; break;
} }
if (i == TIMEOUT) { if (i == TIMEOUT) {
printk("das08: timeout\n"); printk(KERN_ERR "das08: timeout\n");
return -ETIME; return -ETIME;
} }
msb = inb(dev->iobase + DAS08_MSB); msb = inb(dev->iobase + DAS08_MSB);
...@@ -607,7 +609,8 @@ static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -607,7 +609,8 @@ static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s,
/* set new bit values */ /* set new bit values */
wbits |= data[0] & data[1]; wbits |= data[0] & data[1];
/* remember digital output bits */ /* remember digital output bits */
spin_lock(&dev->spinlock); /* prevent race with setting of analog input mux */ /* prevent race with setting of analog input mux */
spin_lock(&dev->spinlock);
devpriv->do_mux_bits &= ~DAS08_DO_MASK; devpriv->do_mux_bits &= ~DAS08_DO_MASK;
devpriv->do_mux_bits |= DAS08_OP(wbits); devpriv->do_mux_bits |= DAS08_OP(wbits);
outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL); outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL);
...@@ -860,9 +863,9 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) ...@@ -860,9 +863,9 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
/* allocate ioports for non-pcmcia, non-pci boards */ /* allocate ioports for non-pcmcia, non-pci boards */
if ((thisboard->bustype != pcmcia) && (thisboard->bustype != pci)) { if ((thisboard->bustype != pcmcia) && (thisboard->bustype != pci)) {
printk(" iobase 0x%lx\n", iobase); printk(KERN_INFO " iobase 0x%lx\n", iobase);
if (!request_region(iobase, thisboard->iosize, DRV_NAME)) { if (!request_region(iobase, thisboard->iosize, DRV_NAME)) {
printk(" I/O port conflict\n"); printk(KERN_ERR " I/O port conflict\n");
return -EIO; return -EIO;
} }
} }
...@@ -878,8 +881,11 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) ...@@ -878,8 +881,11 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
/* ai */ /* ai */
if (thisboard->ai) { if (thisboard->ai) {
s->type = COMEDI_SUBD_AI; s->type = COMEDI_SUBD_AI;
/* XXX some boards actually have differential inputs instead of single ended. /* XXX some boards actually have differential
* The driver does nothing with arefs though, so it's no big deal. */ * inputs instead of single ended.
* The driver does nothing with arefs though,
* so it's no big deal.
*/
s->subdev_flags = SDF_READABLE | SDF_GROUND; s->subdev_flags = SDF_READABLE | SDF_GROUND;
s->n_chan = 8; s->n_chan = 8;
s->maxdata = (1 << thisboard->ai_nbits) - 1; s->maxdata = (1 << thisboard->ai_nbits) - 1;
...@@ -966,6 +972,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) ...@@ -966,6 +972,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(das08_common_attach);
static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{ {
...@@ -980,7 +987,7 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -980,7 +987,7 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (ret < 0) if (ret < 0)
return ret; return ret;
printk("comedi%d: das08: ", dev->minor); printk(KERN_INFO "comedi%d: das08: ", dev->minor);
/* deal with a pci board */ /* deal with a pci board */
if (thisboard->bustype == pci) { if (thisboard->bustype == pci) {
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_PCI
...@@ -1007,20 +1014,21 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1007,20 +1014,21 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
} }
} }
if (!pdev) { if (!pdev) {
printk("No pci das08 cards found\n"); printk(KERN_ERR "No pci das08 cards found\n");
return -EIO; return -EIO;
} }
devpriv->pdev = pdev; devpriv->pdev = pdev;
/* enable PCI device and reserve I/O spaces */ /* enable PCI device and reserve I/O spaces */
if (comedi_pci_enable(pdev, DRV_NAME)) { if (comedi_pci_enable(pdev, DRV_NAME)) {
printk printk(KERN_ERR " Error enabling PCI device and "
(" Error enabling PCI device and requesting regions\n"); "requesting regions\n");
return -EIO; return -EIO;
} }
/* read base addresses */ /* read base addresses */
pci_iobase = pci_resource_start(pdev, 1); pci_iobase = pci_resource_start(pdev, 1);
iobase = pci_resource_start(pdev, 2); iobase = pci_resource_start(pdev, 2);
printk("pcibase 0x%lx iobase 0x%lx\n", pci_iobase, iobase); printk(KERN_INFO "pcibase 0x%lx iobase 0x%lx\n",
pci_iobase, iobase);
devpriv->pci_iobase = pci_iobase; devpriv->pci_iobase = pci_iobase;
#if 0 #if 0
/* We could enable to pci-das08's interrupt here to make it possible /* We could enable to pci-das08's interrupt here to make it possible
...@@ -1034,17 +1042,18 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1034,17 +1042,18 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
outw(INTR1_ENABLE | PCI_INTR_ENABLE, pci_iobase + INTCSR); outw(INTR1_ENABLE | PCI_INTR_ENABLE, pci_iobase + INTCSR);
#endif #endif
#else /* CONFIG_COMEDI_PCI */ #else /* CONFIG_COMEDI_PCI */
printk("this driver has not been built with PCI support.\n"); printk(KERN_ERR "this driver has not been built with PCI support.\n");
return -EINVAL; return -EINVAL;
#endif /* CONFIG_COMEDI_PCI */ #endif /* CONFIG_COMEDI_PCI */
} else { } else {
iobase = it->options[0]; iobase = it->options[0];
} }
printk("\n"); printk(KERN_INFO "\n");
return das08_common_attach(dev, iobase); return das08_common_attach(dev, iobase);
} }
int das08_common_detach(struct comedi_device *dev) int das08_common_detach(struct comedi_device *dev)
{ {
printk(KERN_INFO "comedi%d: das08: remove\n", dev->minor); printk(KERN_INFO "comedi%d: das08: remove\n", dev->minor);
...@@ -1060,9 +1069,9 @@ int das08_common_detach(struct comedi_device *dev) ...@@ -1060,9 +1069,9 @@ int das08_common_detach(struct comedi_device *dev)
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_PCI
if (devpriv) { if (devpriv) {
if (devpriv->pdev) { if (devpriv->pdev) {
if (devpriv->pci_iobase) { if (devpriv->pci_iobase)
comedi_pci_disable(devpriv->pdev); comedi_pci_disable(devpriv->pdev);
}
pci_dev_put(devpriv->pdev); pci_dev_put(devpriv->pdev);
} }
} }
...@@ -1070,6 +1079,7 @@ int das08_common_detach(struct comedi_device *dev) ...@@ -1070,6 +1079,7 @@ int das08_common_detach(struct comedi_device *dev)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(das08_common_detach);
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_PCI
COMEDI_PCI_INITCLEANUP(driver_das08, das08_pci_table); COMEDI_PCI_INITCLEANUP(driver_das08, das08_pci_table);
...@@ -1077,8 +1087,6 @@ COMEDI_PCI_INITCLEANUP(driver_das08, das08_pci_table); ...@@ -1077,8 +1087,6 @@ COMEDI_PCI_INITCLEANUP(driver_das08, das08_pci_table);
COMEDI_INITCLEANUP(driver_das08); COMEDI_INITCLEANUP(driver_das08);
#endif #endif
EXPORT_SYMBOL_GPL(das08_common_attach);
EXPORT_SYMBOL_GPL(das08_common_detach);
#ifdef CONFIG_COMEDI_PCMCIA #ifdef CONFIG_COMEDI_PCMCIA
EXPORT_SYMBOL_GPL(das08_cs_boards); EXPORT_SYMBOL_GPL(das08_cs_boards);
#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