From patchwork Tue Feb 11 16:24:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Cartwright X-Patchwork-Id: 3628121 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C80E69F2F6 for ; Tue, 11 Feb 2014 16:33:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF9362014A for ; Tue, 11 Feb 2014 16:33:58 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 106752012E for ; Tue, 11 Feb 2014 16:33:58 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WDGG0-0004jI-VS; Tue, 11 Feb 2014 16:32:25 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WDGB6-0000DN-Nz; Tue, 11 Feb 2014 16:27:20 +0000 Received: from smtp.codeaurora.org ([198.145.11.231]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WDGAZ-00007g-Ax for linux-arm-kernel@lists.infradead.org; Tue, 11 Feb 2014 16:26:49 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 81A3A13F1F4; Tue, 11 Feb 2014 16:26:27 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 7309113F308; Tue, 11 Feb 2014 16:26:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from joshc.qualcomm.com (rrcs-67-52-129-61.west.biz.rr.com [67.52.129.61]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: joshc@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C546813F1F4; Tue, 11 Feb 2014 16:26:25 +0000 (UTC) Received: by joshc.qualcomm.com (Postfix, from userid 1000) id 29FB3613F2; Tue, 11 Feb 2014 10:24:08 -0600 (CST) From: Josh Cartwright To: Andrew Victor , Nicolas Ferre , Jean-Christophe Plagniol-Villard Subject: [PATCH 3/8] ARM: at91: make use of of_find_matching_node_and_match Date: Tue, 11 Feb 2014 10:24:01 -0600 Message-Id: <1392135847-30791-4-git-send-email-joshc@codeaurora.org> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1392135847-30791-1-git-send-email-joshc@codeaurora.org> References: <1392135847-30791-1-git-send-email-joshc@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140211_112647_611130_BF0F8E61 X-CRM114-Status: GOOD ( 15.65 ) X-Spam-Score: -2.5 (--) Cc: devicetree@vger.kernel.org, Russell King , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of the of_find_matching_node()/of_match_node() pair, which requires two iterations through the match table, make use of of_find_matching_node_and_match(), which only iterates through the table once. While we're here, mark the rtsc id table const. Signed-off-by: Josh Cartwright Acked-by: Nicolas Ferre --- arch/arm/mach-at91/setup.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index f7ca97b..e884de8 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c @@ -352,7 +352,7 @@ void __init at91_ioremap_matrix(u32 base_addr) } #if defined(CONFIG_OF) -static struct of_device_id rstc_ids[] = { +static const struct of_device_id rstc_ids[] = { { .compatible = "atmel,at91sam9260-rstc", .data = at91sam9_alt_restart }, { .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart }, { /*sentinel*/ } @@ -363,7 +363,7 @@ static void at91_dt_rstc(void) struct device_node *np; const struct of_device_id *of_id; - np = of_find_matching_node(NULL, rstc_ids); + np = of_find_matching_node_and_match(NULL, rstc_ids, &of_id); if (!np) panic("unable to find compatible rstc node in dtb\n"); @@ -371,10 +371,6 @@ static void at91_dt_rstc(void) if (!at91_rstc_base) panic("unable to map rstc cpu registers\n"); - of_id = of_match_node(rstc_ids, np); - if (!of_id) - panic("AT91: rtsc no restart function available\n"); - arm_pm_restart = of_id->data; of_node_put(np); @@ -392,7 +388,7 @@ static void at91_dt_ramc(void) struct device_node *np; const struct of_device_id *of_id; - np = of_find_matching_node(NULL, ramc_ids); + np = of_find_matching_node_and_match(NULL, ramc_ids, &of_id); if (!np) panic("unable to find compatible ram controller node in dtb\n"); @@ -402,11 +398,7 @@ static void at91_dt_ramc(void) /* the controller may have 2 banks */ at91_ramc_base[1] = of_iomap(np, 1); - of_id = of_match_node(ramc_ids, np); - if (!of_id) - pr_warn("AT91: ramc no standby function available\n"); - else - at91_pm_set_standby(of_id->data); + at91_pm_set_standby(of_id->data); of_node_put(np); }