From patchwork Tue Oct 9 20:41:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot,V2,2/3] FAT: make use of disk_partition_t.part Date: Tue, 09 Oct 2012 10:41:40 -0000 From: Stephen Warren X-Patchwork-Id: 190444 Message-Id: <1349815301-1412-2-git-send-email-swarren@wwwdotorg.org> To: Tom Rini Cc: u-boot@lists.denx.de, Stephen Warren , Rob Herring From: Stephen Warren This removes the standalone cur_part_nr variable, opening the way to replacing fat_register_device() with fat_set_blk_dev(). Note that when get_partition_info() fails and we use the entire disk, the correct partition number is 0 (whole disk) not 1 (first partition), so that change is also made here. An alternative to this (and the previous) patch might be to simply remove the partition number from the printf(). I don't know how attached people are to it. Signed-off-by: Stephen Warren --- v2: No change. --- fs/fat/fat.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 80156c8..1e0d2a3 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -46,7 +46,6 @@ static void downcase(char *str) } static block_dev_desc_t *cur_dev; -static unsigned int cur_part_nr; static disk_partition_t cur_part_info; #define DOS_BOOT_MAGIC_OFFSET 0x1fe @@ -79,7 +78,6 @@ int fat_register_device(block_dev_desc_t * dev_desc, int part_no) /* Read the partition table, if present */ if (!get_partition_info(dev_desc, part_no, &cur_part_info)) { cur_dev = dev_desc; - cur_part_nr = part_no; } #endif @@ -92,7 +90,7 @@ int fat_register_device(block_dev_desc_t * dev_desc, int part_no) } cur_dev = dev_desc; - cur_part_nr = 1; + cur_part_info.part = 0; cur_part_info.start = 0; cur_part_info.size = dev_desc->lba; cur_part_info.blksz = dev_desc->blksz; @@ -1235,7 +1233,7 @@ int file_fat_detectfs(void) vol_label[11] = '\0'; volinfo.fs_type[5] = '\0'; - printf("Partition %d: Filesystem: %s \"%s\"\n", cur_part_nr, + printf("Partition %d: Filesystem: %s \"%s\"\n", cur_part_info.part, volinfo.fs_type, vol_label); return 0;