From patchwork Wed Oct 10 18:14:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 190802 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 0C3F02C008C for ; Thu, 11 Oct 2012 17:00:50 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 648D54A13F; Thu, 11 Oct 2012 08:00:48 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wMHrDexvMoa4; Thu, 11 Oct 2012 08:00:48 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9B4D24A141; Thu, 11 Oct 2012 08:00:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A5D524A141 for ; Thu, 11 Oct 2012 08:00:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FKOKrG+bWAsC for ; Thu, 11 Oct 2012 08:00:43 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from avon.wwwdotorg.org (avon.wwwdotorg.org [70.85.31.133]) by theia.denx.de (Postfix) with ESMTPS id 2D06A4A0C7 for ; Thu, 11 Oct 2012 08:00:41 +0200 (CEST) Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id C34AC622B; Wed, 10 Oct 2012 12:14:20 -0600 (MDT) Received: from localhost.localdomain (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 02968E4104; Wed, 10 Oct 2012 12:14:08 -0600 (MDT) From: Stephen Warren To: Tom Rini Date: Wed, 10 Oct 2012 12:14:00 -0600 Message-Id: <1349892842-11994-2-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1349892842-11994-1-git-send-email-swarren@wwwdotorg.org> References: <1349892842-11994-1-git-send-email-swarren@wwwdotorg.org> X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.96.5 at avon.wwwdotorg.org X-Virus-Status: Clean Cc: u-boot@lists.denx.de, Stephen Warren , Rob Herring Subject: [U-Boot] [PATCH V3 2/4] FAT: make use of disk_partition_t.part X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 --- v3: No change. 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;