diff --git a/msm/sde_dbg.c b/msm/sde_dbg.c index a6cc07d96d..4e46c3fd5a 100644 --- a/msm/sde_dbg.c +++ b/msm/sde_dbg.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2009-2021, The Linux Foundation. All rights reserved. */ @@ -1561,8 +1561,8 @@ static int sde_dbg_debugfs_open(struct inode *inode, struct file *file) mutex_lock(&sde_dbg_base.mutex); sde_dbg_base.cur_evt_index = 0; sde_dbg_base.evtlog->first = (u32)atomic_add_return(0, &sde_dbg_base.evtlog->curr) + 1; - sde_dbg_base.evtlog->last = - sde_dbg_base.evtlog->first + SDE_EVTLOG_ENTRY; + atomic_set(&sde_dbg_base.evtlog->last, + (sde_dbg_base.evtlog->first + SDE_EVTLOG_ENTRY)); mutex_unlock(&sde_dbg_base.mutex); return 0; } diff --git a/msm/sde_dbg.h b/msm/sde_dbg.h index 89397cb0fa..59e4baea4d 100644 --- a/msm/sde_dbg.h +++ b/msm/sde_dbg.h @@ -165,7 +165,7 @@ struct sde_dbg_evtlog_log { struct sde_dbg_evtlog { struct sde_dbg_evtlog_log logs[SDE_EVTLOG_ENTRY]; u32 first; - u32 last; + atomic_t last; u32 last_dump; atomic_t curr; u32 next; diff --git a/msm/sde_dbg_evtlog.c b/msm/sde_dbg_evtlog.c index ecd2fc529b..8459693029 100644 --- a/msm/sde_dbg_evtlog.c +++ b/msm/sde_dbg_evtlog.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. */ @@ -89,7 +89,7 @@ void sde_evtlog_log(struct sde_dbg_evtlog *evtlog, const char *name, int line, } va_end(args); log->data_cnt = i; - evtlog->last++; + atomic_inc_return(&evtlog->last); trace_sde_evtlog(name, line, log->data_cnt, log->data); } @@ -126,7 +126,7 @@ static bool _sde_evtlog_dump_calc_range(struct sde_dbg_evtlog *evtlog, evtlog->first = evtlog->next; if (update_last_entry) - evtlog->last_dump = evtlog->last; + evtlog->last_dump = (u32)atomic_read(&evtlog->last); if (evtlog->last_dump == evtlog->first) return false; @@ -202,7 +202,7 @@ u32 sde_evtlog_count(struct sde_dbg_evtlog *evtlog) first = evtlog->first; next = evtlog->next; - last = evtlog->last; + last = (u32)atomic_read(&evtlog->last); last_dump = evtlog->last_dump; first = next;