From patchwork Sat Oct 13 00:26:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 191269 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 F07332C008A for ; Sat, 13 Oct 2012 11:27:16 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 444904A1A1; Sat, 13 Oct 2012 02:27:14 +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 9V8JcVScXH25; Sat, 13 Oct 2012 02:27:14 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 151094A1F7; Sat, 13 Oct 2012 02:26:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0E2D54A154 for ; Sat, 13 Oct 2012 02:26:51 +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 vvKtlNQQrs+O for ; Sat, 13 Oct 2012 02:26:50 +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 mail-gg0-f202.google.com (mail-gg0-f202.google.com [209.85.161.202]) by theia.denx.de (Postfix) with ESMTPS id 5F12B4A19D for ; Sat, 13 Oct 2012 02:26:47 +0200 (CEST) Received: by mail-gg0-f202.google.com with SMTP id i4so413277ggm.3 for ; Fri, 12 Oct 2012 17:26:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=b7McJVQL1yUq5JFPUDbufcsO/4vGZJKhF0rcEKJqHb4=; b=Wz3cCxUvLWnS4sKXdGoBBnf7+5g7JBYbxk0niYVoQY4RKn3pqndFwH7NyFkVWGbrnq 4M0gVzVrUigkrmYRJDEAP5Yozf+ynDTW9QIPjzhDP8bkkcAcXf3S0bgDIXAeLg2SesAD 50ZMOdvXxihT4W8jNjfUHJ9rtKFmaA5JXSoKwczAz9761aBZwxUW5ZoGHGL+8Dm0USRb vDQf/BjGSdx5BCXpCQyBYeadELyuWAjvYnRhQG76NWsry1aDJhZuxjj0FqGD5QBH4LTh v5jjoIzq3cFEzw34cs7FheuoUtjo4zqOzbVChGdPkk8LR2S2QyRwJKk2C0k2iEeY3BXc GxTA== Received: by 10.236.126.243 with SMTP id b79mr3841224yhi.35.1350088006465; Fri, 12 Oct 2012 17:26:46 -0700 (PDT) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id r7si405676anp.3.2012.10.12.17.26.46 (version=TLSv1/SSLv3 cipher=AES128-SHA); Fri, 12 Oct 2012 17:26:46 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id 355691E0043; Fri, 12 Oct 2012 17:26:46 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id D864D160DED; Fri, 12 Oct 2012 17:26:45 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 12 Oct 2012 17:26:08 -0700 Message-Id: <1350087972-1581-3-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1350087972-1581-1-git-send-email-sjg@chromium.org> References: <1350087972-1581-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQldWnrYZPZogM62AptLRvuGsjUadxfdjMf2vEzqFxCSIXY2x/moeiZFxrOEj0nvYnpgpfYUhGFX/iebx280ojpIjvPbM6+9BGhPMU5nTReC+HA9qqRND0ygJV6JOy9YEAmf2rfBaKZdYlldKni0f8+69YCi5Fv/MgKoJXrrmEV2/Q1pdJ9bulLuacwxS5x8IjuE1cha Cc: Tom Rini Subject: [U-Boot] [PATCH 3/7] disk: Make the disk partition code work with no specific partition types 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: Gabe Black Currently, if the disk partition code is compiled with all of the parition types compiled out, it hits an #error which stops the build. This change adjusts that file so that those functions will fall through to their defaults in those cases instead of breaking the build. These functions are needed because other code calls them, and that code is needed because other config options are overly broad and bring in support we don't need along with support we do. Also reduce repetition of the 6-term #ifdef throughout the file. Signed-off-by: Gabe Black Signed-off-by: Simon Glass --- disk/part.c | 50 +++++++++++++++++--------------------------------- 1 files changed, 17 insertions(+), 33 deletions(-) diff --git a/disk/part.c b/disk/part.c index 3022969..ec50516 100644 --- a/disk/part.c +++ b/disk/part.c @@ -35,12 +35,15 @@ #define PRINTF(fmt,args...) #endif +/* Rather than repeat this expression each time, add a define for it */ #if (defined(CONFIG_CMD_IDE) || \ defined(CONFIG_CMD_SATA) || \ defined(CONFIG_CMD_SCSI) || \ defined(CONFIG_CMD_USB) || \ defined(CONFIG_MMC) || \ defined(CONFIG_SYSTEMACE) ) +#define HAVE_BLOCK_DEVICE +#endif struct block_drvr { char *name; @@ -71,6 +74,7 @@ static const struct block_drvr block_drvr[] = { DECLARE_GLOBAL_DATA_PTR; +#ifdef HAVE_BLOCK_DEVICE block_dev_desc_t *get_dev(const char *ifname, int dev) { const struct block_drvr *drvr = block_drvr; @@ -104,12 +108,7 @@ block_dev_desc_t *get_dev(const char *ifname, int dev) } #endif -#if (defined(CONFIG_CMD_IDE) || \ - defined(CONFIG_CMD_SATA) || \ - defined(CONFIG_CMD_SCSI) || \ - defined(CONFIG_CMD_USB) || \ - defined(CONFIG_MMC) || \ - defined(CONFIG_SYSTEMACE) ) +#ifdef HAVE_BLOCK_DEVICE /* ------------------------------------------------------------------------- */ /* @@ -239,18 +238,7 @@ void dev_print (block_dev_desc_t *dev_desc) } #endif -#if (defined(CONFIG_CMD_IDE) || \ - defined(CONFIG_CMD_SATA) || \ - defined(CONFIG_CMD_SCSI) || \ - defined(CONFIG_CMD_USB) || \ - defined(CONFIG_MMC) || \ - defined(CONFIG_SYSTEMACE) ) - -#if defined(CONFIG_MAC_PARTITION) || \ - defined(CONFIG_DOS_PARTITION) || \ - defined(CONFIG_ISO_PARTITION) || \ - defined(CONFIG_AMIGA_PARTITION) || \ - defined(CONFIG_EFI_PARTITION) +#ifdef HAVE_BLOCK_DEVICE void init_part (block_dev_desc_t * dev_desc) { @@ -293,6 +281,12 @@ void init_part (block_dev_desc_t * dev_desc) } +#if defined(CONFIG_MAC_PARTITION) || \ + defined(CONFIG_DOS_PARTITION) || \ + defined(CONFIG_ISO_PARTITION) || \ + defined(CONFIG_AMIGA_PARTITION) || \ + defined(CONFIG_EFI_PARTITION) + static void print_part_header (const char *type, block_dev_desc_t * dev_desc) { puts ("\nPartition Map for "); @@ -326,6 +320,8 @@ static void print_part_header (const char *type, block_dev_desc_t * dev_desc) dev_desc->dev, type); } +#endif /* any CONFIG_..._PARTITION */ + void print_part (block_dev_desc_t * dev_desc) { @@ -372,24 +368,12 @@ void print_part (block_dev_desc_t * dev_desc) puts ("## Unknown partition table\n"); } - -#else /* neither MAC nor DOS nor ISO nor AMIGA nor EFI partition configured */ -# error neither CONFIG_MAC_PARTITION nor CONFIG_DOS_PARTITION -# error nor CONFIG_ISO_PARTITION nor CONFIG_AMIGA_PARTITION -# error nor CONFIG_EFI_PARTITION configured! -#endif - -#endif +#endif /* HAVE_BLOCK_DEVICE */ int get_partition_info(block_dev_desc_t *dev_desc, int part , disk_partition_t *info) { -#if defined(CONFIG_CMD_IDE) || \ - defined(CONFIG_CMD_SATA) || \ - defined(CONFIG_CMD_SCSI) || \ - defined(CONFIG_CMD_USB) || \ - defined(CONFIG_MMC) || \ - defined(CONFIG_SYSTEMACE) +#ifdef HAVE_BLOCK_DEVICE #ifdef CONFIG_PARTITION_UUIDS /* The common case is no UUID support */ @@ -444,7 +428,7 @@ int get_partition_info(block_dev_desc_t *dev_desc, int part default: break; } -#endif +#endif /* HAVE_BLOCK_DEVICE */ return -1; }