Skip to content

Commit b46ff4e

Browse files
Stanimir Varbanovmchehab
authored andcommitted
media: venus: Make sys_error flag an atomic bitops
Make the sys_error flag an atomic bitops in order to avoid locking in sys_error readers. Signed-off-by: Stanimir Varbanov <[email protected]> Tested-by: Vikash Garodia <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 3f3e877 commit b46ff4e

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

drivers/media/platform/qcom/venus/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static void venus_event_notify(struct venus_core *core, u32 event)
6565
}
6666

6767
mutex_lock(&core->lock);
68-
core->sys_error = true;
68+
set_bit(0, &core->sys_error);
6969
list_for_each_entry(inst, &core->instances, list)
7070
inst->ops->event_notify(inst, EVT_SESSION_ERROR, NULL);
7171
mutex_unlock(&core->lock);
@@ -161,7 +161,7 @@ static void venus_sys_error_handler(struct work_struct *work)
161161
dev_warn(core->dev, "system error has occurred (recovered)\n");
162162

163163
mutex_lock(&core->lock);
164-
core->sys_error = false;
164+
clear_bit(0, &core->sys_error);
165165
mutex_unlock(&core->lock);
166166
}
167167

drivers/media/platform/qcom/venus/core.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef __VENUS_CORE_H_
88
#define __VENUS_CORE_H_
99

10+
#include <linux/bitops.h>
1011
#include <linux/list.h>
1112
#include <media/videobuf2-v4l2.h>
1213
#include <media/v4l2-ctrls.h>
@@ -182,7 +183,7 @@ struct venus_core {
182183
unsigned int state;
183184
struct completion done;
184185
unsigned int error;
185-
bool sys_error;
186+
unsigned long sys_error;
186187
const struct hfi_core_ops *core_ops;
187188
const struct venus_pm_ops *pm_ops;
188189
struct mutex pm_lock;

drivers/media/platform/qcom/venus/helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ void venus_helper_vb2_stop_streaming(struct vb2_queue *q)
14861486
ret |= venus_helper_intbufs_free(inst);
14871487
ret |= hfi_session_deinit(inst);
14881488

1489-
if (inst->session_error || core->sys_error)
1489+
if (inst->session_error || test_bit(0, &core->sys_error))
14901490
ret = -EIO;
14911491

14921492
if (ret)

drivers/media/platform/qcom/venus/hfi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ int hfi_session_init(struct venus_inst *inst, u32 pixfmt)
214214
* session_init() can't pass successfully
215215
*/
216216
mutex_lock(&core->lock);
217-
if (!core->ops || core->sys_error) {
217+
if (!core->ops || test_bit(0, &inst->core->sys_error)) {
218218
mutex_unlock(&core->lock);
219219
return -EIO;
220220
}

drivers/media/platform/qcom/venus/vdec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ static void vdec_session_release(struct venus_inst *inst)
12311231
ret = hfi_session_deinit(inst);
12321232
abort = (ret && ret != -EINVAL) ? 1 : 0;
12331233

1234-
if (inst->session_error || core->sys_error)
1234+
if (inst->session_error || test_bit(0, &core->sys_error))
12351235
abort = 1;
12361236

12371237
if (abort)

0 commit comments

Comments
 (0)