From patchwork Thu Aug 3 02:57:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 109291 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp213668qge; Wed, 2 Aug 2017 19:59:14 -0700 (PDT) X-Received: by 10.98.29.72 with SMTP id d69mr201152pfd.226.1501729154554; Wed, 02 Aug 2017 19:59:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501729154; cv=none; d=google.com; s=arc-20160816; b=o6lMk+Vj2MIMHEfkwHPi8tXIqmC1V5P1akMx0A4OdggW2gkKypVTiIvPGyshqbsAs0 w+jYmxfnYE5rUl++YJU4n1a/ipqD7MZ7xzvTWxF3GIzc+ONSURr6B3uaaKt3XPnSkVmJ bSL6hyGKuk2em09jn20t4NgaT3pd3kp0R2R/RxPv6iBZRbyH8xSiQXMVRNgjGjF+TXpC DFLCyOSIM7YZbUJBg9EddtYoROm1yt62aP7vxzubThv9tyDtMWkoKGlmfhuAzkq0F2+a ux9a8uznsl6WVi3zZnGnj+EQ6IYLHYpqGASWleZphssyjgPNFADQ6ajFWzvlFuE0SIHz lfZg== 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=DUayFyGEU37n/OAhrv2FweAPagrPTNezJOwHXHB5RLY=; b=t7c8Kmal5zGYakbvT+jkHRHsuld1UxlhwFcW8w6Ig2a/cowYpUhiEZuyvHTWfNU3a0 AQaqaGKKkAFXKCtGr5zkyT91j4MbVzsz/wQWG2bc6l++mVkocuP+odM0I09btpCcphJi uhIVHsmVPu6lyugJKzkQEl1HvNY0FdDmNRZ5DCWB4GqY+6PuOECRGDxAfUW5wRV2DxNd k00UnWegvLDh/1EGm3mDesM2LMDZlpcKmn1hF3aKP1vJmP78lWT4o0pS3mdrbsaowWDv 14alw44qyzrLl2S5CKfq3dFG6+Y8IW7wayx4IQ7OqL7JCHwiN/DB9tP23P09RAcybMvL NMDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=BB1FJ7qm; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 i63si7110424pgc.373.2017.08.02.19.59.14; Wed, 02 Aug 2017 19:59:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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.b=BB1FJ7qm; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1752050AbdHCC7N (ORCPT + 9 others); Wed, 2 Aug 2017 22:59:13 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:32829 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752011AbdHCC6B (ORCPT ); Wed, 2 Aug 2017 22:58:01 -0400 Received: by mail-pf0-f176.google.com with SMTP id d67so816526pfc.0 for ; Wed, 02 Aug 2017 19:58:00 -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=AiWVw4/mBB8vLLnl1MQevQJaPBGJ0VsVdeOoUQpbOjg=; b=BB1FJ7qmSlbD90uw0Q1SS8hepSOAkjwrbgi2yf7wlNLR80dCPSz9fAfjeYlb3/7lg5 0nnVPLxl7I00jaY3b9lu0LYP9qsVf4YX2Ys5OLNddg9sJ9orMOMLdYWcIyWOIs+MVTb1 L3Hj+JqTcDrA4Husv5ehkO6ZppTaKzK9nOEuw= 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=AiWVw4/mBB8vLLnl1MQevQJaPBGJ0VsVdeOoUQpbOjg=; b=SoAHLA2RzqTWr1x1WbqUswI3xEVB2pZ6q6K4REATPNpMuw0NZtpKyw4frkm3Ixc+ZX OMNuxiU60gRA+5pRKfDNNtKZUIrnQHvdVSpPvikPLxL4hhhGG2629mUsny4kYTSqsf8o 7IsgMCuPju+IZxyxUC1RvaIDgyFZzVm0bLspoff8PPLOxNNB2oiykd9lpo0RNqv0EwEf PjtwX0E3v54YqM0H1XYrvhIXIbocYl5Zj9pAnWI6qM9ioVmN0l4EODnFVD4mR76gRyx6 85zbDewa5M+f93PzKE7oG5qOi14L2jomeKyL51lgCPW/X9nk4hHRLHW9mzNXmLxXGiBT yGDg== X-Gm-Message-State: AIVw111YbY5QBYuo3CbUZL2mCISqZv6oY2Pf/hSOvq//MC5CMOLqFEZi qLHXkc1apH1z/W5WvRuaWQ== X-Received: by 10.84.174.193 with SMTP id r59mr224224plb.266.1501729080326; Wed, 02 Aug 2017 19:58:00 -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 z83sm10722573pfd.10.2017.08.02.19.57.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2017 19:57:59 -0700 (PDT) From: Bjorn Andersson To: Rob Herring , Frank Rowand , Andy Gross , David Brown Cc: Mark Rutland , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Subject: [PATCH v2 1/5] of/platform: Generalize /reserved-memory handling Date: Wed, 2 Aug 2017 19:57:50 -0700 Message-Id: <20170803025754.19101-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170803025754.19101-1-bjorn.andersson@linaro.org> References: <20170803025754.19101-1-bjorn.andersson@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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. Signed-off-by: Bjorn Andersson --- Changes since v1: - New patch drivers/of/platform.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" 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..8c241a116b08 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -497,23 +497,32 @@ int of_platform_default_populate(struct device_node *root, EXPORT_SYMBOL_GPL(of_platform_default_populate); #ifndef CONFIG_PPC +static const char *rmem_compats[] = { + "ramoops", + NULL +}; + static int __init of_platform_default_populate_init(void) { + struct device_node *rmem_nodes; struct device_node *node; + int ret; if (!of_have_populated_dt()) 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) + rmem_nodes = of_find_node_by_path("/reserved-memory"); + for_each_available_child_of_node(rmem_nodes, node) { + ret = of_device_compatible_match(node, rmem_compats); + if (ret) of_platform_device_create(node, NULL, NULL); } + of_node_put(rmem_nodes); /* Populate everything else. */ of_platform_default_populate(NULL, NULL, NULL);