Input: input core - semaphore to mutex conversion
Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
parent
02860ab6cd
commit
e676c232e6
|
@ -21,6 +21,7 @@
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
|
|
||||||
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
|
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
|
||||||
MODULE_DESCRIPTION("Input core");
|
MODULE_DESCRIPTION("Input core");
|
||||||
|
@ -224,7 +225,7 @@ int input_open_device(struct input_handle *handle)
|
||||||
struct input_dev *dev = handle->dev;
|
struct input_dev *dev = handle->dev;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = down_interruptible(&dev->sem);
|
err = mutex_lock_interruptible(&dev->mutex);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -236,7 +237,7 @@ int input_open_device(struct input_handle *handle)
|
||||||
if (err)
|
if (err)
|
||||||
handle->open--;
|
handle->open--;
|
||||||
|
|
||||||
up(&dev->sem);
|
mutex_unlock(&dev->mutex);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -255,13 +256,13 @@ void input_close_device(struct input_handle *handle)
|
||||||
|
|
||||||
input_release_device(handle);
|
input_release_device(handle);
|
||||||
|
|
||||||
down(&dev->sem);
|
mutex_lock(&dev->mutex);
|
||||||
|
|
||||||
if (!--dev->users && dev->close)
|
if (!--dev->users && dev->close)
|
||||||
dev->close(dev);
|
dev->close(dev);
|
||||||
handle->open--;
|
handle->open--;
|
||||||
|
|
||||||
up(&dev->sem);
|
mutex_unlock(&dev->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void input_link_handle(struct input_handle *handle)
|
static void input_link_handle(struct input_handle *handle)
|
||||||
|
@ -512,13 +513,13 @@ static ssize_t input_dev_show_##name(struct class_device *dev, char *buf) \
|
||||||
struct input_dev *input_dev = to_input_dev(dev); \
|
struct input_dev *input_dev = to_input_dev(dev); \
|
||||||
int retval; \
|
int retval; \
|
||||||
\
|
\
|
||||||
retval = down_interruptible(&input_dev->sem); \
|
retval = mutex_lock_interruptible(&input_dev->mutex); \
|
||||||
if (retval) \
|
if (retval) \
|
||||||
return retval; \
|
return retval; \
|
||||||
\
|
\
|
||||||
retval = sprintf(buf, "%s\n", input_dev->name ? input_dev->name : ""); \
|
retval = sprintf(buf, "%s\n", input_dev->name ? input_dev->name : ""); \
|
||||||
\
|
\
|
||||||
up(&input_dev->sem); \
|
mutex_unlock(&input_dev->mutex); \
|
||||||
\
|
\
|
||||||
return retval; \
|
return retval; \
|
||||||
} \
|
} \
|
||||||
|
@ -790,7 +791,7 @@ int input_register_device(struct input_dev *dev)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_MUTEX(&dev->sem);
|
mutex_init(&dev->mutex);
|
||||||
set_bit(EV_SYN, dev->evbit);
|
set_bit(EV_SYN, dev->evbit);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -929,7 +929,7 @@ struct input_dev {
|
||||||
|
|
||||||
struct input_handle *grab;
|
struct input_handle *grab;
|
||||||
|
|
||||||
struct semaphore sem; /* serializes open and close operations */
|
struct mutex mutex; /* serializes open and close operations */
|
||||||
unsigned int users;
|
unsigned int users;
|
||||||
|
|
||||||
struct class_device cdev;
|
struct class_device cdev;
|
||||||
|
|
Loading…
Reference in New Issue