diff --git a/arch/risc-v/src/bl602/bl602_spiflash.c b/arch/risc-v/src/bl602/bl602_spiflash.c index 3a0ecf18eea..3aef8f11ce7 100644 --- a/arch/risc-v/src/bl602/bl602_spiflash.c +++ b/arch/risc-v/src/bl602/bl602_spiflash.c @@ -322,9 +322,9 @@ int bl602_ioctl(FAR struct mtd_dev_s *dev, int cmd, finfo("cmd(0x%x) MTDIOC_XIPBASE not support.\n", cmd); } break; - case BIOC_FLUSH: + case MTDIOC_FLUSH: { - finfo("cmd(0x%x) BIOC_FLUSH.\n", cmd); + finfo("cmd(0x%x) MTDIOC_FLUSH.\n", cmd); ret = OK; } break; diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index 463e0cef196..28741c0f37d 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c @@ -530,13 +530,17 @@ static int ftl_ioctl(FAR struct inode *inode, int cmd, unsigned long arg) cmd = MTDIOC_XIPBASE; } -#ifdef CONFIG_FTL_WRITEBUFFER else if (cmd == BIOC_FLUSH) { - return rwb_flush(&dev->rwb); - } +#ifdef CONFIG_FTL_WRITEBUFFER + rwb_flush(&dev->rwb); #endif + /* Change the BIOC_FLUSH command to the MTDIOC_FLUSH command. */ + + cmd = MTDIOC_FLUSH; + } + /* No other block driver ioctl commands are not recognized by this * driver. Other possible MTD driver ioctl commands are passed through * to the MTD driver (unchanged). diff --git a/fs/littlefs/lfs_vfs.c b/fs/littlefs/lfs_vfs.c index 01f45f59880..ec43dc1c605 100644 --- a/fs/littlefs/lfs_vfs.c +++ b/fs/littlefs/lfs_vfs.c @@ -926,7 +926,7 @@ static int littlefs_sync_block(FAR const struct lfs_config *c) if (INODE_IS_MTD(drv)) { - ret = MTD_IOCTL(drv->u.i_mtd, BIOC_FLUSH, 0); + ret = MTD_IOCTL(drv->u.i_mtd, MTDIOC_FLUSH, 0); } else { diff --git a/include/nuttx/mtd/mtd.h b/include/nuttx/mtd/mtd.h index 32e1314113b..10e5567a40e 100644 --- a/include/nuttx/mtd/mtd.h +++ b/include/nuttx/mtd/mtd.h @@ -68,6 +68,9 @@ * OUT: None */ #define MTDIOC_ECCSTATUS _MTDIOC(0x0008) /* IN: Pointer to uint8_t * OUT: ECC status */ +#define MTDIOC_FLUSH _MTDIOC(0x0009) /* IN: None + * OUT: None (ioctl return value provides + * success/failure indication). */ /* Macros to hide implementation */