From patchwork Mon Jan 26 16:22:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 43763 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9F13E20D5D for ; Mon, 26 Jan 2015 16:23:45 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gm9sf4854978lab.0 for ; Mon, 26 Jan 2015 08:23:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=b84p02KvtE3hVG6pI1Dex/xiyeJzBaByKCTxEUdKlsE=; b=WHkj5QROQ7cEnabN7yvGJx6yXvxvnkuUK8kVu732yHMoy1J3uxmoEfb4y+fMSirF32 bAN/zHSGxr4ECEn2URTHaGJYI5OoI5plW8SOZlvRdLw67c3B1xk1IchPJvpIbLss/xYL iM0D/i+Va/d8k0Z423utMyjbjB/rzpNdMbJucGtJ4dlrTeO+GT1SUpq4cpDwxKNeC7mD 8VAWLvtRAsIv4fLyGuZNXC9tJEPq9lyt3VHKiqD5PrOMt8JLf5bijL/6vZXChN/D8Tb2 Vq4zfYqFjDmjFcACGhnDD5XNYt6M2cWwZyTN31NoAR0kOL6VPvuJAsY0MtyQkEyYxvyY wGug== X-Gm-Message-State: ALoCoQnwq7bKB2T7Fu58wbQR1kCP4BB4aBMjugsaOR7IpPayDHEOxFLprP/N73dzgTsgW0nvrEaK X-Received: by 10.152.87.15 with SMTP id t15mr1393601laz.9.1422289424607; Mon, 26 Jan 2015 08:23:44 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.131 with SMTP id am3ls432500lac.47.gmail; Mon, 26 Jan 2015 08:23:44 -0800 (PST) X-Received: by 10.153.7.100 with SMTP id db4mr22061945lad.79.1422289424399; Mon, 26 Jan 2015 08:23:44 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id c4si9407470lbv.53.2015.01.26.08.23.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 Jan 2015 08:23:44 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id u14so8413976lbd.2 for ; Mon, 26 Jan 2015 08:23:44 -0800 (PST) X-Received: by 10.152.44.228 with SMTP id h4mr21017963lam.31.1422289424282; Mon, 26 Jan 2015 08:23:44 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp828543lbj; Mon, 26 Jan 2015 08:23:43 -0800 (PST) X-Received: by 10.68.242.163 with SMTP id wr3mr33542957pbc.159.1422289420250; Mon, 26 Jan 2015 08:23:40 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1si12748861pat.153.2015.01.26.08.23.39; Mon, 26 Jan 2015 08:23:40 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756297AbbAZQXX (ORCPT + 28 others); Mon, 26 Jan 2015 11:23:23 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:42941 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752596AbbAZQXT (ORCPT ); Mon, 26 Jan 2015 11:23:19 -0500 Received: by mail-pa0-f49.google.com with SMTP id fa1so12562436pad.8 for ; Mon, 26 Jan 2015 08:23:19 -0800 (PST) X-Received: by 10.68.133.165 with SMTP id pd5mr35915301pbb.13.1422289399111; Mon, 26 Jan 2015 08:23:19 -0800 (PST) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [70.73.24.112]) by mx.google.com with ESMTPSA id gr7sm10111137pbc.75.2015.01.26.08.23.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Jan 2015 08:23:18 -0800 (PST) From: mathieu.poirier@linaro.org To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/9] coresight: fixing CPU hwid lookup in device tree Date: Mon, 26 Jan 2015 09:22:23 -0700 Message-Id: <1422289345-2084-8-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422289345-2084-1-git-send-email-mathieu.poirier@linaro.org> References: <1422289345-2084-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mathieu.poirier@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Mathieu Poirier Some DT specification will represent CPU nodes with address cells greater than one, making the current code fail. Using the proper retrieval helper function ensure the correct hwid for CPUs is read properly with different address cell size. Signed-off-by: Mathieu Poirier --- drivers/coresight/of_coresight.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/coresight/of_coresight.c b/drivers/coresight/of_coresight.c index 9a5ff56f34d9..c3efa418a86d 100644 --- a/drivers/coresight/of_coresight.c +++ b/drivers/coresight/of_coresight.c @@ -117,7 +117,7 @@ struct coresight_platform_data *of_get_coresight_platform_data( struct coresight_platform_data *pdata; struct of_endpoint endpoint, rendpoint; struct device *rdev; - struct device_node *cpu; + struct device_node *dn; struct device_node *ep = NULL; struct device_node *rparent = NULL; struct device_node *rport = NULL; @@ -186,14 +186,16 @@ struct coresight_platform_data *of_get_coresight_platform_data( /* Affinity defaults to CPU0 */ pdata->cpu = 0; - cpu = of_parse_phandle(node, "cpu", 0); - if (cpu) { - const u32 *mpidr; + dn = of_parse_phandle(node, "cpu", 0); + if (dn) { + const u32 *cell; int len, index; + u64 hwid; - mpidr = of_get_property(cpu, "reg", &len); - if (mpidr && len == 4) { - index = get_logical_index(be32_to_cpup(mpidr)); + cell = of_get_property(dn, "reg", &len); + if (cell) { + hwid = of_read_number(cell, of_n_addr_cells(dn)); + index = get_logical_index(hwid); if (index != -EINVAL) pdata->cpu = index; }