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: 9852 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7779C23E2F for ; Thu, 5 Jul 2012 14:32:45 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 38A13A187D3 for ; Thu, 5 Jul 2012 14:32:45 +0000 (UTC) Received: by ghbz12 with SMTP id z12so8073939ghb.11 for ; Thu, 05 Jul 2012 07:32:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=F11j3XeDyqR3dECRJwWzUl0FNOfyQKf+Zot+zAVA4tQ=; b=RIiLz0J76bjjaSTX0dWYIerCC9QCN/XXdQshxJqpJXO0HeP3uUtD08xuHPJqXaPo2z vJjzrtifMLR1j0QpBb07gNjvoenh/wq3ENhFkMYia8Uzb71cCXusKg9898HSiL3SuYTL U8+mx2VEXc2gnIK1UYWnmYa3N+tsgOtXkp05iY5hqpmW9R/Uqt2/SREh82LLBv62w12Z LTYyn73a8lu3yfK/cAgpQbfFM/2rmUZH9Jj7nKmWeNAj7DQoUkRGfds4i9BCyfkp5oGN MrRZTH6RDOc7GptFv95jqgVUTcxvOwp1lqZ470Lgnbd1a3YATOG4SKtLDhv38iyZO3O4 99cg== Received: by 10.42.89.72 with SMTP id f8mr13727989icm.33.1341498764559; Thu, 05 Jul 2012 07:32:44 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp66642ibb; Thu, 5 Jul 2012 07:32:43 -0700 (PDT) Received: by 10.216.209.95 with SMTP id r73mr9006734weo.157.1341498762667; Thu, 05 Jul 2012 07:32:42 -0700 (PDT) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id bm8si385155wib.11.2012.07.05.07.32.42 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 05 Jul 2012 07:32:42 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by werf13 with SMTP id f13so7555793wer.37 for ; Thu, 05 Jul 2012 07:32:42 -0700 (PDT) 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 Cc: STEricsson_nomadik_linux@list.st.com, linus.walleij@stericsson.com, arnd@arndb.de, grant.likely@secretlab.ca, rob.herring@calxeda.com, devicetree-discuss@lists.ozlabs.org, Lee Jones 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: ALoCoQlgUvTOuwqICZV1/jaNn1tHDpPzEuHmvcE8JLRlYcgyElEdfy3tfOPhqCjiIKLX9AT0XV8c 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 --- 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; }