summaryrefslogtreecommitdiff
path: root/include/media/rc-core.h
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-03-02 08:00:15 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-03-03 06:16:14 -0300
commit078600f514a12fd763ac84c86af68ef5b5267563 (patch)
tree53f9cb44612819a460663e8832ff187e813d1e55 /include/media/rc-core.h
parent87294e9db50f34ac002e32669b2ff74b72d63584 (diff)
[media] rc-core: allow calling rc_open with device not initialized
The device initialization completes only after calling input_register_device(). However, rc_open() can be called while the device is being registered by the input/evdev core. So, we can't expect that rc_dev->initialized to be true. Change the logic to don't require initialized == true at rc_open and change the type of initialized to be atomic. this way, we can check for it earlier where it is really needed, without needing to lock the mutex just for testing it. Tested with nuvoton_cir driver on a NUC5i7RYB with CIR integrated on it. Reported-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'include/media/rc-core.h')
-rw-r--r--include/media/rc-core.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index c41dd7018fa8..0f77b3dffb37 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -60,7 +60,7 @@ enum rc_filter_type {
/**
* struct rc_dev - represents a remote control device
* @dev: driver model's view of this device
- * @initialized: true if the device init has completed
+ * @initialized: 1 if the device init has completed, 0 otherwise
* @sysfs_groups: sysfs attribute groups
* @input_name: name of the input child device
* @input_phys: physical path to the input child device
@@ -122,7 +122,7 @@ enum rc_filter_type {
*/
struct rc_dev {
struct device dev;
- bool initialized;
+ atomic_t initialized;
const struct attribute_group *sysfs_groups[5];
const char *input_name;
const char *input_phys;