This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 3d1b3ba1f5 pm: shorten the pm procfs domain lock time.
3d1b3ba1f5 is described below
commit 3d1b3ba1f5fa3812da5b6afd1e8bd6a0ecdadfcd
Author: buxiasen <[email protected]>
AuthorDate: Fri May 24 22:05:38 2024 +0800
pm: shorten the pm procfs domain lock time.
snprintf and procfs_memcpy don't have to do inside lock.
Signed-off-by: buxiasen <[email protected]>
---
drivers/power/pm/pm_procfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/power/pm/pm_procfs.c b/drivers/power/pm/pm_procfs.c
index 199fc41f9e..39f8d5303b 100644
--- a/drivers/power/pm/pm_procfs.c
+++ b/drivers/power/pm/pm_procfs.c
@@ -330,6 +330,8 @@ static ssize_t pm_read_state(FAR struct file *filep, FAR
char *buffer,
sum += wake[state] + sleep[state];
}
+ pm_domain_unlock(pmfile->domain, flags);
+
sum = sum ? sum : 1;
for (state = 0; state < PM_COUNT && totalsize < buflen; state++)
@@ -355,8 +357,6 @@ static ssize_t pm_read_state(FAR struct file *filep, FAR
char *buffer,
totalsize += copysize;
}
- pm_domain_unlock(pmfile->domain, flags);
-
filep->f_pos += totalsize;
return totalsize;
}