Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197458
b: refs/heads/master
c: 7ec52ed
h: refs/heads/master
v: v3
  • Loading branch information
Alessio Igor Bogani authored and Greg Kroah-Hartman committed May 18, 2010
1 parent b36969f commit 2061f1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 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: a57941c2e7a79d5143a63c06c06be36f786d5241
refs/heads/master: 7ec52ed25013533248d929d4405225d30c4272b2
15 changes: 8 additions & 7 deletions trunk/drivers/staging/comedi/drivers/quatech_daqp_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308
#include <pcmcia/cisreg.h>
#include <pcmcia/ds.h>

#include <linux/completion.h>

/* Maximum number of separate DAQP devices we'll allow */
#define MAX_DEV 4

Expand All @@ -67,7 +69,7 @@ struct local_info_t {

enum { semaphore, buffer } interrupt_mode;

struct semaphore eos;
struct completion eos;

struct comedi_device *dev;
struct comedi_subdevice *s;
Expand Down Expand Up @@ -238,7 +240,7 @@ static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
/* Interrupt handler
*
* Operates in one of two modes. If local->interrupt_mode is
* 'semaphore', just signal the local->eos semaphore and return
* 'semaphore', just signal the local->eos completion and return
* (one-shot mode). Otherwise (continuous mode), read data in from
* the card, transfer it to the buffer provided by the higher-level
* comedi kernel module, and signal various comedi callback routines,
Expand Down Expand Up @@ -287,7 +289,7 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id)

case semaphore:

up(&local->eos);
complete(&local->eos);
break;

case buffer:
Expand Down Expand Up @@ -401,8 +403,7 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
return -1;
}

/* Make sure semaphore is blocked */
sema_init(&local->eos, 0);
init_completion(&local->eos);
local->interrupt_mode = semaphore;
local->dev = dev;
local->s = s;
Expand All @@ -413,9 +414,9 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
outb(DAQP_COMMAND_ARM | DAQP_COMMAND_FIFO_DATA,
dev->iobase + DAQP_COMMAND);

/* Wait for interrupt service routine to unblock semaphore */
/* Wait for interrupt service routine to unblock completion */
/* Maybe could use a timeout here, but it's interruptible */
if (down_interruptible(&local->eos))
if (wait_for_completion_interruptible(&local->eos))
return -EINTR;

data[i] = inb(dev->iobase + DAQP_FIFO);
Expand Down

0 comments on commit 2061f1d

Please sign in to comment.