staging: comedi: pcl724: remove subdevice pointer math
Convert the comedi_subdevice access from pointer math to array access. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
af77727a2b
commit
d533ef070d
1 changed files with 9 additions and 6 deletions
|
@ -99,6 +99,7 @@ static int subdev_8255mapped_cb(int dir, int port, int data,
|
||||||
static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||||
{
|
{
|
||||||
const struct pcl724_board *board = comedi_board(dev);
|
const struct pcl724_board *board = comedi_board(dev);
|
||||||
|
struct comedi_subdevice *s;
|
||||||
unsigned long iobase;
|
unsigned long iobase;
|
||||||
unsigned int iorange;
|
unsigned int iorange;
|
||||||
int ret, i, n_subdevices;
|
int ret, i, n_subdevices;
|
||||||
|
@ -161,14 +162,13 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 0; i < dev->n_subdevices; i++) {
|
for (i = 0; i < dev->n_subdevices; i++) {
|
||||||
|
s = &dev->subdevices[i];
|
||||||
if (board->is_pet48) {
|
if (board->is_pet48) {
|
||||||
subdev_8255_init(dev, dev->subdevices + i,
|
subdev_8255_init(dev, s, subdev_8255mapped_cb,
|
||||||
subdev_8255mapped_cb,
|
|
||||||
(unsigned long)(dev->iobase +
|
(unsigned long)(dev->iobase +
|
||||||
i * 0x1000));
|
i * 0x1000));
|
||||||
} else
|
} else
|
||||||
subdev_8255_init(dev, dev->subdevices + i,
|
subdev_8255_init(dev, s, subdev_8255_cb,
|
||||||
subdev_8255_cb,
|
|
||||||
(unsigned long)(dev->iobase +
|
(unsigned long)(dev->iobase +
|
||||||
SIZE_8255 * i));
|
SIZE_8255 * i));
|
||||||
}
|
}
|
||||||
|
@ -179,10 +179,13 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||||
static void pcl724_detach(struct comedi_device *dev)
|
static void pcl724_detach(struct comedi_device *dev)
|
||||||
{
|
{
|
||||||
const struct pcl724_board *board = comedi_board(dev);
|
const struct pcl724_board *board = comedi_board(dev);
|
||||||
|
struct comedi_subdevice *s;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < dev->n_subdevices; i++)
|
for (i = 0; i < dev->n_subdevices; i++) {
|
||||||
subdev_8255_cleanup(dev, dev->subdevices + i);
|
s = &dev->subdevices[i];
|
||||||
|
subdev_8255_cleanup(dev, s);
|
||||||
|
}
|
||||||
#ifdef PCL724_IRQ
|
#ifdef PCL724_IRQ
|
||||||
if (dev->irq)
|
if (dev->irq)
|
||||||
free_irq(dev->irq, dev);
|
free_irq(dev->irq, dev);
|
||||||
|
|
Loading…
Reference in a new issue