@@ -144,7 +144,7 @@ static void input_pass_values(struct input_dev *dev,
count = input_to_handler(handle, vals, count);
} else {
list_for_each_entry_rcu(handle, &dev->h_list, d_node)
- if (handle->open) {
+ if (handle->active) {
count = input_to_handler(handle, vals, count);
if (!count)
break;
@@ -552,7 +552,7 @@ static void __input_release_device(struct input_handle *handle)
synchronize_rcu();
list_for_each_entry(handle, &dev->h_list, d_node)
- if (handle->open && handle->handler->start)
+ if (handle->active && handle->handler->start)
handle->handler->start(handle);
}
}
@@ -613,6 +613,8 @@ int input_open_device(struct input_handle *handle)
}
}
+ handle->active = handle->open > 0;
+
out:
mutex_unlock(&dev->mutex);
return retval;
@@ -663,6 +665,8 @@ void input_close_device(struct input_handle *handle)
synchronize_rcu();
}
+ handle->active = handle->open > 0;
+
mutex_unlock(&dev->mutex);
}
EXPORT_SYMBOL(input_close_device);
@@ -716,7 +720,7 @@ static void input_disconnect_device(struct input_dev *dev)
input_dev_release_keys(dev);
list_for_each_entry(handle, &dev->h_list, d_node)
- handle->open = 0;
+ handle->active = false;
spin_unlock_irq(&dev->event_lock);
}
@@ -307,8 +307,10 @@ struct input_handler {
/**
* struct input_handle - links input device with an input handler
* @private: handler-specific data
- * @open: counter showing whether the handle is 'open', i.e. should deliver
- * events from its device
+ * @open: counter showing whether the handle is 'open', i.e. there is
+ * a consumer for the events from input device
+ * @active: indicates that input events should be delivered from input
+ * device to input handler through this handle
* @name: name given to the handle by handler that created it
* @dev: input device the handle is attached to
* @handler: handler that works with the device through this handle
@@ -321,6 +323,8 @@ struct input_handle {
void *private;
int open;
+ bool active;
+
const char *name;
struct input_dev *dev;