lkml.org 
[lkml]   [2020]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RESEND] ds2490: prevent dead lock during detection of w1_therm sensors
Date
(patch resend because seems to have disappeared)
with the introduction of the ext_power sysfs entry, commit b7bb6ca17a90f47c2fe2848531b5bbaf27a65ba7 (w1_therm: adding ext_power sysfs entry), a bus locking error got exposed in ds2490:
bus_mutex needs to be released before calling the detection callback during search, otherwise a dead lock occurs with sensors which try to lock bus_mutex themselves during detection. Please find below a simple patch correcting this.

Signed-off-by: Hans-Frieder Vogt <hfvogt@gmx.net>
---
ds2490.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/w1/masters/ds2490.c 2019-06-07 23:43:07.783820179 +0200
+++ b/drivers/w1/masters/ds2490.c 2020-12-28 13:22:28.963946366 +0100
@@ -730,8 +730,11 @@ static void ds9490r_search(void *data, s
break;
for (i = 0; i < err/8; ++i) {
++found;
- if (found <= search_limit)
+ if (found <= search_limit) {
+ mutex_unlock(&master->bus_mutex);
callback(master, buf[i]);
+ mutex_lock(&master->bus_mutex);
+ }
/* can't know if there will be a discrepancy
* value after until the next id */
if (found == search_limit)
\
 
 \ /
  Last update: 2020-12-28 18:07    [W:0.024 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site