summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2010-05-29 20:44:09 +0000
committerFrank Gevaerts <frank@gevaerts.be>2010-05-29 20:44:09 +0000
commitacf98d9e7f98ccd5f57ceaed1f6c4874af3dae10 (patch)
tree0b9c7b08d2ce4bf9f10941df2b81e4d8c56b8fd9
parentc401eecd26344ad0d4c69c66b8c71c1bb5b9b631 (diff)
downloadrockbox-acf98d9e7f98ccd5f57ceaed1f6c4874af3dae10.tar.gz
rockbox-acf98d9e7f98ccd5f57ceaed1f6c4874af3dae10.zip
fix broken case handling in storage_present() and storage_removable(). Those were buggy for targets with a hotswappable drive *and* more than one storage driver (i.e. only the D2 was probably affected)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26395 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/storage.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/firmware/storage.c b/firmware/storage.c
index 1dd315948c..fd8ed60aba 100644
--- a/firmware/storage.c
+++ b/firmware/storage.c
@@ -581,8 +581,6 @@ void storage_get_info(int drive, struct storage_info *info)
581#ifdef HAVE_HOTSWAP 581#ifdef HAVE_HOTSWAP
582bool storage_removable(int drive) 582bool storage_removable(int drive)
583{ 583{
584 bool ret = false;
585
586 int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; 584 int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET;
587 int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; 585 int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET;
588 586
@@ -590,37 +588,36 @@ bool storage_removable(int drive)
590 { 588 {
591#if (CONFIG_STORAGE & STORAGE_ATA) 589#if (CONFIG_STORAGE & STORAGE_ATA)
592 case STORAGE_ATA: 590 case STORAGE_ATA:
593 ret = ata_removable(ldrive); 591 return ata_removable(ldrive);
594#endif 592#endif
595 593
596#if (CONFIG_STORAGE & STORAGE_MMC) 594#if (CONFIG_STORAGE & STORAGE_MMC)
597 case STORAGE_MMC: 595 case STORAGE_MMC:
598 ret = mmc_removable(ldrive); 596 return mmc_removable(ldrive);
599#endif 597#endif
600 598
601#if (CONFIG_STORAGE & STORAGE_SD) 599#if (CONFIG_STORAGE & STORAGE_SD)
602 case STORAGE_SD: 600 case STORAGE_SD:
603 ret = sd_removable(ldrive); 601 return sd_removable(ldrive);
604#endif 602#endif
605 603
606#if (CONFIG_STORAGE & STORAGE_NAND) 604#if (CONFIG_STORAGE & STORAGE_NAND)
607 case STORAGE_NAND: 605 case STORAGE_NAND:
608 ret = false; 606 return false;
609#endif 607#endif
610 608
611#if (CONFIG_STORAGE & STORAGE_RAMDISK) 609#if (CONFIG_STORAGE & STORAGE_RAMDISK)
612 case STORAGE_RAMDISK: 610 case STORAGE_RAMDISK:
613 ret = false; 611 return false;
614#endif 612#endif
613
614 default:
615 return false;
615 } 616 }
616
617 return ret;
618} 617}
619 618
620bool storage_present(int drive) 619bool storage_present(int drive)
621{ 620{
622 bool ret = false;
623
624 int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; 621 int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET;
625 int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; 622 int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET;
626 623
@@ -628,31 +625,35 @@ bool storage_present(int drive)
628 { 625 {
629#if (CONFIG_STORAGE & STORAGE_ATA) 626#if (CONFIG_STORAGE & STORAGE_ATA)
630 case STORAGE_ATA: 627 case STORAGE_ATA:
631 ret = ata_present(ldrive); 628 return ata_present(ldrive);
632#endif 629#endif
633 630
634#if (CONFIG_STORAGE & STORAGE_MMC) 631#if (CONFIG_STORAGE & STORAGE_MMC)
635 case STORAGE_MMC: 632 case STORAGE_MMC:
636 ret = mmc_present(ldrive); 633 return mmc_present(ldrive);
637#endif 634#endif
638 635
639#if (CONFIG_STORAGE & STORAGE_SD) 636#if (CONFIG_STORAGE & STORAGE_SD)
640 case STORAGE_SD: 637 case STORAGE_SD:
641 ret = sd_present(ldrive); 638 return sd_present(ldrive);
639 break;
642#endif 640#endif
643 641
644#if (CONFIG_STORAGE & STORAGE_NAND) 642#if (CONFIG_STORAGE & STORAGE_NAND)
645 case STORAGE_NAND: 643 case STORAGE_NAND:
646 ret = true; 644 return true;
645 break;
647#endif 646#endif
648 647
649#if (CONFIG_STORAGE & STORAGE_RAMDISK) 648#if (CONFIG_STORAGE & STORAGE_RAMDISK)
650 case STORAGE_RAMDISK: 649 case STORAGE_RAMDISK:
651 ret = true; 650 return true;
651 break;
652#endif 652#endif
653
654 default:
655 return false;
653 } 656 }
654
655 return ret;
656} 657}
657#endif 658#endif
658 659