Input: add semaphore and user count to input_dev structure;

serialize open and close calls and ensure that device's
       open and close methods are only called when first user
       opens it or last user closes it.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
Dmitry Torokhov
2005-05-29 02:29:25 -05:00
parent 58a007765b
commit 0fbf87caf7
2 changed files with 32 additions and 5 deletions

View File

@@ -859,6 +859,10 @@ struct input_dev {
int (*erase_effect)(struct input_dev *dev, int effect_id);
struct input_handle *grab;
struct semaphore sem; /* serializes open and close operations */
unsigned int users;
struct device *dev;
struct list_head h_list;