media: rc: remove unneeded mutex in rc_register_device
Subsystems (2)
PATCH 1/1 media: rc: remove unneeded mutex in rc_register_device
Access to dev->initialized is atomic, therefore we don't have to protect it with a mutex.
--- drivers/media/rc/rc-main.c | 2 -- 1 file changed, 2 deletions(-)
drivers/media/rc/rc-main.c +0 -2
@@ -1492,9 +1492,7 @@ int rc_register_device(struct rc_dev *dev) }/* Allow the RC sysfs nodes to be accessible */ -mutex_lock (&dev->lock);atomic_set (&dev->initialized,1 ); -mutex_unlock (&dev->lock); IR_dprintk(1, "Registered rc%u (driver: %s, remote: %s, mode %s)\n", dev->minor,
Signature · 1 line
2.7.3
Quoted 2 lines · Heiner Kallweit
Access to
dev->initializedis atomic, therefore we don't have to protect it with a mutex.
Mutexes are used to split the code to mutually exclusive execution blocks, so not arguing about the apparently correct change itself I want to emphasize that the given explanation of the change in the commit message is wrong. Atomic access does not cancel a specific care about execution ordering.
Indirectly it applies to ("rc-core: allow calling rc_open with device not initialized"), where "initialized" bool property was changed to atomic_t type --- this (sub-)change is just useless.
Please grasp the topic and reword the commit message.
Quoted 11 lines
Signed-off-by Heiner Kallweit <[email protected]>--- drivers/media/rc/rc-main.c | 2 -- 1 file changed, 2 deletions(-)drivers/media/rc/rc-main.c +0
-0
drivers/media/rc/rc-main.c int rc_register_device(struct rc_dev *dev) · line 1498
Quoted 9 lines
drivers/media/rc/rc-main.c +0
-2@@ -1492,9 +1492,7 @@ int rc_register_device(struct rc_dev *dev) }/* Allow the RC sysfs nodes to be accessible */ -mutex_lock (&dev->lock);atomic_set (&dev->initialized,1 ); -mutex_unlock (&dev->lock); IR_dprintk(1, "Registered rc%u (driver: %s, remote: %s, mode %s)\n", dev->minor,
--
With best wishes,
Vladimir
Am 16.03.2016 um 20:33 schrieb Vladimir Zapolskiy:
Quoted 10 lines · Heiner Kallweit
Quoted 2 lines
Access to
dev->initializedis atomic, therefore we don't have to protect it with a mutex.Mutexes are used to split the code to mutually exclusive execution blocks, so not arguing about the apparently correct change itself I want to emphasize that the given explanation of the change in the commit message is wrong. Atomic access does not cancel a specific care about execution ordering.
Quoted 6 lines
Indirectly it applies to ("rc-core: allow calling
rc_openwith device not initialized"), where "initialized" bool property was changed toatomic_ttype --- this (sub-)change is just useless.Please grasp the topic and reword the commit message.
Thanks for the hint, you're right.
Will change the commit message and send a v2.
Regards, Heiner
Quoted 25 lines
Quoted 11 lines
Signed-off-by Heiner Kallweit <[email protected]>--- drivers/media/rc/rc-main.c | 2 -- 1 file changed, 2 deletions(-)drivers/media/rc/rc-main.c +0
-0drivers/media/rc/rc-main.c int rc_register_device(struct rc_dev *dev) · line 1498
Quoted 9 lines
drivers/media/rc/rc-main.c +0
-2@@ -1492,9 +1492,7 @@ int rc_register_device(struct rc_dev *dev) }/* Allow the RC sysfs nodes to be accessible */ -mutex_lock (&dev->lock);atomic_set (&dev->initialized,1 ); -mutex_unlock (&dev->lock); IR_dprintk(1, "Registered rc%u (driver: %s, remote: %s, mode %s)\n", dev->minor,--
With best wishes,
Vladimir