From patchwork Wed Sep 5 19:37:18 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: 146018 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp5340048ljw; Wed, 5 Sep 2018 12:37:44 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda/5GUvgtTm1zzZiLrqGJ6duwiWEgSKhHB2u2MO3IO/Z+qOuxM8pFMGcqbe/hEu8B9BH5Cd X-Received: by 2002:a62:435c:: with SMTP id q89-v6mr42559474pfa.135.1536176264126; Wed, 05 Sep 2018 12:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536176264; cv=none; d=google.com; s=arc-20160816; b=pJHZ9ggL2f86qps/hV89qM9ARePLtW9RPAhqVStca05f7W+FPKSvTsVoEg1i+JiXEs uXy7XT1Y7YDjCkQXrD89plhHwj0EZkKQs1RCD3Gmr2LEgrSsoKUvJnZBVvw5nHlr/cS/ D/ExkqGcG7lVTeuvudoAvZYBvuDXeebnR4qHr1SEN0Gx8lPnFmMapgPnmEZRTXQgBPKP Y+Hs+BM4MdlwDEw2/5NAUcEGaH3+P8k8Y151YHXx2weTEkySMzAtBISFcKTk9MyGuzFI qDR0Dk38+ATsGPoCARpoSikf2RdHCKL4BpLQRphfR5hR8Y/xZo0onG7TgE6rzzwxyjg1 Rkaw== 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=SZQ1f+JXN7jSVhs4sms8EAGGvJZEZgAKSw8PvyGN5W8=; b=xDkaQMqaAsZwmMhR6ahUyVuAgxRw8u3cg81uLdalC4JnjHodyKFw5NXzo7bFChK0Z7 HZM3JCKw8b75d+0UnAqVFZGzwFzN8k3yHFt9cu4hMbTfM9xCLz4wzDapi6tiNUlGZv15 KIYdY/KDHgvlbkR+AGW4kDH8lat1y7B48oBTBNnEcBI3etAe9NDVWjQ23M3o3TvgZ0T3 LY5vJ46AFLRsRLWxz2FbHWPa51U9hSehwF3qLR5ZQ5YpM9Bkfmy6BU9u3mI903YzjRLH 5BjB1J7BzXh4nLg4WKjbK1XzwLEYGV//ztN9IvmLb7WTSmkuL9kyyPbkvOeG0TxXXtRa C4YQ== 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 b2-v6si3197940plm.202.2018.09.05.12.37.43; Wed, 05 Sep 2018 12:37:44 -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 S1727871AbeIFAJU (ORCPT + 6 others); Wed, 5 Sep 2018 20:09:20 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:45470 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727575AbeIFAJU (ORCPT ); Wed, 5 Sep 2018 20:09:20 -0400 Received: by mail-oi0-f65.google.com with SMTP id t68-v6so15893887oie.12; Wed, 05 Sep 2018 12:37:42 -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=SZQ1f+JXN7jSVhs4sms8EAGGvJZEZgAKSw8PvyGN5W8=; b=S6n5f0fulcnaRJ6975CfoYP+masr/9rUjdyFlcSQG14GYTrk1OIU7oylc4nkdvxKi2 61KFfNUtJ40kq+GNZV821xlyc7J5Sr+Uw6ltChiKKiXr4wQXnap3AAFKc+QvZYJcxfmb peRp4RK6zWK8dBI4pCRdwbF1yuG5Cl5Sb0jyLcN42MJGAi0PU38DJbYnlCNcffGk5GYf MjlwbRmCsSueBfupPsWJfW6uznAuBRtQYeyouVhumnbpYvjESXsNJePGaFTGOHlhXe5V X/13abzj/eVB42YkVzCE+kFaNOh5OcKwQcsXosG0JknRUd8vrZKpI3HAgMmykOyyMLQc Q4Gg== X-Gm-Message-State: APzg51AwhTxnVV6b0WmLlktDHphoxAqNBIvl0N2SNGq6Ua4xuF+lK2g8 +yUOZDPWBm60CMPZDrBXU5XX5bQ= X-Received: by 2002:aca:aa06:: with SMTP id t6-v6mr33048339oie.152.1536176261939; Wed, 05 Sep 2018 12:37:41 -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.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 12:37:41 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Frank Rowand Subject: [PATCH 01/21] of: Add cpu node iterator for_each_of_cpu_node() Date: Wed, 5 Sep 2018 14:37:18 -0500 Message-Id: <20180905193738.19325-2-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 Iterating thru cpu nodes is a common pattern. Create a common iterator which can find child nodes either by node name or device_type == cpu. Using the former will allow for eventually dropping device_type properties which are deprecated for FDT. Cc: Frank Rowand Signed-off-by: Rob Herring --- drivers/of/base.c | 39 +++++++++++++++++++++++++++++++++++++++ include/linux/of.h | 11 +++++++++++ 2 files changed, 50 insertions(+) -- 2.17.1 Reviewed-by: Geert Uytterhoeven diff --git a/drivers/of/base.c b/drivers/of/base.c index a055cd1ef96d..4807db0a35b3 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -741,6 +741,45 @@ struct device_node *of_get_next_available_child(const struct device_node *node, } EXPORT_SYMBOL(of_get_next_available_child); +/** + * of_get_next_cpu_node - Iterate on cpu nodes + * @prev: previous child of the /cpus node, or NULL to get first + * + * Returns a cpu node pointer with refcount incremented, use of_node_put() + * on it when done. Returns NULL when prev is the last child. Decrements + * the refcount of prev. + */ +struct device_node *of_get_next_cpu_node(struct device_node *prev) +{ + struct device_node *next = NULL; + unsigned long flags; + struct device_node *node; + + if (!prev) + node = of_find_node_by_path("/cpus"); + + raw_spin_lock_irqsave(&devtree_lock, flags); + if (prev) + next = prev->sibling; + else if (node) { + next = node->child; + of_node_put(node); + } + for (; next; next = next->sibling) { + if (!(of_node_name_eq(next, "cpu") || + (next->type && !of_node_cmp(next->type, "cpu")))) + continue; + if (!__of_device_is_available(next)) + continue; + if (of_node_get(next)) + break; + } + of_node_put(prev); + raw_spin_unlock_irqrestore(&devtree_lock, flags); + return next; +} +EXPORT_SYMBOL(of_get_next_cpu_node); + /** * of_get_compatible_child - Find compatible child node * @parent: parent node diff --git a/include/linux/of.h b/include/linux/of.h index 99b0ebf49632..1aca0dbd35df 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -353,6 +353,8 @@ extern const void *of_get_property(const struct device_node *node, const char *name, int *lenp); extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); +extern struct device_node *of_get_next_cpu_node(struct device_node *prev); + #define for_each_property_of_node(dn, pp) \ for (pp = dn->properties; pp != NULL; pp = pp->next) @@ -754,6 +756,11 @@ static inline struct device_node *of_get_cpu_node(int cpu, return NULL; } +static inline struct device_node *of_get_next_cpu_node(struct device_node *prev) +{ + return NULL; +} + static inline int of_n_addr_cells(struct device_node *np) { return 0; @@ -1217,6 +1224,10 @@ static inline int of_property_read_s32(const struct device_node *np, for (child = of_get_next_available_child(parent, NULL); child != NULL; \ child = of_get_next_available_child(parent, child)) +#define for_each_of_cpu_node(cpu) \ + for (cpu = of_get_next_cpu_node(NULL); cpu != NULL; \ + cpu = of_get_next_cpu_node(cpu)) + #define for_each_node_with_property(dn, prop_name) \ for (dn = of_find_node_with_property(NULL, prop_name); dn; \ dn = of_find_node_with_property(dn, prop_name)) From patchwork Wed Sep 5 19:37:20 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: 146020 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp5340089ljw; Wed, 5 Sep 2018 12:37:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdadoZ3GTGsNsXmXncsjcycSE/bXAv8H9UQkyL9Y6l5H368ls/luHlMbhc7VibnLtWlJzVhl X-Received: by 2002:a17:902:32f:: with SMTP id 44-v6mr40086146pld.15.1536176266381; Wed, 05 Sep 2018 12:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536176266; cv=none; d=google.com; s=arc-20160816; b=KVKgNzdH11kOkJTmiLZVtcUf6bzIHtFct1BSCgyDWdCUHtm1yLvdW3XymkwFtcLNHA OzldBU5Q01YVjbOBglOvW22W5FvrwmRdQZ3wJi5O63sD0Xc+LkQu0uNRwsF/db4b2Ydj s5G/jYTZcr6wsBDpeeYFc1lN63y1ttcBT8JELeOMHIqVReUxKH9yqROzHnMGseUpLZKT 5osBdtHT9T9QhJue4iNUJhkH5CfTv0vdx33ueJdvZqCFgC6XdecKo1aFnWIBK6E7uBgI yEx09FuvhUwFNkgTJUi15XYqsUPSYBsXCrggD6OSLvGql7j6ftXqhNHdrKj9i+e7tMDf /5vw== 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=P8KAoGaqqdG0MEoqvgPjzWestWMNGhkRFyu8R356duA=; b=rJl7bStQj+04nlhA7ldCDFwni9AmvvXZWSoLu0pTFFrLftdnbMAkLB0ylOVfrd8kvG I5UdYyS37rzkINYQe6QxUPIsF42IAnpZf1cpVuuDb1QLIJbQIN4ssYSX9OiFGcZPnIQy qoxMAdjCg0YZArYEql+w+Igu/DTixthV1r0GEcR4k7ujPs1a4I38JDnQ35dRiZSFT5BN nZt6/fyCmyBbX+ggqdrce7I7Jn2iHLSe5mw1tixbEnbeX1zydqpjtX6+rAkKWG8uE/DC QZPUX6JxgMoLnGJsPck6mzoHs259ySvl7y0JCo+pjBbc/5VEQJ4bEhwUvQaXro05mqLn A67w== 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 h126-v6si3181436pfe.72.2018.09.05.12.37.46; Wed, 05 Sep 2018 12:37:46 -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 S1727844AbeIFAJW (ORCPT + 6 others); Wed, 5 Sep 2018 20:09:22 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:45481 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727837AbeIFAJW (ORCPT ); Wed, 5 Sep 2018 20:09:22 -0400 Received: by mail-oi0-f67.google.com with SMTP id t68-v6so15894088oie.12; Wed, 05 Sep 2018 12:37:44 -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=P8KAoGaqqdG0MEoqvgPjzWestWMNGhkRFyu8R356duA=; b=C2aUE40Xk2Sz5tyeCSEOtzaFlZPdiVqkRqJVLMKQ80UACKVPdL3epmkNmDDO8RWZvJ O1x9ihpJaRHz+TUz4O2R9YyQh61Z3TAVe3CcvYrCWN43vFyhp3rzPNu3T33B5pdomkri 6MQ5OzzsQ8Ps+5lZK39nJPV6R19O9JCOjzo4+1qV9cf4x+ldJaD9YfORvX38Xq2Yv3cc EUYd8HJwKD0V6WnWjt+qCGEh+2gcprUte8mBwPz94R4DuF95wbGxaknMHapb0f1PEPox MaHhY+VNMUHMPEFV+ght3yn8/XZkXMABzcxHETLzAignMCf+H3/bmUE5zT37ZYh4KESi x+qg== X-Gm-Message-State: APzg51DaFQ8ODJlm2YBhspV4bM9sayf74/MXOmhGg28ME2LcpghO65EW cQt2N4EfrFuteNJErWPLMCGlHLA= X-Received: by 2002:aca:720e:: with SMTP id p14-v6mr20428268oic.40.1536176263765; Wed, 05 Sep 2018 12:37:43 -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.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 12:37:43 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Russell King , linux-arm-kernel@lists.infradead.org Subject: [PATCH 03/21] ARM: use for_each_of_cpu_node iterator Date: Wed, 5 Sep 2018 14:37:20 -0500 Message-Id: <20180905193738.19325-4-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: Russell King Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Rob Herring --- Please ack and I will take via the DT tree. This is dependent on the first 2 patches. arch/arm/kernel/devtree.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.17.1 diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index ecaa68dd1af5..13bcd3b867cb 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -87,14 +87,11 @@ void __init arm_dt_init_cpu_maps(void) if (!cpus) return; - for_each_child_of_node(cpus, cpu) { + for_each_of_cpu_node(cpu) { const __be32 *cell; int prop_bytes; u32 hwid; - if (of_node_cmp(cpu->type, "cpu")) - continue; - pr_debug(" * %pOF...\n", cpu); /* * A device tree containing CPU nodes with missing "reg" From patchwork Wed Sep 5 19:37:25 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: 146024 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp5340177ljw; Wed, 5 Sep 2018 12:37:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZC2B/ayKK6PHAG9NkbY2e+bccZYvcaX4FQtacvUn5P+UdHb+vl+hdhmcXEgbWwArc0n13M X-Received: by 2002:a63:cc04:: with SMTP id x4-v6mr37475223pgf.33.1536176271581; Wed, 05 Sep 2018 12:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536176271; cv=none; d=google.com; s=arc-20160816; b=QIdwHQODS1MN2X2T4Y7BYieB1rOAdqql+gbCRYTWWlWf75lOQgn/y7BfydNSqEuioX 3rd5DuL3VV11Hwaog8pehS1ZKvTDAcC1iD2i3qUDxtTbpkzPS6Sagr47+9WVOQcEuuAP Fhz4e4lE7PWGelgPhvaWTGOCAIKrapH34Hwv0DgrD+M+7UfFCuTUqD3kh94jK/BHfGHQ Oj6k2YQb0CW8iGE0yhveL91T939yZByVTftFh8vRxUoh/YYbipehcdzoT/34K9a7Sp0X w0jT4l9NYlYjpk++YrpNAr0escoLF5R16eoN9d45xahinnVRN7RENiOdWfmSzo4ex9Jg xSCA== 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=BozMFRD6b8JP7Za+m/l6yQcG8PXXn63O1+XHPU/v3vQ=; b=oMZxwX1gxKSX3viwQO3AAjHbxc3pvis3u/Uxk/gjhriyqa4S0Oh8T2AvQDNLxM2g+o WB8O7Fdpm1Bl8VfrLcyAOEuylGZOFu9O9bSc6w0LPNvFdZidhnziaob8qR3JA6jjIIi+ NljOVq+kUzQUyI0MDEalrZ3pk1M2YxwPCWbI2N4fKZi+EwvCdo0/mncFn35YEA4c/PML yhFezK+4fBl5upyqLgl96NCSWLP+pI6JLQelPR+e70MC5KoAgm4u+NIjpra6Y+TW2lbx SN5E6mGdBTM/xNKh+sduX/1QqPFk8COoRgGBXQs1ugC0K5LFYwBk7ICzNnPnXyVQFxzB tZOw== 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 w190-v6si2614709pgd.482.2018.09.05.12.37.51; Wed, 05 Sep 2018 12:37:51 -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 S1727837AbeIFAJ2 (ORCPT + 6 others); Wed, 5 Sep 2018 20:09:28 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:38164 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728052AbeIFAJ1 (ORCPT ); Wed, 5 Sep 2018 20:09:27 -0400 Received: by mail-oi0-f66.google.com with SMTP id x197-v6so15932689oix.5; Wed, 05 Sep 2018 12:37:50 -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=BozMFRD6b8JP7Za+m/l6yQcG8PXXn63O1+XHPU/v3vQ=; b=p1tY0ZDUQTpli+ES36iOpJs6CPTjDYOcz3Odv85Nyj6K6QnYC2uoDLi8X6QtlB7yWi c66uP8SUr+YiUm27GVNcoZCSTdNypD5GeCnonstM96s4q5IhHs4aMIMUj+DOOVUrtuPi X7852Ek36agp4ZXMTl498PbYfXluKzUU14mdk3qrrnMmpgft8+NdYVqsK6BHlVMAjAFG aVqQ+Gxx79E965wMNF3Wc3lO6p8PuDxJFY3EoB1UpQurImNeCd03EmAYq9+MAVCPDfxs 97Y3DKQDDzgHMCfvMH9uPbC5htElUz5I7xOG3GC3i7p+6PTxg8Xetc2vurDi6ozCbiAP bduw== X-Gm-Message-State: APzg51DkjnFHj9II6ltFg9pt8JyT/oEbIh2IS3YqHxbYHNdZls7SN9b7 Ks+L+CogeykScb0wtf26GsIvidU= X-Received: by 2002:aca:fd4f:: with SMTP id b76-v6mr32231726oii.307.1536176269471; Wed, 05 Sep 2018 12:37:49 -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.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 12:37:48 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michal Simek Subject: [PATCH 08/21] microblaze: get cpu node with of_get_cpu_node Date: Wed, 5 Sep 2018 14:37:25 -0500 Message-Id: <20180905193738.19325-9-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 "device_type" use is deprecated for FDT though it has continued to be used for nodes like cpu nodes. Use of_get_cpu_node() instead which works using node names by default. This will allow the eventually removal of cpu device_type properties. Also, fix a leaked reference by adding a missing of_node_put. Cc: Michal Simek Signed-off-by: Rob Herring --- Please ack and I will take via the DT tree. This is dependent on the first 2 patches. arch/microblaze/kernel/cpu/cpuinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.17.1 Tested-by: Michal Simek diff --git a/arch/microblaze/kernel/cpu/cpuinfo.c b/arch/microblaze/kernel/cpu/cpuinfo.c index 96b3f26d16be..0c52aca87478 100644 --- a/arch/microblaze/kernel/cpu/cpuinfo.c +++ b/arch/microblaze/kernel/cpu/cpuinfo.c @@ -89,7 +89,7 @@ static struct device_node *cpu; void __init setup_cpuinfo(void) { - cpu = (struct device_node *) of_find_node_by_type(NULL, "cpu"); + cpu = of_get_cpu_node(0, NULL); if (!cpu) pr_err("You don't have cpu!!!\n"); @@ -117,6 +117,8 @@ void __init setup_cpuinfo(void) if (cpuinfo.mmu_privins) pr_warn("%s: Stream instructions enabled" " - USERSPACE CAN LOCK THIS KERNEL!\n", __func__); + + of_node_put(cpu); } void __init setup_cpuinfo_clk(void) From patchwork Wed Sep 5 19:37:27 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: 146026 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp5340217ljw; Wed, 5 Sep 2018 12:37:54 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaOybSx4hUOAjud5bkijTtV/d5FUKWbhkMG5Y815aNJh9yQ8/GnCElE3WUyJ9P/Z+LeKXfb X-Received: by 2002:a17:902:42e2:: with SMTP id h89-v6mr39669479pld.69.1536176273926; Wed, 05 Sep 2018 12:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536176273; cv=none; d=google.com; s=arc-20160816; b=AYip5Uu8Xtm9wFhHnFwAYr3JBYoRH+gqBh0CH0so8F+JZT/XTzOzDgOyIcwUqVykPn Cr4R2rnDTQ2tdEE8bkkx7a3lex01w+C4ZjnwfsO6hnCIu8l0AOzkJruJcuQ7tgmJREtv LyJGqf7oqV2Qg6mXHRQOiM/nOy7T761uloRXqGGVznGp9qghE39ufhnTr8x4kv2KI4gB 3/8TS6blj0qQsQL+FvYd+FmBMZsQXlyeVcKVQeTjG/AX3UYIggTSbMFqVNaSQHOdDwoB NfPz9vLKxAzWvQBlSc4k6fCaSHfAuwvG+89MD0GxdY0ezcdUwvHoOmCtvrY+51ZUvdW3 taxA== 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=s7aN5Q50ZwUddwkIjc7Sz8kupEdtSiBHeR4i+os989Q=; b=r3Jiv1dmHoFUh2xS+mDRWLEa/jXcvNvWmrdJhOwJLIpAWT/nMDBnZ0KmlwK1Fh2R2Y gybaeaI+bAfmcQL299fJn+aMpjeS0EoFbdjqkwC4Ba5BA4h5fW3yktPgyLFJCA1EztNq M69+yxYC+7712HGy5cJz2hg03uL0kMlJishCLvfBGJv2Ojnp85ybdB4V/gb8VzkztjaV rFaPWsghVl+vuXCr5+7cFV5tHg6bmyIodmNrkyz/kzYE/1lauGtteGkTVyzafJlx1YdT CBymXumI09tj0a9ZA7L+fx3L5GH9l/s9e3OqzWMdYMdxpOhkcf4pDcfoNt6J7qO+tdAb mVnA== 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 u64-v6si3001007pfd.297.2018.09.05.12.37.53; Wed, 05 Sep 2018 12:37:53 -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 S1728077AbeIFAJ3 (ORCPT + 6 others); Wed, 5 Sep 2018 20:09:29 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:36321 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728094AbeIFAJ3 (ORCPT ); Wed, 5 Sep 2018 20:09:29 -0400 Received: by mail-oi0-f66.google.com with SMTP id r69-v6so15955536oie.3; Wed, 05 Sep 2018 12:37:51 -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=s7aN5Q50ZwUddwkIjc7Sz8kupEdtSiBHeR4i+os989Q=; b=nGNNmmCmBG3HsKWQY5ds3F3aV+d4oxaIbo1VxieBsk1DaD36x+3JDVKBn7qaLXx4da +oFwIYueklgMAI2EL32scFTTFY/o1KxaypZC5lpWW+QRjLR6js6z2bjlXJcv9An47isl MUVi/t40R/K4RoZWJGMqk68+yH34DTIvEPREX4nfcYakv3dQS7tnl8OysYoG7AXUrpCk f/We3BPoSImSmqWKjYuKyQ4M5ZMlJniTsrikkrA3F9gf+XMVD66CZ+8Y9rwPagaC6t3d 6COGuTxSO5LiqHH1naTHrsj4o3ab+jlxQX4gnww0aMj46rO7Kn8DHRf04uIfkgHvT1ac OOkw== X-Gm-Message-State: APzg51AB6H9RiZXuciI8K86oXk9Ljr6o5KgObDeCR/knwTuOOY5sy2Eo DZXhFmLIjFf82OSOUA87S+Cf2EI= X-Received: by 2002:aca:aa06:: with SMTP id t6-v6mr33049047oie.152.1536176271371; Wed, 05 Sep 2018 12:37:51 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 12:37:50 -0700 (PDT) From: Rob Herring To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonas Bonn , Stefan Kristiansson , Stafford Horne , openrisc@lists.librecores.org Subject: [PATCH 10/21] openrisc: use for_each_of_cpu_node iterator Date: Wed, 5 Sep 2018 14:37:27 -0500 Message-Id: <20180905193738.19325-11-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". This also fixes a leaked reference for cpus node. Cc: Jonas Bonn Cc: Stefan Kristiansson Cc: Stafford Horne Cc: openrisc@lists.librecores.org Signed-off-by: Rob Herring --- Please ack and I will take via the DT tree. This is dependent on the first 2 patches. arch/openrisc/kernel/setup.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.17.1 diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c index 9d28ab14d139..e17fcd83120f 100644 --- a/arch/openrisc/kernel/setup.c +++ b/arch/openrisc/kernel/setup.c @@ -158,9 +158,8 @@ static struct device_node *setup_find_cpu_node(int cpu) { u32 hwid; struct device_node *cpun; - struct device_node *cpus = of_find_node_by_path("/cpus"); - for_each_available_child_of_node(cpus, cpun) { + for_each_of_cpu_node(cpun) { if (of_property_read_u32(cpun, "reg", &hwid)) continue; if (hwid == cpu) 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; }