From patchwork Wed Sep 5 19:37:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 146036 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp5340702ljw; Wed, 5 Sep 2018 12:38:24 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYmtGoCiZWkc3sfZp5dSB1DwTLtH0UZhW9Zu8ZkEz+hhEX5/8HT04eqfDXDspTPhKo0/AwJ X-Received: by 2002:aa7:8591:: with SMTP id w17-v6mr42415181pfn.77.1536176304640; Wed, 05 Sep 2018 12:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536176304; cv=none; d=google.com; s=arc-20160816; b=bDkjg6g9i6EJrUTGK0J9HPoy4KDd6LG597bCqZN9KWmXzZ2chmqTZ9t7S2RHIs/twg 7I2R+eTpyf3uRVSiNUyHOh7y0SvvUaGa6WdxrCWjfT2z0Y+kbPUzOfAsoVNb1sUvEvZI twq3ETiWREQm9L5FdngKxkDInQqNpzWOuB1zzi8AsbLf39VBtViy9iV64KBhnt8KmiqG RvYo1K+7nQbRnGLLm6AGUv4kNV/DJnvGMUKOBClBGSNEV2pLn8uiH+m5SxkbFjtcqpB4 fwb1Xr03wm7ioeXcl//An8TrCNNOAduQrjhzydWTn5qRWpcYhj/POVcrpNtwjvfdT2lu 65Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=UaR34K7qLbNcCLw0wKWUg6RGN//yoBhDn2ndX1R0DnQ=; b=N3bZgNm+J0di9XegcwVGcUJbOLB1Vj0c1R5uamIaqUETybx3myDK1v5Qym+yYmAkG0 Jqbr592MeiJOsrqANN6sI4GQUri30XeloYV548De3T+It0jbYo/ph5v6ASTEZ/1AIsub DjO0oDN/hMfX4T+32WiV7egO2woWqF27hTsekWOlBMri/J32Jm6EtnEaM49GhY3Gi4M2 fzmCbMHRxQ9IrLlK71dGVV0bnuF2TVBKRlxMF7EEzL+oVhYYgUfN/XAtQeKgO/13AkWy TyNIjMiAItJ5QZHzLS/WXn2ZgeR2E343plCyik1PEzKKv7QRyAYruct2nUq/7DwUnKOE OITA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a27-v6si2927647pfh.164.2018.09.05.12.38.24; Wed, 05 Sep 2018 12:38:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727644AbeIFAKA (ORCPT + 6 others); Wed, 5 Sep 2018 20:10:00 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:45535 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728206AbeIFAJj (ORCPT ); Wed, 5 Sep 2018 20:09:39 -0400 Received: by mail-oi0-f67.google.com with SMTP id t68-v6so15895746oie.12; Wed, 05 Sep 2018 12:38:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UaR34K7qLbNcCLw0wKWUg6RGN//yoBhDn2ndX1R0DnQ=; b=uCc9e/72u13+Mi94FibBBdLF3DytcFlN1y3nLtM7QKYgtLfA/teWYV2ZN/5FJ+9v9C /BMLJ1CndE69cDhmIQhM+S455XWkxrmVZXAY486satQ4MmrFPw2z1axz9LrOw3W4sf0J G47LkECAniA1hu+qHWv4et31e3fJDdzlJ3DazVcGv9HU6B6KvB4KWCFQ+Lj/FIzzAIsZ hXqZUdG+1FpMq3EwXZ2cOBLKmMQNEnM76B6YNBzIrUNgVtadsE8rIr+2QBjXpp2rXHgm IM8Xpr+2ze6UA559lKdP18BXkw0PdJSkMips47BmSJJkhzVpPj4xhs8NGuziuO5saj8B mb3A== X-Gm-Message-State: APzg51ABOynwt3nI7uQNGXBr3UoouIxCBZAkH3YWBxoZFqRcNn8rTx86 wkGa17aiBM8h1pKuBH0CO1ni8Q0= X-Received: by 2002:aca:4455:: with SMTP id r82-v6mr33048297oia.260.1536176280833; Wed, 05 Sep 2018 12:38:00 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id u21-v6sm2296053oie.22.2018.09.05.12.37.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 12:38:00 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Borislav Petkov , Mauro Carvalho Chehab , linux-edac@vger.kernel.org Subject: [PATCH 18/21] edac: cpc925: use for_each_of_cpu_node iterator Date: Wed, 5 Sep 2018 14:37:35 -0500 Message-Id: <20180905193738.19325-19-robh@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180905193738.19325-1-robh@kernel.org> References: <20180905193738.19325-1-robh@kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Use the for_each_of_cpu_node iterator to iterate over cpu nodes. This has the side effect of defaulting to iterating using "cpu" node names in preference to the deprecated (for FDT) device_type == "cpu". Cc: Borislav Petkov Cc: Mauro Carvalho Chehab Cc: linux-edac@vger.kernel.org Signed-off-by: Rob Herring --- Please ack and I will take via the DT tree. This is dependent on the first 2 patches. drivers/edac/cpc925_edac.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) -- 2.17.1 Acked-by: Borislav Petkov diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c index 2c98e020df05..3c0881ac9880 100644 --- a/drivers/edac/cpc925_edac.c +++ b/drivers/edac/cpc925_edac.c @@ -593,8 +593,7 @@ static void cpc925_mc_check(struct mem_ctl_info *mci) /******************** CPU err device********************************/ static u32 cpc925_cpu_mask_disabled(void) { - struct device_node *cpus; - struct device_node *cpunode = NULL; + struct device_node *cpunode; static u32 mask = 0; /* use cached value if available */ @@ -603,20 +602,8 @@ static u32 cpc925_cpu_mask_disabled(void) mask = APIMASK_ADI0 | APIMASK_ADI1; - cpus = of_find_node_by_path("/cpus"); - if (cpus == NULL) { - cpc925_printk(KERN_DEBUG, "No /cpus node !\n"); - return 0; - } - - while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) { + for_each_of_cpu_node(cpunode) { const u32 *reg = of_get_property(cpunode, "reg", NULL); - - if (strcmp(cpunode->type, "cpu")) { - cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n", cpunode->name); - continue; - } - if (reg == NULL || *reg > 2) { cpc925_printk(KERN_ERR, "Bad reg value at %pOF\n", cpunode); continue; @@ -633,9 +620,6 @@ static u32 cpc925_cpu_mask_disabled(void) "Assuming PI id is equal to CPU MPIC id!\n"); } - of_node_put(cpunode); - of_node_put(cpus); - return mask; }