From e3dfe34225e0ab57389a518be37b41b0297e24ea Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 5 Sep 2012 18:53:24 -0700 Subject: [PATCH] --- yaml --- r: 324911 b: refs/heads/master c: 0a96639fe702a06ca428323a0cfcf7cabc26f6c7 h: refs/heads/master i: 324909: daa5b9785928f11916caf9e7505ebb9fc91cff1d 324907: 2c564b573409238f0e5ef7d9c635468ee1151da3 324903: 5421eefca7f7b61b0dcff5e81b340a2646d8d7c2 324895: cae48393a9359529178a7fc8316e70007b1dbd57 v: v3 --- [refs] | 2 +- .../drivers/staging/comedi/drivers/pcm3724.c | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/[refs] b/[refs] index 269098d71093..58147f756a0d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9fab612335c0822e0e0a404fdd6d9222b3bfc800 +refs/heads/master: 0a96639fe702a06ca428323a0cfcf7cabc26f6c7 diff --git a/trunk/drivers/staging/comedi/drivers/pcm3724.c b/trunk/drivers/staging/comedi/drivers/pcm3724.c index 62c22ccfb780..4102547dc6a8 100644 --- a/trunk/drivers/staging/comedi/drivers/pcm3724.c +++ b/trunk/drivers/staging/comedi/drivers/pcm3724.c @@ -119,6 +119,8 @@ static int compute_buffer(int config, int devno, struct comedi_subdevice *s) static void do_3724_config(struct comedi_device *dev, struct comedi_subdevice *s, int chanspec) { + struct comedi_subdevice *s_dio1 = &dev->subdevices[0]; + struct comedi_subdevice *s_dio2 = &dev->subdevices[1]; int config; int buffer_config; unsigned long port_8255_cfg; @@ -136,10 +138,10 @@ static void do_3724_config(struct comedi_device *dev, if (!(s->io_bits & 0xff0000)) config |= CR_C_IO; - buffer_config = compute_buffer(0, 0, dev->subdevices); - buffer_config = compute_buffer(buffer_config, 1, (dev->subdevices) + 1); + buffer_config = compute_buffer(0, 0, s_dio1); + buffer_config = compute_buffer(buffer_config, 1, s_dio2); - if (s == dev->subdevices) + if (s == s_dio1) port_8255_cfg = dev->iobase + _8255_CR; else port_8255_cfg = dev->iobase + SIZE_8255 + _8255_CR; @@ -154,6 +156,7 @@ static void do_3724_config(struct comedi_device *dev, static void enable_chan(struct comedi_device *dev, struct comedi_subdevice *s, int chanspec) { + struct comedi_subdevice *s_dio1 = &dev->subdevices[0]; unsigned int mask; int gatecfg; struct priv_pcm3724 *priv; @@ -162,9 +165,9 @@ static void enable_chan(struct comedi_device *dev, struct comedi_subdevice *s, priv = dev->private; mask = 1 << CR_CHAN(chanspec); - if (s == dev->subdevices) /* subdev 0 */ + if (s == s_dio1) priv->dio_1 |= mask; - else /* subdev 1 */ + else priv->dio_2 |= mask; if (priv->dio_1 & 0xff0000) @@ -231,6 +234,7 @@ static int pcm3724_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct pcm3724_board *board = comedi_board(dev); + struct comedi_subdevice *s; unsigned long iobase; unsigned int iorange; int ret, i, n_subdevices; @@ -263,9 +267,10 @@ static int pcm3724_attach(struct comedi_device *dev, return ret; for (i = 0; i < dev->n_subdevices; i++) { - subdev_8255_init(dev, dev->subdevices + i, subdev_8255_cb, + s = &dev->subdevices[i]; + subdev_8255_init(dev, s, subdev_8255_cb, (unsigned long)(dev->iobase + SIZE_8255 * i)); - ((dev->subdevices) + i)->insn_config = subdev_3724_insn_config; + s->insn_config = subdev_3724_insn_config; } return 0; } @@ -273,11 +278,14 @@ static int pcm3724_attach(struct comedi_device *dev, static void pcm3724_detach(struct comedi_device *dev) { const struct pcm3724_board *board = comedi_board(dev); + struct comedi_subdevice *s; int i; if (dev->subdevices) { - for (i = 0; i < dev->n_subdevices; i++) - subdev_8255_cleanup(dev, dev->subdevices + i); + for (i = 0; i < dev->n_subdevices; i++) { + s = &dev->subdevices[i]; + subdev_8255_cleanup(dev, s); + } } if (dev->iobase) release_region(dev->iobase, board->io_range);