drivers/mtd/mtd_config: set different format versions for named and ID modes

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko
2022-03-21 21:10:09 +01:00
committed by Xiang Xiao
parent 3581668c6b
commit b7c4746b0a
+6 -11
View File
@@ -55,14 +55,12 @@
/* Define the current format version */ /* Define the current format version */
#ifdef CONFIG_MTD_CONFIG_NAMED
# define CONFIGDATA_FORMAT_VERSION 1 # define CONFIGDATA_FORMAT_VERSION 1
#define CONFIGDATA_BLOCK_HDR_SIZE 3 #else
# define CONFIGDATA_FORMAT_VERSION 2
/* Define the erased state of the MTD device, if not already defined */
#ifndef CONFIG_MTD_CONFIG_ERASEDVALUE
# define CONFIG_MTD_CONFIG_ERASEDVALUE 0xff
#endif #endif
#define CONFIGDATA_BLOCK_HDR_SIZE 3
#define MTD_ERASED_ID ((CONFIG_MTD_CONFIG_ERASEDVALUE << 8) | \ #define MTD_ERASED_ID ((CONFIG_MTD_CONFIG_ERASEDVALUE << 8) | \
CONFIG_MTD_CONFIG_ERASEDVALUE) CONFIG_MTD_CONFIG_ERASEDVALUE)
@@ -266,7 +264,7 @@ static int mtdconfig_writebytes(FAR struct mtdconfig_struct_s *dev,
off_t bytes_this_block; off_t bytes_this_block;
off_t bytes_written = 0; off_t bytes_written = 0;
while (writelen) while (writelen > 0)
{ {
/* Read existing data from the block into the buffer */ /* Read existing data from the block into the buffer */
@@ -1646,10 +1644,7 @@ static int mtdconfig_ioctl(FAR struct file *filep, int cmd,
/* Call the MTD's ioctl for this */ /* Call the MTD's ioctl for this */
if (dev->mtd->ioctl) ret = MTD_IOCTL(dev->mtd, cmd, arg);
{
dev->mtd->ioctl(dev->mtd, cmd, arg);
}
break; break;
} }