#include <linux/poll.h>
#include <linux/list.h>
#include <linux/spinlock.h>
+#include <linux/mutex.h>
#include <asm/uaccess.h>
DECLARE_WAIT_QUEUE_HEAD(retu_user_waitqueue);
/* Semaphore to protect irq subscription sequence */
-static struct semaphore retu_sem;
+static struct mutex retu_mutex;
/* This array specifies RETU register types (read/write/toggle) */
static const u8 retu_access_bits[] = {
{
int ret;
- down(&retu_sem);
+ mutex_lock(&retu_mutex);
if ((retu_irq_subscr != NULL) && (retu_irq_subscr != filp)) {
- up(&retu_sem);
+ mutex_unlock(&retu_mutex);
return -EBUSY;
}
/* Store the file pointer of the first user process registering IRQs */
retu_irq_subscr = filp;
- up(&retu_sem);
+ mutex_unlock(&retu_mutex);
if (retu_irq_bits & (1 << id))
return 0;
retu_irq_block = irq;
spin_lock_init(&retu_irqs_lock);
- sema_init(&retu_sem, 1);
+ mutex_init(&retu_mutex);
/* Request a misc device */
res = misc_register(&retu_device);