summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-03-22 09:54:16 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 11:42:59 -0700
commitfbca05d601a94d16912613d119f5b672a75a587f (patch)
tree0195adb50709482d66f4abd93bef8e2705328835
parent463f930401024926eadf4c613a547f2eb41a2882 (diff)
staging: comedi: ni_labpc: cleanup labpc_counter_load() usage
For aesthetic reasons, move the labpc_counter_load() function so it's by the labpc_counter_set_mode() function. Update all the labpc_counter_load() calls so that the I8254_MODE* enums are used instead of the open coded values. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index ba9c97d29398..5782b019697d 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -289,6 +289,20 @@ static const int dma_buffer_size = 0xff00;
/* 2 bytes per sample */
static const int sample_size = 2;
+static int labpc_counter_load(struct comedi_device *dev,
+ unsigned long base_address,
+ unsigned int counter_number,
+ unsigned int count, unsigned int mode)
+{
+ const struct labpc_boardinfo *board = comedi_board(dev);
+
+ if (board->has_mmio)
+ return i8254_mm_load((void __iomem *)base_address, 0,
+ counter_number, count, mode);
+ else
+ return i8254_load(base_address, 0, counter_number, count, mode);
+}
+
static int labpc_counter_set_mode(struct comedi_device *dev,
unsigned long base_address,
unsigned int counter_number,
@@ -855,20 +869,6 @@ static int labpc_ai_cmdtest(struct comedi_device *dev,
return 0;
}
-static int labpc_counter_load(struct comedi_device *dev,
- unsigned long base_address,
- unsigned int counter_number,
- unsigned int count, unsigned int mode)
-{
- const struct labpc_boardinfo *board = comedi_board(dev);
-
- if (board->has_mmio)
- return i8254_mm_load((void __iomem *)base_address, 0,
- counter_number, count, mode);
- else
- return i8254_load(base_address, 0, counter_number, count, mode);
-}
-
static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{
const struct labpc_boardinfo *board = comedi_board(dev);
@@ -900,7 +900,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
* (pc+ manual says this is minimum allowed) using mode 0
*/
ret = labpc_counter_load(dev, dev->iobase + COUNTER_A_BASE_REG,
- 1, 3, 0);
+ 1, 3, I8254_MODE0);
if (ret < 0) {
comedi_error(dev, "error loading counter a1");
return -1;
@@ -961,7 +961,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
labpc_adc_timing(dev, cmd, mode);
/* load counter b0 in mode 3 */
ret = labpc_counter_load(dev, dev->iobase + COUNTER_B_BASE_REG,
- 0, devpriv->divisor_b0, 3);
+ 0, devpriv->divisor_b0, I8254_MODE3);
if (ret < 0) {
comedi_error(dev, "error loading counter b0");
return -1;
@@ -971,7 +971,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
if (labpc_ai_convert_period(cmd, mode)) {
/* load counter a0 in mode 2 */
ret = labpc_counter_load(dev, dev->iobase + COUNTER_A_BASE_REG,
- 0, devpriv->divisor_a0, 2);
+ 0, devpriv->divisor_a0, I8254_MODE2);
if (ret < 0) {
comedi_error(dev, "error loading counter a0");
return -1;
@@ -986,7 +986,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
if (labpc_ai_scan_period(cmd, mode)) {
/* load counter b1 in mode 2 */
ret = labpc_counter_load(dev, dev->iobase + COUNTER_B_BASE_REG,
- 1, devpriv->divisor_b1, 2);
+ 1, devpriv->divisor_b1, I8254_MODE2);
if (ret < 0) {
comedi_error(dev, "error loading counter b1");
return -1;