From patchwork Wed Jul 2 10:48:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 4464721 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6B7D49F26C for ; Wed, 2 Jul 2014 10:52:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 665DA203AA for ; Wed, 2 Jul 2014 10:52:11 +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 6E7F920395 for ; Wed, 2 Jul 2014 10:52:10 +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 1X2I6j-0000En-Kd; Wed, 02 Jul 2014 10:49:45 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X2I6Q-0008Pw-PS for linux-arm-kernel@lists.infradead.org; Wed, 02 Jul 2014 10:49:27 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N82009ZQZD9YW90@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 02 Jul 2014 11:48:45 +0100 (BST) X-AuditID: cbfec7f5-b7f626d000004b39-31-53b3e39df900 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 40.F9.19257.D93E3B35; Wed, 02 Jul 2014 11:49:01 +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 <0N82004J1ZDILZA0@eusync3.samsung.com>; Wed, 02 Jul 2014 11:49:01 +0100 (BST) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH 2/4] drivers: of: initialize and assign reserved memory to newly created devices Date: Wed, 02 Jul 2014 12:48:50 +0200 Message-id: <1404298132-6050-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1404298132-6050-1-git-send-email-m.szyprowski@samsung.com> References: <1404298132-6050-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAyXRW0iTYRjA8d5v32EuV1/L4stAchJBeEyJlwz1yl6hC8mLSKGculRyaltK RqDY1Fzq1C5mYeqcK10eciYeK13zgOEp5wHMzE3Iw2yVyyLnym13v4fnD8/Fw2bxmnBPdmr6 HaE4XZDGJzn4B/vIrN8zU0dMYKXhIKxuayahabMGh3uVwxT8nl/AgpbnJQDW6icIKDcrCThg 6waw6dEDEppLH+Kwp/UbgOP5Zgp2FVdR0GpYwaDWNEdAZWEDDmd6q0nYol+i4Kv1QQyq56cx WDciJaBN4QXH5rdJ2KxXUbBc0YLDgjd6Cu51aXG4MViIw7aqTRwqa5cpqOm1Abj+YxSPOIWa a5oB2v1bCdDm43KAZspKMdTzdIlCJWYpgbSaYhLJtgwY+jTXT6LRql0cfdF14KijIRct2k0s ZBjNJ1CrbQND8r3AaI9YzsUkYVpqtlAcEBbPSdmZLKIyhw7dNaktRB5QuMuAG5uhQxir0Ui6 fJyZ+ty2bw6bR6sB89M0yXINZRjz3lrhrEg6iJFtyZz2oJWA2a7BHRGLLmUza31/cMfiKJ3A bA1ZnBFOn2aWpxad5tKXmL72ccJ1zov5t96IOexGI+ZFvxE4zNtv9GYLqxxw68ABDTgmzErM lCQki875SwQiSVZ6sn9ihkgLXO/91Q3Uwxd0gGYDvjt3LUAbwyME2ZIckQ4wbBbfgytf6Ijh cZMEOfeE4owb4qw0oUQHMLabZx64KX7N8e4U7kRLl3WV77ZCp1YHri5wN3/PmgpPSqhMz9X7 3u3n5aGxRZai9I+RLROmJ41RFUZfo8qutMcNRxfW5wSOvcRO5O5Odcapbu/5vKVaj5RMa1Lo sH7riCjKJzK8U3W9wRKuzfM9I71yKyI7WOEXfPna12xe/Ep9aMhhPi5JEQSdZYklgv/dhpBm vAIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140702_034927_030342_12521274 X-CRM114-Status: GOOD ( 10.57 ) X-Spam-Score: -5.0 (-----) Cc: Mark Rutland , Jon Medhurst , Benjamin Herrenschmidt , Tomasz Figa , Will Deacon , Tomasz Figa , Paul Mackerras , Marek Szyprowski , Arnd Bergmann , Josh Cartwright , Catalin Marinas , Grant Likely , Laura Abbott , Ian Campbell , Pawel Moll , Stephen Warren , Sascha Hauer , Michal Nazarewicz , Marc , Nishanth Peethambaran , Rob Herring , Andrew Morton , "Aneesh Kumar K.V." , Kumar Gala , Olof Johansson , Joonsoo Kim 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, T_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 500436f9be7f..a9055d3da5c2 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[] = { @@ -233,12 +234,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; } @@ -300,6 +304,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) @@ -326,6 +332,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);