[PATCH 1/1] fs: fat: fix file_fat_detectfs()

Heinrich Schuchardt xypron.glpk at gmx.de
Sat Mar 27 13:06:30 CET 2021


Up to now file_fat_detectfs() did not detect some interface types like
EFI, HOST, VIRTIO.

Avoid duplicate code by calling blk_get_if_type_name().

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 fs/fat/fat.c | 36 ++----------------------------------
 1 file changed, 2 insertions(+), 34 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index ccba268f61..363e981fb2 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -1147,41 +1147,9 @@ int file_fat_detectfs(void)
 		return 1;
 	}

-#if defined(CONFIG_IDE) || \
-    defined(CONFIG_SATA) || \
-    defined(CONFIG_SCSI) || \
-    defined(CONFIG_CMD_USB) || \
-    defined(CONFIG_MMC)
-	printf("Interface:  ");
-	switch (cur_dev->if_type) {
-	case IF_TYPE_IDE:
-		printf("IDE");
-		break;
-	case IF_TYPE_SATA:
-		printf("SATA");
-		break;
-	case IF_TYPE_SCSI:
-		printf("SCSI");
-		break;
-	case IF_TYPE_ATAPI:
-		printf("ATAPI");
-		break;
-	case IF_TYPE_USB:
-		printf("USB");
-		break;
-	case IF_TYPE_DOC:
-		printf("DOC");
-		break;
-	case IF_TYPE_MMC:
-		printf("MMC");
-		break;
-	default:
-		printf("Unknown");
-	}
-
-	printf("\n  Device %d: ", cur_dev->devnum);
+	printf("Interface:  %s\n", blk_get_if_type_name(cur_dev->if_type));
+	printf("  Device %d: ", cur_dev->devnum);
 	dev_print(cur_dev);
-#endif

 	if (read_bootsectandvi(&bs, &volinfo, &fatsize)) {
 		printf("\nNo valid FAT fs found\n");
--
2.30.2



More information about the U-Boot mailing list