staging: comedi: me4000: remove struct me4000_cnt_context
authorH Hartley Sweeten <hartleys@visionengravers.com>
Sat, 8 Sep 2012 00:41:37 +0000 (17:41 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Sep 2012 04:49:56 +0000 (21:49 -0700)
The me4000_cnt_contect simply holds the unsigned long i/o addresses
used to read/write the counter registers. Thes can be calculated
as needed. Remove the struct and the associated field in the
private data.

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>
drivers/staging/comedi/drivers/me4000.c
drivers/staging/comedi/drivers/me4000.h

index bdc060368fe537ca819618efe25d23f5a7c75870..081e509f213b7ffd81add4e08afcee60117c59b6 100644 (file)
@@ -221,7 +221,6 @@ static int init_board_info(struct comedi_device *dev,
 static int init_ao_context(struct comedi_device *dev);
 static int init_ai_context(struct comedi_device *dev);
 static int init_dio_context(struct comedi_device *dev);
-static int init_cnt_context(struct comedi_device *dev);
 static int xilinx_download(struct comedi_device *dev);
 static int reset_board(struct comedi_device *dev);
 
@@ -361,15 +360,6 @@ found:
                return result;
        }
 
-       /* Init counter context */
-       result = init_cnt_context(dev);
-       if (result) {
-               printk(KERN_ERR
-                      "comedi%d: me4000: me4000_probe(): "
-                      "Cannot init cnt context\n", dev->minor);
-               return result;
-       }
-
        /* Download the xilinx firmware */
        result = xilinx_download(dev);
        if (result) {
@@ -599,19 +589,6 @@ static int init_dio_context(struct comedi_device *dev)
        return 0;
 }
 
-static int init_cnt_context(struct comedi_device *dev)
-{
-       info->cnt_context.ctrl_reg = info->timer_regbase + ME4000_CNT_CTRL_REG;
-       info->cnt_context.counter_0_reg =
-           info->timer_regbase + ME4000_CNT_COUNTER_0_REG;
-       info->cnt_context.counter_1_reg =
-           info->timer_regbase + ME4000_CNT_COUNTER_1_REG;
-       info->cnt_context.counter_2_reg =
-           info->timer_regbase + ME4000_CNT_COUNTER_2_REG;
-
-       return 0;
-}
-
 #define FIRMWARE_NOT_AVAILABLE 1
 #if FIRMWARE_NOT_AVAILABLE
 extern unsigned char *xilinx_firm;
@@ -1907,19 +1884,19 @@ static int cnt_reset(struct comedi_device *dev, unsigned int channel)
 {
        switch (channel) {
        case 0:
-               outb(0x30, info->cnt_context.ctrl_reg);
-               outb(0x00, info->cnt_context.counter_0_reg);
-               outb(0x00, info->cnt_context.counter_0_reg);
+               outb(0x30, info->timer_regbase + ME4000_CNT_CTRL_REG);
+               outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
+               outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
                break;
        case 1:
-               outb(0x70, info->cnt_context.ctrl_reg);
-               outb(0x00, info->cnt_context.counter_1_reg);
-               outb(0x00, info->cnt_context.counter_1_reg);
+               outb(0x70, info->timer_regbase + ME4000_CNT_CTRL_REG);
+               outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
+               outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
                break;
        case 2:
-               outb(0xB0, info->cnt_context.ctrl_reg);
-               outb(0x00, info->cnt_context.counter_2_reg);
-               outb(0x00, info->cnt_context.counter_2_reg);
+               outb(0xB0, info->timer_regbase + ME4000_CNT_CTRL_REG);
+               outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
+               outb(0x00, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
                break;
        default:
                printk(KERN_ERR
@@ -1981,7 +1958,7 @@ static int cnt_config(struct comedi_device *dev, unsigned int channel,
 
        /* Write the control word */
        tmp |= 0x30;
-       outb(tmp, info->cnt_context.ctrl_reg);
+       outb(tmp, info->timer_regbase + ME4000_CNT_CTRL_REG);
 
        return 0;
 }
@@ -2050,21 +2027,21 @@ static int me4000_cnt_insn_read(struct comedi_device *dev,
 
        switch (insn->chanspec) {
        case 0:
-               tmp = inb(info->cnt_context.counter_0_reg);
+               tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
                data[0] = tmp;
-               tmp = inb(info->cnt_context.counter_0_reg);
+               tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
                data[0] |= tmp << 8;
                break;
        case 1:
-               tmp = inb(info->cnt_context.counter_1_reg);
+               tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
                data[0] = tmp;
-               tmp = inb(info->cnt_context.counter_1_reg);
+               tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
                data[0] |= tmp << 8;
                break;
        case 2:
-               tmp = inb(info->cnt_context.counter_2_reg);
+               tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
                data[0] = tmp;
-               tmp = inb(info->cnt_context.counter_2_reg);
+               tmp = inb(info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
                data[0] |= tmp << 8;
                break;
        default:
@@ -2098,21 +2075,21 @@ static int me4000_cnt_insn_write(struct comedi_device *dev,
        switch (insn->chanspec) {
        case 0:
                tmp = data[0] & 0xFF;
-               outb(tmp, info->cnt_context.counter_0_reg);
+               outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
                tmp = (data[0] >> 8) & 0xFF;
-               outb(tmp, info->cnt_context.counter_0_reg);
+               outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_0_REG);
                break;
        case 1:
                tmp = data[0] & 0xFF;
-               outb(tmp, info->cnt_context.counter_1_reg);
+               outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
                tmp = (data[0] >> 8) & 0xFF;
-               outb(tmp, info->cnt_context.counter_1_reg);
+               outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_1_REG);
                break;
        case 2:
                tmp = data[0] & 0xFF;
-               outb(tmp, info->cnt_context.counter_2_reg);
+               outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
                tmp = (data[0] >> 8) & 0xFF;
-               outb(tmp, info->cnt_context.counter_2_reg);
+               outb(tmp, info->timer_regbase + ME4000_CNT_COUNTER_2_REG);
                break;
        default:
                printk(KERN_ERR
index a6313084b29b7faa16d66d97595b9a19b28bf568..6c03d54c649abd56fb238bc3a77e51cf77f6c99c 100644 (file)
@@ -274,13 +274,6 @@ struct me4000_dio_context {
        unsigned long port_3_reg;
 };
 
-struct me4000_cnt_context {
-       unsigned long ctrl_reg;
-       unsigned long counter_0_reg;
-       unsigned long counter_1_reg;
-       unsigned long counter_2_reg;
-};
-
 struct me4000_info {
        unsigned long plx_regbase;      /*  PLX configuration space base address */
        unsigned long me4000_regbase;   /*  Base address of the ME4000 */
@@ -304,7 +297,6 @@ struct me4000_info {
        struct me4000_ai_context ai_context;    /*  Analog input  specific context */
        struct me4000_ao_context ao_context[4]; /*  Vector with analog output specific context */
        struct me4000_dio_context dio_context;  /*  Digital I/O specific context */
-       struct me4000_cnt_context cnt_context;  /*  Counter specific context */
 };
 
 #define info   ((struct me4000_info *)dev->private)