From: H Hartley Sweeten Date: Sat, 8 Sep 2012 00:43:21 +0000 (-0700) Subject: staging: comedi: me4000: remove dio context X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=da755d15295ce810130f60e55c9f6fb287ec73b8;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git staging: comedi: me4000: remove dio context The dio context is a struct containing all the register addresses used with the dio subdevice. These can easily be calculated when needed. Remove the me4000_dio_context struct, its intialization function, and it's variable in the private data. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 123732b5841a..b6effb0d460a 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -219,7 +219,6 @@ static int init_board_info(struct comedi_device *dev, struct pci_dev *pci_dev_p); 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 xilinx_download(struct comedi_device *dev); static int reset_board(struct comedi_device *dev); @@ -325,10 +324,6 @@ found: if (result) return result; - result = init_dio_context(dev); - if (result) - return result; - result = xilinx_download(dev); if (result) return result; @@ -483,22 +478,6 @@ static int init_ai_context(struct comedi_device *dev) return 0; } -static int init_dio_context(struct comedi_device *dev) -{ - info->dio_context.dir_reg = dev->iobase + ME4000_DIO_DIR_REG; - info->dio_context.ctrl_reg = dev->iobase + ME4000_DIO_CTRL_REG; - info->dio_context.port_0_reg = - dev->iobase + ME4000_DIO_PORT_0_REG; - info->dio_context.port_1_reg = - dev->iobase + ME4000_DIO_PORT_1_REG; - info->dio_context.port_2_reg = - dev->iobase + ME4000_DIO_PORT_2_REG; - info->dio_context.port_3_reg = - dev->iobase + ME4000_DIO_PORT_3_REG; - - return 0; -} - #define FIRMWARE_NOT_AVAILABLE 1 #if FIRMWARE_NOT_AVAILABLE extern unsigned char *xilinx_firm; @@ -1671,21 +1650,21 @@ static int me4000_dio_insn_bits(struct comedi_device *dev, /* Write out the new digital output lines */ outl((s->state >> 0) & 0xFF, - info->dio_context.port_0_reg); + dev->iobase + ME4000_DIO_PORT_0_REG); outl((s->state >> 8) & 0xFF, - info->dio_context.port_1_reg); + dev->iobase + ME4000_DIO_PORT_1_REG); outl((s->state >> 16) & 0xFF, - info->dio_context.port_2_reg); + dev->iobase + ME4000_DIO_PORT_2_REG); outl((s->state >> 24) & 0xFF, - info->dio_context.port_3_reg); + dev->iobase + ME4000_DIO_PORT_3_REG); } /* On return, data[1] contains the value of the digital input and output lines. */ - data[1] = ((inl(info->dio_context.port_0_reg) & 0xFF) << 0) | - ((inl(info->dio_context.port_1_reg) & 0xFF) << 8) | - ((inl(info->dio_context.port_2_reg) & 0xFF) << 16) | - ((inl(info->dio_context.port_3_reg) & 0xFF) << 24); + data[1] = ((inl(dev->iobase + ME4000_DIO_PORT_0_REG) & 0xFF) << 0) | + ((inl(dev->iobase + ME4000_DIO_PORT_1_REG) & 0xFF) << 8) | + ((inl(dev->iobase + ME4000_DIO_PORT_2_REG) & 0xFF) << 16) | + ((inl(dev->iobase + ME4000_DIO_PORT_3_REG) & 0xFF) << 24); return insn->n; } @@ -1717,7 +1696,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev, * On the ME-4000 it is only possible to switch port wise (8 bit) */ - tmp = inl(info->dio_context.ctrl_reg); + tmp = inl(dev->iobase + ME4000_DIO_CTRL_REG); if (data[0] == INSN_CONFIG_DIO_OUTPUT) { if (chan < 8) { @@ -1731,7 +1710,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev, * If one the first port is a fixed output * port and the second is a fixed input port. */ - if (!inl(info->dio_context.dir_reg)) + if (!inl(dev->iobase + ME4000_DIO_DIR_REG)) return -ENODEV; s->io_bits |= 0xFF00; @@ -1758,7 +1737,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev, * If one the first port is a fixed output * port and the second is a fixed input port. */ - if (!inl(info->dio_context.dir_reg)) + if (!inl(dev->iobase + ME4000_DIO_DIR_REG)) return -ENODEV; s->io_bits &= ~0xFF; @@ -1781,7 +1760,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev, } } - outl(tmp, info->dio_context.ctrl_reg); + outl(tmp, dev->iobase + ME4000_DIO_CTRL_REG); return 1; } @@ -2105,9 +2084,10 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it) * Check for optoisolated ME-4000 version. If one the first * port is a fixed output port and the second is a fixed input port. */ - if (!inl(info->dio_context.dir_reg)) { + if (!inl(dev->iobase + ME4000_DIO_DIR_REG)) { s->io_bits |= 0xFF; - outl(ME4000_DIO_CTRL_BIT_MODE_0, info->dio_context.dir_reg); + outl(ME4000_DIO_CTRL_BIT_MODE_0, + dev->iobase + ME4000_DIO_DIR_REG); } /*========================================================================= diff --git a/drivers/staging/comedi/drivers/me4000.h b/drivers/staging/comedi/drivers/me4000.h index 188e964aef63..c7187f19d3a9 100644 --- a/drivers/staging/comedi/drivers/me4000.h +++ b/drivers/staging/comedi/drivers/me4000.h @@ -265,15 +265,6 @@ struct me4000_ai_context { unsigned long sample_counter_reg; }; -struct me4000_dio_context { - unsigned long dir_reg; - unsigned long ctrl_reg; - unsigned long port_0_reg; - unsigned long port_1_reg; - unsigned long port_2_reg; - unsigned long port_3_reg; -}; - struct me4000_info { unsigned long plx_regbase; /* PLX configuration space base address */ unsigned long timer_regbase; /* Base address of the timer circuit */ @@ -290,7 +281,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 */ }; #define info ((struct me4000_info *)dev->private)