From patchwork Thu Nov 24 03:54:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 127421 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 DADFD1007FF for ; Thu, 24 Nov 2011 14:55:18 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 43CF328213; Thu, 24 Nov 2011 04:55:17 +0100 (CET) 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 cRW3tqLrz+BY; Thu, 24 Nov 2011 04:55:16 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 190EC28205; Thu, 24 Nov 2011 04:55:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 51BD628205 for ; Thu, 24 Nov 2011 04:55:13 +0100 (CET) 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 GN2EkZ1oMhuO for ; Thu, 24 Nov 2011 04:55:12 +0100 (CET) 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-ww0-f74.google.com (mail-ww0-f74.google.com [74.125.82.74]) by theia.denx.de (Postfix) with ESMTPS id C6A1528201 for ; Thu, 24 Nov 2011 04:55:11 +0100 (CET) Received: by wwp14 with SMTP id 14so21398wwp.3 for ; Wed, 23 Nov 2011 19:55:10 -0800 (PST) Received: by 10.14.9.214 with SMTP id 62mr604189eet.15.1322106910644; Wed, 23 Nov 2011 19:55:10 -0800 (PST) Received: by 10.14.9.214 with SMTP id 62mr604165eet.15.1322106910488; Wed, 23 Nov 2011 19:55:10 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id 4si12593564eew.1.2011.11.23.19.55.10 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 23 Nov 2011 19:55:10 -0800 (PST) Received: from wpaz9.hot.corp.google.com (wpaz9.hot.corp.google.com [172.24.198.73]) by hpza10.eem.corp.google.com (Postfix) with ESMTPS id 2EFA020004E; Wed, 23 Nov 2011 19:55:10 -0800 (PST) Received: from sglass.mtv.corp.google.com (sglass.mtv.corp.google.com [172.22.72.144]) by wpaz9.hot.corp.google.com with ESMTP id pAO3t7go004247; Wed, 23 Nov 2011 19:55:07 -0800 Received: by sglass.mtv.corp.google.com (Postfix, from userid 121222) id 66A8414091E; Wed, 23 Nov 2011 19:55:07 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Wed, 23 Nov 2011 19:54:43 -0800 Message-Id: <1322106896-23054-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.3.1 X-System-Of-Record: true Cc: Devicetree Discuss , Albert ARIBAUD , Tom Warren Subject: [U-Boot] [PATCH 01/14] fdt: Tidy up a few fdtdec problems 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 This fixes three trivial issues in fdtdec.c: 1. fdtdec_get_is_enabled() doesn't really need a default value 2. The fdt must be word-aligned, since otherwise it will fail on ARM 3. The compat_names[] array is missing its first element Signed-off-by: Simon Glass --- include/fdtdec.h | 8 ++++---- lib/fdtdec.c | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/fdtdec.h b/include/fdtdec.h index d871cdd..9018181 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -112,14 +112,14 @@ s32 fdtdec_get_int(const void *blob, int node, const char *prop_name, * Checks whether a node is enabled. * This looks for a 'status' property. If this exists, then returns 1 if * the status is 'ok' and 0 otherwise. If there is no status property, - * it returns the default value. + * it returns 1 on the assumption that anything mentioned should be enabled + * by default. * * @param blob FDT blob * @param node node to examine - * @param default_val default value to return if no 'status' property exists - * @return integer value 0/1, if found, or default_val if not + * @return integer value 0 (not enabled) or 1 (enabled) */ -int fdtdec_get_is_enabled(const void *blob, int node, int default_val); +int fdtdec_get_is_enabled(const void *blob, int node); /** * Checks whether we have a valid fdt available to control U-Boot, and panic diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 0f87163..d1321a8 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -33,6 +33,7 @@ DECLARE_GLOBAL_DATA_PTR; */ #define COMPAT(id, name) name static const char * const compat_names[COMPAT_COUNT] = { + COMPAT(UNKNOWN, ""), }; /** @@ -84,14 +85,14 @@ s32 fdtdec_get_int(const void *blob, int node, const char *prop_name, return default_val; } -int fdtdec_get_is_enabled(const void *blob, int node, int default_val) +int fdtdec_get_is_enabled(const void *blob, int node) { const char *cell; cell = fdt_getprop(blob, node, "status", NULL); if (cell) return 0 == strcmp(cell, "ok"); - return default_val; + return 1; } enum fdt_compat_id fd_dec_lookup(const void *blob, int node) @@ -140,7 +141,7 @@ int fdtdec_next_alias(const void *blob, const char *name, int fdtdec_check_fdt(void) { /* We must have an fdt */ - if (fdt_check_header(gd->fdt_blob)) + if (((uintptr_t)gd->fdt_blob & 3) || fdt_check_header(gd->fdt_blob)) panic("No valid fdt found - please append one to U-Boot\n" "binary or define CONFIG_OF_EMBED\n"); return 0;