msm: synx: protect clean up with mutex lock
While cleaning up synx table entry, hold the lock for that particular entry. This will make sure that any other read/write for same entry waits till cleaning is done. Also, Change log level of empty table entries from warning to debug. Change-Id: Ib092f41a12fb943ed184c031dca481a75d3446e3 Signed-off-by: Ram Nagesh <quic_ramnages@quicinc.com>
This commit is contained in:
1 parent
e0b641d7b3
commit
0110b73bfb
2 files changed
+4
-2
No files matched your search
@@ -67,14 +67,14 @@ static ssize_t synx_table_read(struct file *file,
|
||||
if (columns & STATE_COLUMN)
|
||||
cur += scnprintf(cur, end - cur, "| Status |");
|
||||
cur += scnprintf(cur, end - cur, "\n");
|
||||
for (i = 0; i < SYNX_MAX_OBJS; i++) {
|
||||
for (i = 1; i < SYNX_MAX_OBJS; i++) {
|
||||
row = &dev->synx_table[i];
|
||||
|
||||
index = row->index;
|
||||
mutex_lock(&dev->row_locks[index]);
|
||||
if (!row->index) {
|
||||
mutex_unlock(&dev->row_locks[index]);
|
||||
pr_warn("synx obj at %d invalid\n", index);
|
||||
pr_debug("synx obj at %d invalid\n", index);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,9 @@ int synx_deinit_object(struct synx_table_row *row)
|
||||
}
|
||||
}
|
||||
|
||||
mutex_lock(&synx_dev->row_locks[index]);
|
||||
memset(row, 0, sizeof(*row));
|
||||
mutex_unlock(&synx_dev->row_locks[index]);
|
||||
clear_bit(index, synx_dev->bitmap);
|
||||
|
||||
pr_debug("destroying synx obj at %d successful\n", index);
|
||||
|
||||
Reference in new issue
Block a user