Commit 66f516e6 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: adv_pci_dio: use the diosubd_data 'addr' for di/do s->private

Currently the di/do subdevices store a pointer to the diosubd_data in s->private.
The (*insn_bits) functions then use that to get to the 'addr' needed to access
the registers.

The only member of diosubd_data that is needed by the (*insn_bits) functions is
the 'addr'. For aesthetics, just store the 'addr' in s->private.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 039c5c1b
...@@ -128,7 +128,7 @@ enum hw_cards_id { ...@@ -128,7 +128,7 @@ enum hw_cards_id {
struct diosubd_data { struct diosubd_data {
int chans; /* num of chans or 8255 devices */ int chans; /* num of chans or 8255 devices */
int addr; /* PCI address ofset */ unsigned long addr; /* PCI address ofset */
}; };
struct dio_boardtype { struct dio_boardtype {
...@@ -261,8 +261,8 @@ static int pci_dio_insn_bits_di_b(struct comedi_device *dev, ...@@ -261,8 +261,8 @@ static int pci_dio_insn_bits_di_b(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
const struct diosubd_data *d = (const struct diosubd_data *)s->private; unsigned long reg = (unsigned long)s->private;
unsigned long iobase = dev->iobase + d->addr; unsigned long iobase = dev->iobase + reg;
data[1] = inb(iobase); data[1] = inb(iobase);
if (s->n_chan > 8) if (s->n_chan > 8)
...@@ -280,8 +280,8 @@ static int pci_dio_insn_bits_di_w(struct comedi_device *dev, ...@@ -280,8 +280,8 @@ static int pci_dio_insn_bits_di_w(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
const struct diosubd_data *d = (const struct diosubd_data *)s->private; unsigned long reg = (unsigned long)s->private;
unsigned long iobase = dev->iobase + d->addr; unsigned long iobase = dev->iobase + reg;
data[1] = inw(iobase); data[1] = inw(iobase);
if (s->n_chan > 16) if (s->n_chan > 16)
...@@ -295,8 +295,8 @@ static int pci_dio_insn_bits_do_b(struct comedi_device *dev, ...@@ -295,8 +295,8 @@ static int pci_dio_insn_bits_do_b(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
const struct diosubd_data *d = (const struct diosubd_data *)s->private; unsigned long reg = (unsigned long)s->private;
unsigned long iobase = dev->iobase + d->addr; unsigned long iobase = dev->iobase + reg;
if (comedi_dio_update_state(s, data)) { if (comedi_dio_update_state(s, data)) {
outb(s->state & 0xff, iobase); outb(s->state & 0xff, iobase);
...@@ -318,8 +318,8 @@ static int pci_dio_insn_bits_do_w(struct comedi_device *dev, ...@@ -318,8 +318,8 @@ static int pci_dio_insn_bits_do_w(struct comedi_device *dev,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
const struct diosubd_data *d = (const struct diosubd_data *)s->private; unsigned long reg = (unsigned long)s->private;
unsigned long iobase = dev->iobase + d->addr; unsigned long iobase = dev->iobase + reg;
if (comedi_dio_update_state(s, data)) { if (comedi_dio_update_state(s, data)) {
outw(s->state & 0xffff, iobase); outw(s->state & 0xffff, iobase);
...@@ -505,7 +505,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev, ...@@ -505,7 +505,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev,
s->insn_bits = board->is_16bit s->insn_bits = board->is_16bit
? pci_dio_insn_bits_di_w ? pci_dio_insn_bits_di_w
: pci_dio_insn_bits_di_b; : pci_dio_insn_bits_di_b;
s->private = (void *)d; s->private = (void *)d->addr;
} }
} }
...@@ -521,7 +521,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev, ...@@ -521,7 +521,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev,
s->insn_bits = board->is_16bit s->insn_bits = board->is_16bit
? pci_dio_insn_bits_do_w ? pci_dio_insn_bits_do_w
: pci_dio_insn_bits_do_b; : pci_dio_insn_bits_do_b;
s->private = (void *)d; s->private = (void *)d->addr;
} }
} }
...@@ -546,7 +546,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev, ...@@ -546,7 +546,7 @@ static int pci_dio_auto_attach(struct comedi_device *dev,
s->range_table = &range_digital; s->range_table = &range_digital;
s->insn_bits = board->is_16bit ? pci_dio_insn_bits_di_w s->insn_bits = board->is_16bit ? pci_dio_insn_bits_di_w
: pci_dio_insn_bits_di_b; : pci_dio_insn_bits_di_b;
s->private = (void *)d; s->private = (void *)d->addr;
} }
if (board->timer_regbase) { if (board->timer_regbase) {
......
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