diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index 66b0260e98..80e478f9e3 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c @@ -520,32 +520,28 @@ static int ftl_ioctl(FAR struct inode *inode, int cmd, unsigned long arg) ****************************************************************************/ /**************************************************************************** - * Name: ftl_initialize_by_name + * Name: ftl_initialize_by_path * * Description: * Initialize to provide a block driver wrapper around an MTD interface * * Input Parameters: - * name - The device name. The MTD block device will be - * registered as as /dev/mtdNAME where NAME is the device name. + * path - The block device path. * mtd - The MTD device that supports the FLASH interface. * ****************************************************************************/ -int ftl_initialize_by_name(FAR const char *name, FAR struct mtd_dev_s *mtd) +int ftl_initialize_by_path(FAR const char *path, FAR struct mtd_dev_s *mtd) { struct ftl_struct_s *dev; - char devname[DEV_NAME_MAX]; int ret = -ENOMEM; -#ifdef CONFIG_DEBUG_FEATURES /* Sanity check */ - if (name == NULL || mtd == NULL) + if (path == NULL || mtd == NULL) { return -EINVAL; } -#endif /* Allocate a FTL device structure */ @@ -615,13 +611,9 @@ int ftl_initialize_by_name(FAR const char *name, FAR struct mtd_dev_s *mtd) } #endif - /* Create a MTD block device name */ - - snprintf(devname, DEV_NAME_MAX, "/dev/mtd%s", name); - /* Inode private data is a reference to the FTL device structure */ - ret = register_blockdriver(devname, &g_bops, 0, dev); + ret = register_blockdriver(path, &g_bops, 0, dev); if (ret < 0) { ferr("ERROR: register_blockdriver failed: %d\n", -ret); @@ -650,7 +642,7 @@ int ftl_initialize_by_name(FAR const char *name, FAR struct mtd_dev_s *mtd) int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd) { - char name[16]; + char path[DEV_NAME_MAX]; #ifdef CONFIG_DEBUG_FEATURES /* Sanity check */ @@ -661,8 +653,8 @@ int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd) } #endif - /* Do the real work by ftl_initialize_by_name */ + /* Do the real work by ftl_initialize_by_path */ - snprintf(name, 16, "block%d", minor); - return ftl_initialize_by_name(name, mtd); + snprintf(path, DEV_NAME_MAX, "/dev/mtdblock%d", minor); + return ftl_initialize_by_path(path, mtd); } diff --git a/include/nuttx/mtd/mtd.h b/include/nuttx/mtd/mtd.h index b2d47e5de3..9e20c74d7b 100644 --- a/include/nuttx/mtd/mtd.h +++ b/include/nuttx/mtd/mtd.h @@ -280,13 +280,12 @@ FAR struct mtd_dev_s *mtd_rwb_initialize(FAR struct mtd_dev_s *mtd); * Initialize to provide a block driver wrapper around an MTD interface * * Input Parameters: - * name - The device name. The MTD block device will be - * registered as as /dev/mtdNAME where NAME is the device name. + * path - The block device path. * mtd - The MTD device that supports the FLASH interface. * ****************************************************************************/ -int ftl_initialize_by_name(FAR const char *name, FAR struct mtd_dev_s *mtd); +int ftl_initialize_by_path(FAR const char *path, FAR struct mtd_dev_s *mtd); /**************************************************************************** * Name: ftl_initialize