Cleanup some unnecessary HAVE_HOTSWAP uses

Always define storage_removable() and storage_present() so
that ifdefs are unnecessary. They were already defined as
constant for the CONFIG_STORAGE_MULTI case, but not in the
case of a single storage type.

Change-Id: I13073b3a72b201b5b11167deb050e6f27139c61c
This commit is contained in:
Aidan MacDonald 2026-06-06 15:24:03 +01:00 committed by Solomon Peachy
parent 9b0516e4e1
commit 722e4f10ad
4 changed files with 9 additions and 15 deletions

View file

@ -508,9 +508,7 @@ int disk_mount_all(void)
for (int i = 0; i < NUM_DRIVES; i++)
{
#ifdef HAVE_HOTSWAP
if (storage_present(i))
#endif
mounted += disk_mount(i);
}
@ -554,9 +552,7 @@ int disk_unmount_all(void)
for (int i = 0; i < NUM_DRIVES; i++)
{
#ifdef HAVE_HOTSWAP
if (storage_present(i))
#endif
unmounted += disk_unmount(i);
}

View file

@ -317,9 +317,6 @@ void storage_get_info(int drive, struct storage_info *info);
#ifdef HAVE_HOTSWAP
bool storage_removable(int drive);
bool storage_present(int drive);
#else
#define storage_removable(x) 0
#define storage_present(x) 1
#endif
int storage_driver_type(int drive);
@ -327,4 +324,10 @@ int storage_driver_type(int drive);
int storage_read_sectors(IF_MD(int drive,) sector_t start, int count, void* buf);
int storage_write_sectors(IF_MD(int drive,) sector_t start, int count, const void* buf);
#ifndef HAVE_HOTSWAP
# define storage_removable(x) 0
# define storage_present(x) 1
#endif
#endif /* __STORAGE_H__ */

View file

@ -1264,14 +1264,14 @@ bool dbg_hw_info_sdmmc(void)
else
continue;
lcd_putsf(0, line++, "%s", info.slot_name);
#ifdef HAVE_HOTSWAP
bool removable = storage_removable(info.drive);
bool present = storage_present(info.drive);
if(removable)
lcd_putsf(0, line++, " removable %spresent", present ? "" : "not ");
if(!present)
continue;
#endif
lcd_putsf(0, line++, " bus: %d sbc: %d", info.bus_width, info.has_sbc);
lcd_putsf(0, line++, " hs: %s", info.hs_enabled ? "enabled" :
info.hs_capable ? "disabled" : "not capable");

View file

@ -800,11 +800,8 @@ static void handle_scsi(struct command_block_wrapper* cbw)
block_count=info.num_sectors;
#endif
#ifdef HAVE_HOTSWAP
if(storage_removable(lun) && !storage_present(lun)) {
if(storage_removable(lun) && !storage_present(lun))
ejected[lun] = true;
}
#endif
if(ejected[lun])
lun_present = false;
@ -855,11 +852,9 @@ static void handle_scsi(struct command_block_wrapper* cbw)
tb.lun_data->lun_list_length=htobe32(8*storage_num_drives());
for(i=0;i<storage_num_drives();i++)
{
#ifdef HAVE_HOTSWAP
if(storage_removable(i))
tb.lun_data->luns[i][1]=1;
else
#endif
tb.lun_data->luns[i][1]=0;
}
length = MIN(length, allocation_length);