From 078600f514a12fd763ac84c86af68ef5b5267563 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 2 Mar 2016 08:00:15 -0300 Subject: [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 Signed-off-by: Mauro Carvalho Chehab --- include/media/rc-core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/media') 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; -- cgit v1.2.3