From patchwork Thu Oct 5 03:32:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9986349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C7D3760247 for ; Thu, 5 Oct 2017 03:33:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFF4828C04 for ; Thu, 5 Oct 2017 03:33:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4CBB28C35; Thu, 5 Oct 2017 03:33:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F54728C04 for ; Thu, 5 Oct 2017 03:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=fnpdcg90KTTaiJ3qSFxz6O3ZHFMXJJFZ1zzBMUd4038=; b=gZYdxqUZoyPPWBFeZcIS25RYpk vXgdKkT3gPomr45O5cGgORsXmWRETL8/qj4/S85+E/K0Dk2lvwpKewHvbN1mGZEiGPYs4l6IwGqLl lCEIPfucgul4XmcN2nSin5KAyLxAi2+HmqNt6yU1D6l4xUH0Lt1qEjZz9uERtlvoj0Z2sG3Bp+pXt Z7IMNWq7cKBpJzrkeQUpiIoCUm6iwqsKT/lidTMQ+/2rK9REUX6s5HcRv2xNc2hz//pdlCspBq0Zp XJp4UrQ6exNFB/592wGwHuvtCF55u4etfCzT22lNgJ9ixz2KpiGLxL29dkugvQ8JKx0macjEqeRDO VcSe1FTA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dzwuy-0000iz-Rl; Thu, 05 Oct 2017 03:33:48 +0000 Received: from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dzwub-0000J1-D8 for linux-arm-kernel@lists.infradead.org; Thu, 05 Oct 2017 03:33:27 +0000 Received: by mail-pf0-x22c.google.com with SMTP id n24so7300353pfk.5 for ; Wed, 04 Oct 2017 20:33: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=1dEd9rjG8SfOZjW67/oDHfzf+LcltUc1goZTNkEVsc4=; b=NVj3dzZjDf2y70FVRihawaTpK23FC/SgQseB7VF2GdTisyF2tzfk4fvMl7EJ5ikWRh mSOrs4sOAAS7i3t1qv+dX7e5VRvkovMJvoPtsXwgbqsenQrarQmgOCalO1RJPdoaVUZY +Zxln2GdT/l6+kkvFruz2ESrrsI/fhtsmM9CU= 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=1dEd9rjG8SfOZjW67/oDHfzf+LcltUc1goZTNkEVsc4=; b=cwQbfROCVHT2JI46lyMlRMA9vZjk/0ZcX+N7icRfwcNc29OCtHjUz+rsTZG4bHNaaJ UysRLgip89L/zokHPYEhJQHpJKdk6x4CSNb2VwBv+H5AuNehEQ4jKMuxOB8TjAQGBxzM OAsVoZe6WQTHQ8hCzNNXUX43f1keA18HLNLJulVazGt0eErVb2UgyvP49r14Mr514Xo0 JTPZPOYZYXf10EaXh1DPiFcixvQfkTgsVczpv3dmBXGbsEEMR7oPiLsQ1wEyEguLgJM0 CdO8DheBWi7zcApm1ARfHsoUHg8hrl4bRZF0cSTNb1/8YDbKHL8AfBQP+lLeNy1cA4Bq mQhg== X-Gm-Message-State: AMCzsaXacbmum/eqr0odT66r9Yq7x8wefuOpZCHYp2l1Ari8/oTOidtb XmfXOWfA/1w9DTqZnYIir3CepA== X-Google-Smtp-Source: AOwi7QDESr1R5pVcS5Duaw5rLBI+qYHlK+66SpHdJakRuJAO5fb8FAHw6VQNe/9qyJ/gNS7nrBB62w== X-Received: by 10.84.178.101 with SMTP id y92mr11595432plb.137.1507174384248; Wed, 04 Oct 2017 20:33:04 -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 h70sm28945700pfc.51.2017.10.04.20.33.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 20:33:03 -0700 (PDT) From: Bjorn Andersson To: Andy Gross , Anton Vorontsov , Colin Cross , Frank Rowand , Kees Cook , Rob Herring , Tony Luck Subject: [PATCH v3 1/5] of/platform: Generalize /reserved-memory handling Date: Wed, 4 Oct 2017 20:32:54 -0700 Message-Id: <20171005033258.12825-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171005033258.12825-1-bjorn.andersson@linaro.org> References: <20171005033258.12825-1-bjorn.andersson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171004_203325_470998_842FF6E6 X-CRM114-Status: GOOD ( 14.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, David Brown , linux-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Rob Herring --- 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(-) 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);