mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
drivers/mtd: Make compile time check for sane mtd isbad/markbad configuration
This removes the DEBUGASSERT in ftl_initialize_by_path. Instead, check compile time that FTL is enabled in case some of the drivers implement the isbad and markbad functions. Also select the FTL_BBM for those drivers as they require it. Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
parent
82fb723bde
commit
cbfaa7c3b0
6 changed files with 24 additions and 13 deletions
|
|
@ -97,8 +97,14 @@
|
|||
#define MTD_READ(d,s,n,b) ((d)->read ? (d)->read(d,s,n,b) : (-ENOSYS))
|
||||
#define MTD_WRITE(d,s,n,b) ((d)->write ? (d)->write(d,s,n,b) : (-ENOSYS))
|
||||
#define MTD_IOCTL(d,c,a) ((d)->ioctl ? (d)->ioctl(d,c,a) : (-ENOSYS))
|
||||
#define MTD_ISBAD(d,b) ((d)->isbad ? (d)->isbad(d,b) : (-ENOSYS))
|
||||
#define MTD_MARKBAD(d,b) ((d)->markbad ? (d)->markbad(d,b) : (-ENOSYS))
|
||||
|
||||
#ifdef CONFIG_FTL_BBM
|
||||
# define MTD_ISBAD(d,b) ((d)->isbad ? (d)->isbad(d,b) : (-ENOSYS))
|
||||
# define MTD_MARKBAD(d,b) ((d)->markbad ? (d)->markbad(d,b) : (-ENOSYS))
|
||||
#else
|
||||
# define MTD_ISBAD(d,b) (-ENOSYS)
|
||||
# define MTD_MARKBAD(d,b) (-ENOSYS)
|
||||
#endif
|
||||
|
||||
/* If any of the low-level device drivers declare they want sub-sector erase
|
||||
* support, then define MTD_SUBSECTOR_ERASE.
|
||||
|
|
@ -220,8 +226,10 @@ struct mtd_dev_s
|
|||
|
||||
/* Check/Mark bad block for the specified block number */
|
||||
|
||||
#ifdef CONFIG_FTL_BBM
|
||||
CODE int (*isbad)(FAR struct mtd_dev_s *dev, off_t block);
|
||||
CODE int (*markbad)(FAR struct mtd_dev_s *dev, off_t block);
|
||||
#endif
|
||||
|
||||
/* Name of this MTD device */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue