From patchwork Mon Jul 14 07:12:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 4543121 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7B817C0514 for ; Mon, 14 Jul 2014 07:35:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BA8DE20149 for ; Mon, 14 Jul 2014 07:35:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D392220136 for ; Mon, 14 Jul 2014 07:35:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X6am3-0001lA-VD; Mon, 14 Jul 2014 07:34:11 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X6alq-0001Gf-1w for linux-arm-kernel@lists.infradead.org; Mon, 14 Jul 2014 07:33:58 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8O00G69YBN0X90@mailout1.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 14 Jul 2014 08:33:23 +0100 (BST) X-AuditID: cbfec7f5-b7f626d000004b39-6b-53c387c72b2d Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 3B.F3.19257.7C783C35; Mon, 14 Jul 2014 08:33:27 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N8O00FFGYBLTX50@eusync3.samsung.com>; Mon, 14 Jul 2014 08:33:27 +0100 (BST) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/4] drivers: of: initialize and assign reserved memory to newly created devices Date: Mon, 14 Jul 2014 09:12:44 +0200 Message-id: <1405321966-28184-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1405321966-28184-1-git-send-email-m.szyprowski@samsung.com> References: <1405321966-28184-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRmVeSWpSXmKPExsVy+t/xq7rH2w8HG0x4ZGgxZ/0aNovHr+ex WPyddIzd4kNTK7PF+2U9jBbzj5xjtTjwZwejxcruZjaLneveMVqcbXrDbrG9cwa7xZcrD5ks Nj2+xmpxedccNou1R+6yW2x4eZDJYsHxFlaLP9PlLNYcWcxu8Xf7JhaL9TNes1gsnH+f3eLl xxMsDuIea+atYfT4/WsSo8flvl4mj52z7rJ79LxpYfXoenuFyePOtT1sHidm/GbxeHBoM4vH 5iX1Hrf/PWb2WPfnFZNH/18Dj7m7+hg9+rasYvT4vEkuQCCKyyYlNSezLLVI3y6BK+PFxkbW gqN8Fas3/mdrYJzO08XIySEhYCJxY2srG4QtJnHh3nogm4tDSGApo8SyBc2MIAkhgT4miffH JEFsNgFDia63XWANIgJuEv/WHQJrYBZYwCZx9P8PsAZhgVSJC2+2sYDYLAKqEk1/bzOD2LwC HhK/XhxmgtgmJ/H/5Qowm1PAU2Lj5G+sEMs8JA7v28M4gZF3ASPDKkbR1NLkguKk9FwjveLE 3OLSvHS95PzcTYyQ+Pq6g3HpMatDjAIcjEo8vAX8h4OFWBPLiitzDzFKcDArifCGuwGFeFMS K6tSi/Lji0pzUosPMTJxcEo1MG4JiWRh6265Jdrjkf3n2uar6x/+Ovj+3rsXAjsiz/GkbD3z 7VGoVXqrkb5v/EMvfs1TeR4rIoMzKox5163S3mb7NCY8Qax15cw7h32W50w6HuAgzJuvufdT A+vpvGNrd15t9zjD5jrRxbM/7ztzcPHPiH55rR41o3ufo+T7/kbv8OW8/qH1ihJLcUaioRZz UXEiAIrYSJKNAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140714_003358_248906_283DA545 X-CRM114-Status: GOOD ( 10.93 ) X-Spam-Score: -5.0 (-----) Cc: Jon Medhurst , devicetree@vger.kernel.org, Laura Abbott , Andrew Morton , Arnd Bergmann , Josh Cartwright , Benjamin Herrenschmidt , Tomasz Figa , Will Deacon , Michal Nazarewicz , linaro-mm-sig@lists.linaro.org, Marc , Nishanth Peethambaran , Paul Mackerras , "Aneesh Kumar K.V." , Catalin Marinas , Grant Likely , Joonsoo Kim , Sascha Hauer , Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use recently introduced of_reserved_mem_device_init() function to automatically assign respective reserved memory region to the newly created platform and amba device. Signed-off-by: Marek Szyprowski --- drivers/of/platform.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 6c48d73a7fd7..a7f967866f13 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -21,6 +21,7 @@ #include #include #include +#include #include const struct of_device_id of_default_bus_match_table[] = { @@ -237,12 +238,15 @@ static struct platform_device *of_platform_device_create_pdata( dev->dev.bus = &platform_bus_type; dev->dev.platform_data = platform_data; + of_reserved_mem_device_init(&dev->dev); + /* We do not fill the DMA ops for platform devices by default. * This is currently the responsibility of the platform code * to do such, possibly using a device notifier */ if (of_device_add(dev) != 0) { + of_reserved_mem_device_release(&dev->dev); platform_device_put(dev); goto err_clear_flag; } @@ -304,6 +308,8 @@ static struct amba_device *of_amba_device_create(struct device_node *node, else of_device_make_bus_id(&dev->dev); + of_reserved_mem_device_init(&dev->dev); + /* Allow the HW Peripheral ID to be overridden */ prop = of_get_property(node, "arm,primecell-periphid", NULL); if (prop) @@ -330,6 +336,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node, return dev; err_free: + of_reserved_mem_device_release(&dev->dev); amba_device_put(dev); err_clear_flag: of_node_clear_flag(node, OF_POPULATED);