This is an automated email from the ASF dual-hosted git repository.

gustavonihei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit dfb9a763a79ea6d60441a23fb88811984449a7f0
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Sat Mar 12 03:56:57 2022 +0800

    fs: Initialize g_inode_sem at the definition place
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 fs/inode/fs_inode.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/fs/inode/fs_inode.c b/fs/inode/fs_inode.c
index 1306734..93a05ad 100644
--- a/fs/inode/fs_inode.c
+++ b/fs/inode/fs_inode.c
@@ -62,7 +62,10 @@ struct inode_sem_s
  * Private Data
  ****************************************************************************/
 
-static struct inode_sem_s g_inode_sem;
+static struct inode_sem_s g_inode_sem =
+{
+  SEM_INITIALIZER(1), NO_HOLDER, 0
+};
 
 /****************************************************************************
  * Public Functions
@@ -79,14 +82,6 @@ static struct inode_sem_s g_inode_sem;
 
 void inode_initialize(void)
 {
-  /* Initialize the semaphore to one (to support one-at-a-time access to the
-   * inode tree).
-   */
-
-  nxsem_init(&g_inode_sem.sem, 0, 1);
-  g_inode_sem.holder = NO_HOLDER;
-  g_inode_sem.count  = 0;
-
   /* Reserve the root node */
 
   inode_root_reserve();

Reply via email to