drivers/fs:Always use register_mtddriver() to register the MTD device (patch2)

This is a supplement to the patch:1936126210a56b6d1b033d6d940669413dd6e1b0

Due to the automatic wrapping of MTD devices during the
open() process, the legacy registration methods
ftl_initialize() and bchdev_register() are no longer
required for MTD device registration for user code.

So we have adjusted the registration method for MTD devices
in nuttx/boards, replacing the previous approach using
ftl_initialize()  with register_mtddriver().
This commit is contained in:
jingfei
2025-07-18 00:42:09 +08:00
committed by Filipe do Ó Cavalcanti
parent 956a50bb7d
commit db54331479
39 changed files with 230 additions and 155 deletions
@@ -126,12 +126,15 @@ int board_app_initialize(uintptr_t arg)
}
#ifndef CONFIG_FS_NXFFS
/* And use the FTL layer to wrap the MTD driver as a block driver */
/* Register the MTD driver */
ret = ftl_initialize(CONFIG_NSH_MMCSDMINOR, mtd);
char path[32];
snprintf(path, sizeof(path), "/dev/mtdblock%d", CONFIG_NSH_MMCSDMINOR);
ret = register_mtddriver(path, mtd, 0755, NULL);
if (ret < 0)
{
ferr("ERROR: Initialize the FTL layer\n");
ferr("ERROR: Failed to register the MTD driver %s, ret %d\n",
path, ret);
return ret;
}
#else