All of lore.kernel.org
 help / color / mirror / Atom feed
From: matthias.kaehlcke@gmail.com
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Subject: [patch 1/3] MBCS: Convert algolock to mutex
Date: Wed, 24 Oct 2007 19:09:25 +0200	[thread overview]
Message-ID: <20071024170925.GI9824@traven> (raw)
In-Reply-To: 20071024170049.949862374@gmail.com

[-- Attachment #1: char-mbcs-algolock-to-mutex --]
[-- Type: text/plain, Size: 2066 bytes --]

MBCS: Convert the semaphore algolock to the mutex API

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>

--- kernel.orig/linux-2.6/drivers/char/mbcs.c	2007-10-23 17:37:56.000000000 +0200
+++ kernel/linux-2.6/drivers/char/mbcs.c	2007-10-23 17:40:16.000000000 +0200
@@ -24,6 +24,7 @@
 #include <linux/mm.h>
 #include <linux/fs.h>
 #include <linux/uio.h>
+#include <linux/mutex.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -282,7 +283,7 @@
 	void *mmr_base = soft->mmr_base;
 	union cm_control cm_control;
 
-	if (down_interruptible(&soft->algolock))
+	if (mutex_lock_interruptible(&soft->algolock))
 		return -ERESTARTSYS;
 
 	atomic_set(&soft->algo_done, 0);
@@ -299,7 +300,7 @@
 	cm_control.alg_go = 1;
 	MBCS_MMR_SET(mmr_base, MBCS_CM_CONTROL, cm_control.cm_control_reg);
 
-	up(&soft->algolock);
+	mutex_unlock(&soft->algolock);
 
 	return 0;
 }
@@ -765,7 +766,7 @@
 
 	init_MUTEX(&soft->dmawritelock);
 	init_MUTEX(&soft->dmareadlock);
-	init_MUTEX(&soft->algolock);
+	mutex_init(&soft->algolock);
 
 	mbcs_getdma_init(&soft->getdma);
 	mbcs_putdma_init(&soft->putdma);
Index: kernel/linux-2.6/drivers/char/mbcs.h
===================================================================
--- kernel.orig/linux-2.6/drivers/char/mbcs.h	2007-10-23 17:38:55.000000000 +0200
+++ kernel/linux-2.6/drivers/char/mbcs.h	2007-10-23 17:39:51.000000000 +0200
@@ -539,7 +539,7 @@
 	atomic_t algo_done;
 	struct semaphore dmawritelock;
 	struct semaphore dmareadlock;
-	struct semaphore algolock;
+	struct mutex algolock;
 };
 
 static int mbcs_open(struct inode *ip, struct file *fp);

-- 
Matthias Kaehlcke
Linux Application Developer
Barcelona

              We build too many walls and not enough bridges
                             (Isaac Newton)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

       reply	other threads:[~2007-10-24 17:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20071024170049.949862374@gmail.com>
2007-10-24 17:09 ` matthias.kaehlcke [this message]
2007-10-24 17:09 ` [patch 2/3] MBCS: Convert dmawritelock to mutex matthias.kaehlcke
2007-10-24 17:09 ` [patch 3/3] MBCS: Convert dmareadlock " matthias.kaehlcke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071024170925.GI9824@traven \
    --to=matthias.kaehlcke@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.