From patchwork Wed Oct 11 05:08:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 115495 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp339594qgn; Tue, 10 Oct 2017 22:10:20 -0700 (PDT) X-Received: by 10.99.6.75 with SMTP id 72mr14331093pgg.350.1507698620437; Tue, 10 Oct 2017 22:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507698620; cv=none; d=google.com; s=arc-20160816; b=qTZVChDY/BILSWEQO3uspbtFZJUGgfO8OhgZm+qJRaRPqiRsgigKeSBIEYsIR3xgOt 3rlDfxn89qVUfqdrOyCh4H1R+p80kSq/RFLKxqR/QAmDO1ll1caby6c960+nPGhX84F9 1CMLGk8kfTOGZEGfYKM/9qvE0FmbSJUPSUF3ekvsjaIDyxITO8aHyQTQd2nShXbqc60m 6XetXth6jhv7q6QZNUMDwGkX9gVe6kleowbUEsR0OI9I4lb0wCJejD1E7HO9+21f+mbu D1KH3wzLezHwXe/8v6QeVngbSd+MAOjjNDeffT9roEuthBwx+9ilb8FPJxgP2oo3SDvY /vBQ== 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:dkim-signature:arc-authentication-results; bh=oI3JnY39izUPxej49kmHZCKekfUdgDcHmvDsU2rKGNU=; b=a/aaOTsFc3dxbeaN7s3QtB6TzTbOxmVfvp6i/RWdIMwnuQtm8UIQkqyPTAn1KIY/88 TbMGZgMWOihqzpPlsR27X1VUYfWrMTSmGczgvg+ZxgoKhesXqqTir9OtfuAMktb3YhxR V3Fs8s465R2lgQzZvmLk9iP3C+gqMWsloaOQMWlDrKjBQwm6lS3ziSXT9r1/RJpSwpxL KNh2DzknDHgcW9CO8Wew4ALy3VDHf77chI2hg5me/DcqYP81rBHk3AE0DWOOVNwliw7c ia8ZpOTtBLtIsdUWepPLhh+pIN+ddmVfRJT3d66g4N87QkxkRdp3Fgp4UVmlTNFNqpCU t4iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ib8p6gOC; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8si497184plo.439.2017.10.10.22.10.20; Tue, 10 Oct 2017 22:10:20 -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; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ib8p6gOC; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755878AbdJKFKR (ORCPT + 6 others); Wed, 11 Oct 2017 01:10:17 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:45606 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755039AbdJKFJE (ORCPT ); Wed, 11 Oct 2017 01:09:04 -0400 Received: by mail-pf0-f181.google.com with SMTP id d28so557345pfe.2 for ; Tue, 10 Oct 2017 22:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IzykTXEpszxSHUPKSwyeIhE9N6oirtKj1sxge2oe97s=; b=Ib8p6gOC+BhuIELDza8ocorckGAt9Sx0/4olzjDoMsTepm69Da7HUSJShBvgCX+YeW J5B3FJSqxdQEqgV6RSxPETIILkvf497jjB7MlsQn50Ed8tEJOqW6IaQeRlII7emuSxum zrlYN20gie2xhBF/W/FIsTJRUt9MT+RG4CyZ8= 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=IzykTXEpszxSHUPKSwyeIhE9N6oirtKj1sxge2oe97s=; b=FfpyTwzbcaIVis7MpZhYJvyDK7p0dIh9afFAxQzn74gn2QJksHA2NM2CoRUtpaTzcf dPxxjCs3sM9vtDTmb5lvn9SrBzKzPn9xd4J28bUlTjVEQKNlmwHOE4nHscZ5971SoXfk qzf14t/xj5C/rGuviRmZngPA8y2EhYh9Tgffo5iOLk0VJYO4Otk+qt8dIewIu4CRk7WP uMKIj3xqc5BgwjUMR/zP+HbKuL+eiPXApV5v3rzFyYcN2J736ZevRyHnPezjmTd9eH+5 xrGSVLS4vy0jbrjI3EHTwRDcWCd4KwIjzJ6rBoLS7q0Q/1ClPU4PwFj57jEzizZ+GSq7 reMA== X-Gm-Message-State: AMCzsaXCChqAtXA43hi24CIOuUkso301elQpIWzhdUg4ChYoPS5kO0fQ s8TBuDu5Uc+CGPjrRiX2rBBdIQ== X-Google-Smtp-Source: AOwi7QB0We5KC8ri0O4noOzYHSMgIAdVQNB67N3bZpfFwAqPsUntvwUz1OFv6/bywYv+G4Fa79Wg8Q== X-Received: by 10.101.78.12 with SMTP id r12mr14356836pgt.289.1507698543746; Tue, 10 Oct 2017 22:09:03 -0700 (PDT) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id n29sm28336361pgd.74.2017.10.10.22.09.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Oct 2017 22:09:03 -0700 (PDT) From: Bjorn Andersson To: Andy Gross , Anton Vorontsov , Colin Cross , Frank Rowand , Kees Cook , Rob Herring , Tony Luck Cc: David Brown , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-soc@vger.kernel.org Subject: [PATCH v4 1/5] of/platform: Generalize /reserved-memory handling Date: Tue, 10 Oct 2017 22:08:53 -0700 Message-Id: <20171011050857.7588-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171011050857.7588-1-bjorn.andersson@linaro.org> References: <20171011050857.7588-1-bjorn.andersson@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org By iterating over all /reserved-memory child nodes and match each one to a list of compatibles that we want to treat specially, we can easily extend the list of compatibles to handle - without having to resort to of_platform_populate() that would create unnecessary platform_devices. Reviewed-by: Rob Herring Signed-off-by: Bjorn Andersson --- Changes since v3: - Picked up Rob's R-b Changes since v2: - Simplify logic per Rob's suggestion. Changes since v1: - New patch drivers/of/platform.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/of/platform.c b/drivers/of/platform.c index b19524623498..ee89f096f0f3 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -497,6 +497,11 @@ int of_platform_default_populate(struct device_node *root, EXPORT_SYMBOL_GPL(of_platform_default_populate); #ifndef CONFIG_PPC +static const struct of_device_id reserved_mem_matches[] = { + { .compatible = "ramoops" }, + {} +}; + static int __init of_platform_default_populate_init(void) { struct device_node *node; @@ -505,15 +510,12 @@ static int __init of_platform_default_populate_init(void) return -ENODEV; /* - * Handle ramoops explicitly, since it is inside /reserved-memory, - * which lacks a "compatible" property. + * Handle certain compatibles explicitly, since we don't want to create + * platform_devices for every node in /reserved-memory with a + * "compatible", */ - node = of_find_node_by_path("/reserved-memory"); - if (node) { - node = of_find_compatible_node(node, NULL, "ramoops"); - if (node) - of_platform_device_create(node, NULL, NULL); - } + for_each_matching_node(node, reserved_mem_matches) + of_platform_device_create(node, NULL, NULL); /* Populate everything else. */ of_platform_default_populate(NULL, NULL, NULL);