Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354360
b: refs/heads/master
c: ddb2d0a
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Feb 4, 2013
1 parent 86bc8e2 commit 9c213c8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e44adfdb6740f5673612a3060b8d3120ccafd5d1
refs/heads/master: ddb2d0a0185583b268dfe0a32e2f70ee2f118bd0
46 changes: 46 additions & 0 deletions trunk/drivers/staging/comedi/comedi_pcmcia.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,52 @@ struct pcmcia_device *comedi_to_pcmcia_dev(struct comedi_device *dev)
}
EXPORT_SYMBOL_GPL(comedi_to_pcmcia_dev);

static int comedi_pcmcia_conf_check(struct pcmcia_device *link,
void *priv_data)
{
if (link->config_index == 0)
return -EINVAL;

return pcmcia_request_io(link);
}

/**
* comedi_pcmcia_enable() - Request the regions and enable the PCMCIA device.
* @dev: comedi_device struct
*
* 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)
{
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 (ret)
return ret;

return pcmcia_enable_device(link);
}
EXPORT_SYMBOL_GPL(comedi_pcmcia_enable);

/**
* comedi_pcmcia_disable() - Disable the PCMCIA device and release the regions.
* @dev: comedi_device struct
*/
void comedi_pcmcia_disable(struct comedi_device *dev)
{
struct pcmcia_device *link = comedi_to_pcmcia_dev(dev);

if (link)
pcmcia_disable_device(link);
}
EXPORT_SYMBOL_GPL(comedi_pcmcia_disable);

/**
* comedi_pcmcia_auto_config() - Configure/probe a comedi PCMCIA driver.
* @link: pcmcia_device struct
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/staging/comedi/comedidev.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ struct pcmcia_device;

struct pcmcia_device *comedi_to_pcmcia_dev(struct comedi_device *);

int comedi_pcmcia_enable(struct comedi_device *);
void comedi_pcmcia_disable(struct comedi_device *);

int comedi_pcmcia_auto_config(struct pcmcia_device *, struct comedi_driver *);
void comedi_pcmcia_auto_unconfig(struct pcmcia_device *);

Expand Down

0 comments on commit 9c213c8

Please sign in to comment.