Skip to content

Commit

Permalink
staging: comedi: comedi_pcmcia: allow drivers to use a custom conf_ch…
Browse files Browse the repository at this point in the history
…eck()

Allow comedi pcmcia drivers to use a custom conf_check() when calling
comedi_pcmcia_enable() to enable the pcmcia device. If a conf_check()
is not passed the internal comedi_pcmcia_conf_check() will be used.

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>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Feb 6, 2013
1 parent 4f60f6b commit a3ac951
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
9 changes: 7 additions & 2 deletions drivers/staging/comedi/comedi_pcmcia.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,25 @@ static int comedi_pcmcia_conf_check(struct pcmcia_device *link,
/**
* comedi_pcmcia_enable() - Request the regions and enable the PCMCIA device.
* @dev: comedi_device struct
* @conf_check: optional callback to check the pcmcia_device configuration
*
* The comedi PCMCIA driver needs to set the link->config_flags, as
* appropriate for that driver, before calling this function in order
* to allow pcmcia_loop_config() to do its internal autoconfiguration.
*/
int comedi_pcmcia_enable(struct comedi_device *dev)
int comedi_pcmcia_enable(struct comedi_device *dev,
int (*conf_check)(struct pcmcia_device *, void *))
{
struct pcmcia_device *link = comedi_to_pcmcia_dev(dev);
int ret;

if (!link)
return -ENODEV;

ret = pcmcia_loop_config(link, comedi_pcmcia_conf_check, NULL);
if (!conf_check)
conf_check = comedi_pcmcia_conf_check;

ret = pcmcia_loop_config(link, conf_check, NULL);
if (ret)
return ret;

Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/comedi/comedidev.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ struct pcmcia_device;

struct pcmcia_device *comedi_to_pcmcia_dev(struct comedi_device *);

int comedi_pcmcia_enable(struct comedi_device *);
int comedi_pcmcia_enable(struct comedi_device *,
int (*conf_check)(struct pcmcia_device *, void *));
void comedi_pcmcia_disable(struct comedi_device *);

int comedi_pcmcia_auto_config(struct pcmcia_device *, struct comedi_driver *);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers/cb_das16_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ static int das16cs_auto_attach(struct comedi_device *dev,
dev->board_name = board->name;

link->config_flags |= CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
ret = comedi_pcmcia_enable(dev);
ret = comedi_pcmcia_enable(dev, NULL);
if (ret)
return ret;
dev->iobase = link->resource[0]->start;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers/das08_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static int das08_cs_auto_attach(struct comedi_device *dev,
dev->board_ptr = &das08_cs_boards[0];

link->config_flags |= CONF_AUTO_SET_IO;
ret = comedi_pcmcia_enable(dev);
ret = comedi_pcmcia_enable(dev, NULL);
if (ret)
return ret;
iobase = link->resource[0]->start;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers/ni_daq_700.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static int daq700_auto_attach(struct comedi_device *dev,
dev->board_name = dev->driver->driver_name;

link->config_flags |= CONF_AUTO_SET_IO;
ret = comedi_pcmcia_enable(dev);
ret = comedi_pcmcia_enable(dev, NULL);
if (ret)
return ret;
dev->iobase = link->resource[0]->start;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers/ni_daq_dio24.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static int dio24_auto_attach(struct comedi_device *dev,
dev->board_name = dev->driver->driver_name;

link->config_flags |= CONF_AUTO_SET_IO;
ret = comedi_pcmcia_enable(dev);
ret = comedi_pcmcia_enable(dev, NULL);
return ret;
dev->iobase = link->resource[0]->start;

Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers/ni_labpc_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static int labpc_auto_attach(struct comedi_device *dev,

link->config_flags |= CONF_AUTO_SET_IO |
CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ;
ret = comedi_pcmcia_enable(dev);
ret = comedi_pcmcia_enable(dev, NULL);
if (ret)
return ret;
dev->iobase = link->resource[0]->start;
Expand Down

0 comments on commit a3ac951

Please sign in to comment.