You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/01/30 03:09:47 UTC

[nuttx] 01/02: [MTD/SmartFS] Extract register_driver call to own function

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

commit 28f92e8238a2684bf943f8ed6f415e6c201ba88f
Author: Oleksandr Oryshchenko <a....@gmail.com>
AuthorDate: Sun Jan 29 16:42:59 2023 +0100

    [MTD/SmartFS] Extract register_driver call to own function
---
 drivers/mtd/smart.c      | 18 ++++++++++++++----
 include/nuttx/fs/smart.h |  4 ++++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/smart.c b/drivers/mtd/smart.c
index b932116597..d0ca3fca09 100644
--- a/drivers/mtd/smart.c
+++ b/drivers/mtd/smart.c
@@ -6289,10 +6289,6 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd,
         }
     }
 
-#ifdef CONFIG_SMART_DEV_LOOP
-  register_driver("/dev/smart", &g_fops, 0666, NULL);
-#endif
-
   return OK;
 
 errout:
@@ -6320,6 +6316,20 @@ errout:
   return ret;
 }
 
+/****************************************************************************
+ * Name: smart_loop_register_driver
+ *
+ * Description:
+ *   Registers SmartFS Loop Driver
+ ****************************************************************************/
+
+#ifdef CONFIG_SMART_DEV_LOOP
+int smart_loop_register_driver(void)
+{
+  return register_driver("/dev/smart", &g_fops, 0666, NULL);
+}
+#endif
+
 /****************************************************************************
  * Name: smart_losetup
  *
diff --git a/include/nuttx/fs/smart.h b/include/nuttx/fs/smart.h
index 935804ed7b..bab05ca680 100644
--- a/include/nuttx/fs/smart.h
+++ b/include/nuttx/fs/smart.h
@@ -152,6 +152,10 @@ extern "C"
  * Public Function Prototypes
  ****************************************************************************/
 
+#ifdef CONFIG_SMART_DEV_LOOP
+int smart_loop_register_driver(void);
+#endif
+
 #undef EXTERN
 #ifdef __cplusplus
 }