summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-07-16 23:23:25 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-07-16 23:23:25 -0400
commit2b9c85a41b190c6843000f18b922946bd6bd3bed (patch)
treebc3ea7a222fbe2bbfe6da37586631b504dd70a50
parent805f5316325eea37a90b5299b4a3ba601077f0a5 (diff)
downloadrockbox-2b9c85a.tar.gz
rockbox-2b9c85a.tar.bz2
rockbox-2b9c85a.zip
storage: Clean up storage_xxxx macros when STORAGE_MULTI is not set
Change-Id: I1652eac1743f4b8b84da08ea5a6d04ac7e17e21d
-rw-r--r--apps/plugin.c4
-rw-r--r--apps/settings_list.c2
-rw-r--r--firmware/export/storage.h33
3 files changed, 20 insertions, 19 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 7d40a8db4f..4293d861f9 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -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,
diff --git a/apps/settings_list.c b/apps/settings_list.c
index bc03672aeb..435a09bb8a 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -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),
diff --git a/firmware/export/storage.h b/firmware/export/storage.h
index 8ff06c8744..e6424f7b03 100644
--- a/firmware/export/storage.h
+++ b/firmware/export/storage.h
@@ -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);