cbus-retu: Acquire mutex on write operation
PATCH 1/1 cbus-retu: Acquire mutex on write operation
The mutex has to be acquired on register write to avoid interference with a simultaneous retu_set_clear_reg_bits operation.
---
Tested on n810.
drivers/cbus/retu.c +2 -0
@@ -120,7 +120,9 @@ {struct retu *retu =dev_get_drvdata (child->parent); +mutex_lock (&retu->mutex);__retu_write_reg (retu, reg, val); +mutex_unlock (&retu->mutex); }EXPORT_SYMBOL_GPL (retu_write_reg);
Quoted 4 lines · Michael Buesch
The mutex has to be acquired on register write to avoid interference with a simultaneous
retu_set_clear_reg_bitsoperation.Signed-off-by Michael Buesch <[email protected]>
good catch, please do the same for retu_read_reg()
Signature · 1 line
balbi
Quoted 7 lines · Felipe Balbi
Quoted 4 lines · Michael Buesch
The mutex has to be acquired on register write to avoid interference with a simultaneous
retu_set_clear_reg_bitsoperation.Signed-off-by Michael Buesch <[email protected]>good catch, please do the same for
retu_read_reg()
I don't think this is necessary, because cbus_read_reg() and cbus_write_reg() are atomic due to the cbus host->lock. I think we can depend on this.
We could probably improve the comment on the lock in cbus_transfer(), though.
Signature · 1 line
Greetings Michael.