diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2013-01-25 17:33:54 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-29 23:08:23 -0500 |
commit | bea5b9035dae264e5da4a8a6aacc8bace0647c35 (patch) | |
tree | 49806c35f7dcbcfd638411ea1f6adb962822f06d | |
parent | 63e563af82e643cc0aaf3409fea2328809f2cf36 (diff) |
staging: comedi: ni_mio_cs: move pcmcia_driver functions
For aesthetic reasons, move all the pcmcia_driver functions so they
are near the pcmcia_driver declaration. This also removes the need
for a couple forward declarations.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/ni_mio_cs.c | 113 |
1 files changed, 54 insertions, 59 deletions
diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index 1099b8b072f1..4043d02bd6ba 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -247,67 +247,8 @@ static void mio_cs_detach(struct comedi_device *dev) free_irq(dev->irq, dev); } -static void mio_cs_config(struct pcmcia_device *link); -static void cs_release(struct pcmcia_device *link); -static void cs_detach(struct pcmcia_device *); - static struct pcmcia_device *cur_dev; -static int cs_attach(struct pcmcia_device *link) -{ - cur_dev = link; - - mio_cs_config(link); - - return 0; -} - -static void cs_release(struct pcmcia_device *link) -{ - pcmcia_disable_device(link); -} - -static void cs_detach(struct pcmcia_device *link) -{ - cs_release(link); -} - -static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) -{ - int base, ret; - - p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; - - for (base = 0x000; base < 0x400; base += 0x20) { - p_dev->resource[0]->start = base; - ret = pcmcia_request_io(p_dev); - if (!ret) - return 0; - } - return -ENODEV; -} - - -static void mio_cs_config(struct pcmcia_device *link) -{ - int ret; - - DPRINTK("mio_cs_config(link=%p)\n", link); - link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; - - ret = pcmcia_loop_config(link, mio_pcmcia_config_loop, NULL); - if (ret) { - dev_warn(&link->dev, "no configuration found\n"); - return; - } - - if (!link->irq) - dev_info(&link->dev, "no IRQ available\n"); - - ret = pcmcia_enable_device(link); -} - static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct ni_private *devpriv; @@ -393,6 +334,60 @@ static int ni_getboardtype(struct comedi_device *dev, return 0; } +static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) +{ + int base, ret; + + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; + + for (base = 0x000; base < 0x400; base += 0x20) { + p_dev->resource[0]->start = base; + ret = pcmcia_request_io(p_dev); + if (!ret) + return 0; + } + return -ENODEV; +} + +static void mio_cs_config(struct pcmcia_device *link) +{ + int ret; + + DPRINTK("mio_cs_config(link=%p)\n", link); + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; + + ret = pcmcia_loop_config(link, mio_pcmcia_config_loop, NULL); + if (ret) { + dev_warn(&link->dev, "no configuration found\n"); + return; + } + + if (!link->irq) + dev_info(&link->dev, "no IRQ available\n"); + + ret = pcmcia_enable_device(link); +} + +static int cs_attach(struct pcmcia_device *link) +{ + cur_dev = link; + + mio_cs_config(link); + + return 0; +} + +static void cs_release(struct pcmcia_device *link) +{ + pcmcia_disable_device(link); +} + +static void cs_detach(struct pcmcia_device *link) +{ + cs_release(link); +} + static const struct pcmcia_device_id ni_mio_cs_ids[] = { PCMCIA_DEVICE_MANF_CARD(0x010b, 0x010d), /* DAQCard-ai-16xe-50 */ PCMCIA_DEVICE_MANF_CARD(0x010b, 0x010c), /* DAQCard-ai-16e-4 */ |