Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354376
b: refs/heads/master
c: c127174
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Feb 5, 2013
1 parent ad5db2f commit 456be1c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9c1dcce9c64c2b53042f2cfb730348201d176855
refs/heads/master: c12717423e1c61682fada53193813248095cba44
46 changes: 21 additions & 25 deletions trunk/drivers/staging/comedi/drivers/quatech_daqp_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ struct local_info_t {

struct completion eos;

struct comedi_device *dev;
struct comedi_subdevice *s;
int count;
};

Expand Down Expand Up @@ -169,7 +167,7 @@ static const struct comedi_lrange range_daqp_ai = {

static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{
struct local_info_t *local = s->private;
struct local_info_t *local = dev->private;

if (local->stop)
return -EIO;
Expand All @@ -196,13 +194,13 @@ static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
*/
static enum irqreturn daqp_interrupt(int irq, void *dev_id)
{
struct local_info_t *local = dev_id;
struct comedi_device *dev = local ? local->dev : NULL;
struct comedi_subdevice *s = local ? local->s : NULL;
struct comedi_device *dev = dev_id;
struct local_info_t *local = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
int loop_limit = 10000;
int status;

if (!dev || !dev->attached || !s || s->private != local)
if (!dev->attached)
return IRQ_NONE;

switch (local->interrupt_mode) {
Expand Down Expand Up @@ -270,7 +268,7 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
struct local_info_t *local = s->private;
struct local_info_t *local = dev->private;
int i;
int v;
int counter = 10000;
Expand Down Expand Up @@ -327,8 +325,6 @@ static int daqp_ai_insn_read(struct comedi_device *dev,

init_completion(&local->eos);
local->interrupt_mode = semaphore;
local->dev = dev;
local->s = s;

for (i = 0; i < insn->n; i++) {

Expand Down Expand Up @@ -463,7 +459,7 @@ static int daqp_ai_cmdtest(struct comedi_device *dev,

static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{
struct local_info_t *local = s->private;
struct local_info_t *local = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
int counter;
int scanlist_start_on_every_entry;
Expand Down Expand Up @@ -649,8 +645,6 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
}

local->interrupt_mode = buffer;
local->dev = dev;
local->s = s;

/* Start conversion */
outb(DAQP_COMMAND_ARM | DAQP_COMMAND_FIFO_DATA,
Expand All @@ -665,7 +659,7 @@ static int daqp_ao_insn_write(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
struct local_info_t *local = s->private;
struct local_info_t *local = dev->private;
int d;
unsigned int chan;

Expand All @@ -692,7 +686,7 @@ static int daqp_di_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
struct local_info_t *local = s->private;
struct local_info_t *local = dev->private;

if (local->stop)
return -EIO;
Expand All @@ -708,7 +702,7 @@ static int daqp_do_insn_write(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
struct local_info_t *local = s->private;
struct local_info_t *local = dev->private;

if (local->stop)
return -EIO;
Expand All @@ -732,14 +726,15 @@ static int daqp_auto_attach(struct comedi_device *dev,
local = kzalloc(sizeof(*local), GFP_KERNEL);
if (!local)
return -ENOMEM;
dev->private = local;

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

link->priv = local;
link->priv = dev;
ret = pcmcia_request_irq(link, daqp_interrupt);
if (ret)
return ret;
Expand All @@ -750,7 +745,6 @@ static int daqp_auto_attach(struct comedi_device *dev,

s = &dev->subdevices[0];
dev->read_subdev = s;
s->private = local;
s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ;
s->n_chan = 8;
Expand All @@ -763,7 +757,6 @@ static int daqp_auto_attach(struct comedi_device *dev,
s->cancel = daqp_ai_cancel;

s = &dev->subdevices[1];
s->private = local;
s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITEABLE;
s->n_chan = 2;
Expand All @@ -772,14 +765,12 @@ static int daqp_auto_attach(struct comedi_device *dev,
s->insn_write = daqp_ao_insn_write;

s = &dev->subdevices[2];
s->private = local;
s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE;
s->n_chan = 1;
s->insn_read = daqp_di_insn_read;

s = &dev->subdevices[3];
s->private = local;
s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITEABLE;
s->n_chan = 1;
Expand All @@ -798,18 +789,23 @@ static struct comedi_driver driver_daqp = {

static int daqp_cs_suspend(struct pcmcia_device *link)
{
struct local_info_t *local = link->priv;
struct comedi_device *dev = link->priv;
struct local_info_t *local = dev ? dev->private : NULL;

/* Mark the device as stopped, to block IO until later */
local->stop = 1;
if (local)
local->stop = 1;

return 0;
}

static int daqp_cs_resume(struct pcmcia_device *link)
{
struct local_info_t *local = link->priv;
struct comedi_device *dev = link->priv;
struct local_info_t *local = dev ? dev->private : NULL;

local->stop = 0;
if (local)
local->stop = 0;

return 0;
}
Expand Down

0 comments on commit 456be1c

Please sign in to comment.