lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1273959602-15465-1-git-send-email-abogani@texware.it>
Date:	Sat, 15 May 2010 23:40:02 +0200
From:	Alessio Igor Bogani <abogani@...ware.it>
To:	Greg Kroah-Hartman <gregkh@...e.de>,
	Dominik Brodowski <linux@...inikbrodowski.net>,
	Bill Pemberton <wfp5p@...ginia.edu>,
	Jiri Kosina <jkosina@...e.cz>,
	Javier Martinez Canillas <martinez.javier@...il.com>
Cc:	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
	Alessio Igor Bogani <abogani@...ware.it>
Subject: [PATCH] Staging: quatech_usb2: Convert eos semaphore to mutex

The eos semaphore is used as a mutex so replace it with a real mutex.

Signed-off-by: Alessio Igor Bogani <abogani@...ware.it>
---
 drivers/staging/comedi/drivers/quatech_daqp_cs.c |   15 ++++++++-------
 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 6e9f482..3076666 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -67,7 +67,7 @@ struct local_info_t {
 
 	enum { semaphore, buffer } interrupt_mode;
 
-	struct semaphore eos;
+	struct mutex eos;
 
 	struct comedi_device *dev;
 	struct comedi_subdevice *s;
@@ -238,7 +238,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 mutex 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,
@@ -287,7 +287,7 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id)
 
 	case semaphore:
 
-		up(&local->eos);
+		mutex_unlock(&local->eos);
 		break;
 
 	case buffer:
@@ -401,8 +401,9 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
 		return -1;
 	}
 
-	/* Make sure semaphore is blocked */
-	sema_init(&local->eos, 0);
+	mutex_init(&local->eos);
+	/* Make sure mutex is blocked */
+	mutex_lock(&local->eos);
 	local->interrupt_mode = semaphore;
 	local->dev = dev;
 	local->s = s;
@@ -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 mutex */
 		/* Maybe could use a timeout here, but it's interruptible */
-		if (down_interruptible(&local->eos))
+		if (mutex_lock_interruptible(&local->eos))
 			return -EINTR;
 
 		data[i] = inb(dev->iobase + DAQP_FIFO);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ