Skip to content

Commit a40ba84

Browse files
mkaehlckeLinus Torvalds
authored andcommitted
MBCS: convert algolock to mutex
MBCS: Convert the semaphore algolock to the mutex API Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 92df5c3 commit a40ba84

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎drivers/char/mbcs.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/device.h>
2424
#include <linux/mm.h>
2525
#include <linux/uio.h>
26+
#include <linux/mutex.h>
2627
#include <asm/io.h>
2728
#include <asm/uaccess.h>
2829
#include <asm/system.h>
@@ -281,7 +282,7 @@ static inline int mbcs_algo_start(struct mbcs_soft *soft)
281282
void *mmr_base = soft->mmr_base;
282283
union cm_control cm_control;
283284

284-
if (down_interruptible(&soft->algolock))
285+
if (mutex_lock_interruptible(&soft->algolock))
285286
return -ERESTARTSYS;
286287

287288
atomic_set(&soft->algo_done, 0);
@@ -298,7 +299,7 @@ static inline int mbcs_algo_start(struct mbcs_soft *soft)
298299
cm_control.alg_go = 1;
299300
MBCS_MMR_SET(mmr_base, MBCS_CM_CONTROL, cm_control.cm_control_reg);
300301

301-
up(&soft->algolock);
302+
mutex_unlock(&soft->algolock);
302303

303304
return 0;
304305
}
@@ -764,7 +765,7 @@ static int mbcs_probe(struct cx_dev *dev, const struct cx_device_id *id)
764765

765766
init_MUTEX(&soft->dmawritelock);
766767
init_MUTEX(&soft->dmareadlock);
767-
init_MUTEX(&soft->algolock);
768+
mutex_init(&soft->algolock);
768769

769770
mbcs_getdma_init(&soft->getdma);
770771
mbcs_putdma_init(&soft->putdma);

‎drivers/char/mbcs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ struct mbcs_soft {
539539
atomic_t algo_done;
540540
struct semaphore dmawritelock;
541541
struct semaphore dmareadlock;
542-
struct semaphore algolock;
542+
struct mutex algolock;
543543
};
544544

545545
static int mbcs_open(struct inode *ip, struct file *fp);

0 commit comments

Comments
 (0)