diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-06-10 17:16:15 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-12 00:16:46 (GMT) |
commit | 57aade1daebfdabf0028a13857dc8e85558e1c25 (patch) | |
tree | 4b6d85103b14a77a24783f3fea9d670e8d42bd2b /drivers/staging/comedi | |
parent | 84f7db9d8f9ee9bcee16143aab93b68b43e7e5cc (diff) | |
download | linux-fsl-qoriq-57aade1daebfdabf0028a13857dc8e85558e1c25.tar.xz |
staging: comedi: pcl724: tidy up pcl724_attach()
Consolidate the special handling of the 'hoard->can_have96' flag.
This flag overrides the iorange and n_subdevices for the PCL-724
board when it is used in a 96 DIO configuration.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi')
-rw-r--r-- | drivers/staging/comedi/drivers/pcl724.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/staging/comedi/drivers/pcl724.c b/drivers/staging/comedi/drivers/pcl724.c index 5391294..329aa9a 100644 --- a/drivers/staging/comedi/drivers/pcl724.c +++ b/drivers/staging/comedi/drivers/pcl724.c @@ -111,27 +111,31 @@ static int pcl724_8255mapped_io(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); struct comedi_subdevice *s; unsigned long iobase; unsigned int iorange; - int ret, i, n_subdevices; + int n_subdevices; + int ret; + int i; iorange = board->io_range; - if ((board->can_have96) && - ((it->options[1] == 1) || (it->options[1] == 96))) - iorange = 0x10; /* PCL-724 in 96 DIO configuration */ + n_subdevices = board->numofports; + + /* Handle PCL-724 in 96 DIO configuration */ + if (board->can_have96 && + (it->options[1] == 1 || it->options[1] == 96)) { + iorange = 0x10; + n_subdevices = 4; + } + ret = comedi_request_region(dev, it->options[0], iorange); if (ret) return ret; - n_subdevices = board->numofports; - if ((board->can_have96) && ((it->options[1] == 1) - || (it->options[1] == 96))) - n_subdevices = 4; /* PCL-724 in 96 DIO configuration */ - ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret) return ret; |