storage: Clean up storage_xxxx macros when STORAGE_MULTI is not set

Change-Id: I1652eac1743f4b8b84da08ea5a6d04ac7e17e21d
This commit is contained in:
Solomon Peachy 2020-07-16 23:23:25 -04:00
parent 805f531632
commit 2b9c85a41b
3 changed files with 20 additions and 19 deletions

View file

@ -421,8 +421,8 @@ static const struct plugin_api rockbox_api = {
read_line,
settings_parseline,
storage_sleep,
storage_spin,
storage_spindown,
STORAGE_FUNCTION(spin),
STORAGE_FUNCTION(spindown),
#if USING_STORAGE_CALLBACK
register_storage_idle_func,
unregister_storage_idle_func,

View file

@ -1255,7 +1255,7 @@ const struct settings_list settings[] = {
/* disk */
#ifdef HAVE_DISK_STORAGE
INT_SETTING(F_TIME_SETTING, disk_spindown, LANG_SPINDOWN, 5, "disk spindown",
UNIT_SEC, 3, 254, 1, NULL, NULL, storage_spindown),
UNIT_SEC, 3, 254, 1, NULL, NULL, STORAGE_FUNCTION(spindown)),
#endif /* HAVE_DISK_STORAGE */
/* browser */
TEXT_SETTING(0, start_directory, "start directory", "/", NULL, NULL),

View file

@ -118,11 +118,12 @@ static inline void stub_storage_spin(void) {}
static inline void stub_storage_spindown(int timeout) { (void)timeout; }
static inline int stub_storage_event(long id, intptr_t data)
{ return 0; (void)id; (void)data; }
static inline void storage_sleep(void) {};
#else /* ndef HAVE_HOSTFS */
#if (CONFIG_STORAGE & STORAGE_ATA)
void storage_sleep(void);
#else
static inline void storage_sleep(void) {}
static inline void storage_sleep(void) {};
#endif
#endif /* HAVE_HOSTFS */
@ -132,11 +133,11 @@ static inline void storage_sleep(void) {}
*/
#define storage_num_drives() NUM_DRIVES
#if defined(HAVE_HOSTFS)
#define STORAGE_FUNCTION(NAME) (stub_## NAME)
#define STORAGE_FUNCTION(NAME) (stub_storage_## NAME)
#define storage_event stub_storage_event
#define storage_spindown stub_storage_spindown
#define storage_sleep stub_storage_sleep
#define storage_spin stub_storage_spin
#define storage_spindown(sec) stub_storage_spindown(sec)
#define storage_sleep() stub_storage_sleep()
#define storage_spin() stub_storage_spin()
#define storage_enable(on)
#define storage_sleepnow()
@ -160,9 +161,8 @@ static inline void storage_sleep(void) {}
#define storage_driver_type(drive) hostfs_driver_type(IF_MV(drive))
#elif (CONFIG_STORAGE & STORAGE_ATA)
#define STORAGE_FUNCTION(NAME) (ata_## NAME)
#define storage_spindown ata_spindown
#define storage_spin ata_spin
#define storage_spindown(sec) ata_spindown(sec)
#define storage_spin() ata_spin()
#define storage_enable(on) ata_enable(on)
#define storage_sleepnow() ata_sleepnow()
#define storage_disk_is_active() ata_disk_is_active()
@ -184,8 +184,8 @@ static inline void storage_sleep(void) {}
#define storage_driver_type(drive) (STORAGE_ATA_NUM)
#elif (CONFIG_STORAGE & STORAGE_SD)
#define STORAGE_FUNCTION(NAME) (sd_## NAME)
#define storage_spindown sd_spindown
#define storage_spin sd_spin
#define storage_spindown(sec) sd_spindown(sec)
#define storage_spin() sd_spin()
#define storage_enable(on) sd_enable(on)
#define storage_sleepnow() do {} while (0)
@ -208,8 +208,8 @@ static inline void storage_sleep(void) {}
#define storage_driver_type(drive) (STORAGE_SD_NUM)
#elif (CONFIG_STORAGE & STORAGE_MMC)
#define STORAGE_FUNCTION(NAME) (mmc_## NAME)
#define storage_spindown mmc_spindown
#define storage_spin mmc_spin
#define storage_spindown(sec) mmc_spindown(sec)
#define storage_spin() mmc_spin()
#define storage_enable(on) mmc_enable(on)
#define storage_sleepnow() mmc_sleepnow()
@ -232,8 +232,8 @@ static inline void storage_sleep(void) {}
#define storage_driver_type(drive) (STORAGE_MMC_NUM)
#elif (CONFIG_STORAGE & STORAGE_NAND)
#define STORAGE_FUNCTION(NAME) (nand_## NAME)
#define storage_spindown nand_spindown
#define storage_spin nand_spin
#define storage_spindown(sec) nand_spindown(sec)
#define storage_spin() nand_spin()
#define storage_enable(on) (void)0
#define storage_sleepnow() nand_sleepnow()
@ -256,8 +256,8 @@ static inline void storage_sleep(void) {}
#define storage_driver_type(drive) (STORAGE_NAND_NUM)
#elif (CONFIG_STORAGE & STORAGE_RAMDISK)
#define STORAGE_FUNCTION(NAME) (ramdisk_## NAME)
#define storage_spindown ramdisk_spindown
#define storage_spin ramdisk_spin
#define storage_spindown(sec) ramdisk_spindown(sec)
#define storage_spin() ramdisk_spin()
#define storage_enable(on) (void)0
#define storage_sleepnow() ramdisk_sleepnow()
@ -284,6 +284,7 @@ static inline void storage_sleep(void) {}
#else /* CONFIG_STORAGE_MULTI || !HAVE_HOSTFS */
/* Multi-driver use normal functions */
#define STORAGE_FUNCTION(NAME) (storage_## NAME)
void storage_enable(bool on);
void storage_sleepnow(void);