Skip to content

Commit

Permalink
fixup! drivers/mtd_sdard : Add CONFIG_
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaim committed May 4, 2020
1 parent ec80878 commit f08f59c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
22 changes: 2 additions & 20 deletions drivers/include/mtd_sdcard.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "sdcard_spi.h"
#include "mtd.h"
#include "kernel_defines.h"


#ifdef __cplusplus
extern "C"
Expand Down Expand Up @@ -56,31 +56,13 @@ typedef struct {
* the sector first.
* Attention: an erase call will therefore NOT touch the content,
* so enable this feature to ensure overriding the data.
* This feature is currently not supported.
*/
#ifdef DOXYGEN
#define CONFIG_MTD_SDCARD_ERASE
#endif
/** @} */

/**
* @brief Enable Skip SDCard Erase
* @note SDCards handle sector erase internally so it's
* possible to directly write to the card without erasing
* the sector first.
* Attention: an erase call will therefore NOT touch the content,
* so disable this feature to ensure overriding the data.
*
* @deprecated Use inverse @ref CONFIG_MTD_SDCARD_ERASE instead.
* Will be removed after 2021.01 release.
*/
#ifndef MTD_SDCARD_SKIP_ERASE
#if IS_ACTIVE(CONFIG_MTD_SDCARD_ERASE)
#define MTD_SDCARD_SKIP_ERASE (0)
#else
#define MTD_SDCARD_SKIP_ERASE (1)
#endif
#endif

/**
* @brief sdcard device operations table for mtd
*/
Expand Down
12 changes: 7 additions & 5 deletions drivers/mtd_sdcard/mtd_sdcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "mtd_sdcard.h"
#include "sdcard_spi.h"
#include "sdcard_spi_internal.h"
#include "kernel_defines.h"

#include <inttypes.h>
#include <errno.h>
Expand Down Expand Up @@ -103,11 +104,12 @@ static int mtd_sdcard_erase(mtd_dev_t *dev,
(void)addr;
(void)size;

#if MTD_SDCARD_SKIP_ERASE == 1
return 0;
#else
return -ENOTSUP; /* explicit erase currently not supported */
#endif
if (!IS_ACTIVE(CONFIG_MTD_SDCARD_ERASE)) {
return 0;
}
else {
return -ENOTSUP; /* explicit erase currently not supported */
}
}

static int mtd_sdcard_power(mtd_dev_t *dev, enum mtd_power_state power)
Expand Down

0 comments on commit f08f59c

Please sign in to comment.