aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorAlessio Igor Bogani <abogani@texware.it>2010-05-18 07:12:32 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-18 17:53:17 -0400
commit7ec52ed25013533248d929d4405225d30c4272b2 (patch)
tree99ed8331386f46fd927073f2dbca2bf30c14f0af /drivers/staging
parenta57941c2e7a79d5143a63c06c06be36f786d5241 (diff)
Staging: comedi: quatech_daqp_cs.c Replace eos semaphore with a completion.
Build tested only. Signed-off-by: Alessio Igor Bogani <abogani@texware.it> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/comedi/drivers/quatech_daqp_cs.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index be62face6a71..d77ae81dd128 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -55,6 +55,8 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308
55#include <pcmcia/cisreg.h> 55#include <pcmcia/cisreg.h>
56#include <pcmcia/ds.h> 56#include <pcmcia/ds.h>
57 57
58#include <linux/completion.h>
59
58/* Maximum number of separate DAQP devices we'll allow */ 60/* Maximum number of separate DAQP devices we'll allow */
59#define MAX_DEV 4 61#define MAX_DEV 4
60 62
@@ -67,7 +69,7 @@ struct local_info_t {
67 69
68 enum { semaphore, buffer } interrupt_mode; 70 enum { semaphore, buffer } interrupt_mode;
69 71
70 struct semaphore eos; 72 struct completion eos;
71 73
72 struct comedi_device *dev; 74 struct comedi_device *dev;
73 struct comedi_subdevice *s; 75 struct comedi_subdevice *s;
@@ -238,7 +240,7 @@ static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
238/* Interrupt handler 240/* Interrupt handler
239 * 241 *
240 * Operates in one of two modes. If local->interrupt_mode is 242 * Operates in one of two modes. If local->interrupt_mode is
241 * 'semaphore', just signal the local->eos semaphore and return 243 * 'semaphore', just signal the local->eos completion and return
242 * (one-shot mode). Otherwise (continuous mode), read data in from 244 * (one-shot mode). Otherwise (continuous mode), read data in from
243 * the card, transfer it to the buffer provided by the higher-level 245 * the card, transfer it to the buffer provided by the higher-level
244 * comedi kernel module, and signal various comedi callback routines, 246 * comedi kernel module, and signal various comedi callback routines,
@@ -287,7 +289,7 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id)
287 289
288 case semaphore: 290 case semaphore:
289 291
290 up(&local->eos); 292 complete(&local->eos);
291 break; 293 break;
292 294
293 case buffer: 295 case buffer:
@@ -401,8 +403,7 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
401 return -1; 403 return -1;
402 } 404 }
403 405
404 /* Make sure semaphore is blocked */ 406 init_completion(&local->eos);
405 sema_init(&local->eos, 0);
406 local->interrupt_mode = semaphore; 407 local->interrupt_mode = semaphore;
407 local->dev = dev; 408 local->dev = dev;
408 local->s = s; 409 local->s = s;
@@ -413,9 +414,9 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
413 outb(DAQP_COMMAND_ARM | DAQP_COMMAND_FIFO_DATA, 414 outb(DAQP_COMMAND_ARM | DAQP_COMMAND_FIFO_DATA,
414 dev->iobase + DAQP_COMMAND); 415 dev->iobase + DAQP_COMMAND);
415 416
416 /* Wait for interrupt service routine to unblock semaphore */ 417 /* Wait for interrupt service routine to unblock completion */
417 /* Maybe could use a timeout here, but it's interruptible */ 418 /* Maybe could use a timeout here, but it's interruptible */
418 if (down_interruptible(&local->eos)) 419 if (wait_for_completion_interruptible(&local->eos))
419 return -EINTR; 420 return -EINTR;
420 421
421 data[i] = inb(dev->iobase + DAQP_FIFO); 422 data[i] = inb(dev->iobase + DAQP_FIFO);