From patchwork Thu Jul 5 14:32:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 1161161 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 5C3DB40ABE for ; Thu, 5 Jul 2012 14:55:26 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SmnMJ-0000PC-Lp; Thu, 05 Jul 2012 14:48:43 +0000 Received: from mail-wg0-f49.google.com ([74.125.82.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Smn6w-0004lZ-Uo for linux-arm-kernel@lists.infradead.org; Thu, 05 Jul 2012 14:32:56 +0000 Received: by wgbds1 with SMTP id ds1so5793746wgb.18 for ; Thu, 05 Jul 2012 07:32:42 -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:x-gm-message-state; bh=F11j3XeDyqR3dECRJwWzUl0FNOfyQKf+Zot+zAVA4tQ=; b=lkAG33o8mqdUGDM9hqgIv8jiTuCwLo5AhErdWCKOz3cV0btfUqtC78FPvTLI4ywSir umaC+ulrjbH3cIEJ250h+OxGkcJN5J7T5nWA+itaiC98/wSmzClnPMdEMk55OxBHImgR Ldv7d7RI5Z/KkSg90C4hpxgzvfHX6fV38z7/buuglmfSKicybFZRIPeX6tnFq1L2KWCa HVlwQXb8EzYhG3ANHv0G0sg4kFuC4ed1eA1z1vADdp8RKcCHRHXxc25KzRVcJnN9W52S WdlbYPCX8qtjmUUudCJ5Urk/5c0ccviCKktCNSTsVQbCoExgCm+1eNy3v+acTu9olsM5 4L9Q== Received: by 10.216.195.19 with SMTP id o19mr8713782wen.207.1341498761947; Thu, 05 Jul 2012 07:32:41 -0700 (PDT) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id l5sm468507wix.5.2012.07.05.07.32.40 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Jul 2012 07:32:41 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] of: address: Don't fail a lookup just because a node has no reg property Date: Thu, 5 Jul 2012 15:32:34 +0100 Message-Id: <1341498754-30445-1-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQnh3AeRjZ5iUBSrGxidh55I6H79heaWr4hkqUzg8pGbOsiNvUfZ9aZ+l/3Xohvq6ZC0ySF7 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linus.walleij@stericsson.com, arnd@arndb.de, devicetree-discuss@lists.ozlabs.org, rob.herring@calxeda.com, grant.likely@secretlab.ca, STEricsson_nomadik_linux@list.st.com, Lee Jones X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Sometimes it doesn't make any sense for a node to have an address. In this case device lookup will always be unsuccessful because we currently assume every node will have a reg property. This patch changes the semantics so that the resource address and the lookup address will only be compared if one exists. Things like AUXDATA() rely on of_dev_lookup to return the lookup entry of a particular device in order to do things like apply platform_data to a device. However, this is currently broken for nodes which do not have a reg property, meaning that platform_data can not be passed in those cases. Acked-by: Arnd Bergmann Signed-off-by: Lee Jones Acked-by: Linus Walleij Acked-by: Rob Herring --- drivers/of/platform.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 343ad29..9600480 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -317,10 +317,9 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l for(; lookup->compatible != NULL; lookup++) { if (!of_device_is_compatible(np, lookup->compatible)) continue; - if (of_address_to_resource(np, 0, &res)) - continue; - if (res.start != lookup->phys_addr) - continue; + if (!of_address_to_resource(np, 0, &res)) + if (res.start != lookup->phys_addr) + continue; pr_debug("%s: devname=%s\n", np->full_name, lookup->name); return lookup; }