From patchwork Mon Jul 14 08:28:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 33558 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7773920CAD for ; Mon, 14 Jul 2014 08:29:01 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id y10sf1827887pdj.8 for ; Mon, 14 Jul 2014 01:29:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=rgUqCG6kji5Z8FL63oDfNpoJBPi648FSqezs08WR4TI=; b=Q8zenUsg88E/WfWolwien0hPti8G47OurBOcldespVWOgIwMlrNk+kTdvMGD/Injki uS6ZlEMDl94bS2n6CgE7A5p3C82mvMsg++QnTeN8euCNvA4Ctj9XOe31cfEvWLkK6hHs UgcupZpjq69NEoz9qtLwA2uwNhu390nEUkbmKKrEkt9zwQYmufUERgeavJzhDmgL1P8t ZzbsmKFj6qddKkHpMl50prloHvAH/yhqR07SkV/cR2X2yfMayRPemV7LZDq362lVAoLh 1nYVAXvsyk+eTtJ4Z2FU6rm42hUt2aeczKCcBYRpt4G17v8Gs0+t+NF8cHvx3zzlfOyE h5PA== X-Gm-Message-State: ALoCoQne5o+2icJA9BaSNYZfS26mdMKAUn7iAXYHw1XqCpBANoiPqIY8BeANMX3/80Eg99lrTHZv X-Received: by 10.70.48.38 with SMTP id i6mr7248703pdn.5.1405326540696; Mon, 14 Jul 2014 01:29:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.211 with SMTP id j77ls976188qgd.37.gmail; Mon, 14 Jul 2014 01:29:00 -0700 (PDT) X-Received: by 10.58.245.194 with SMTP id xq2mr1796864vec.26.1405326540584; Mon, 14 Jul 2014 01:29:00 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id uv7si5109592veb.78.2014.07.14.01.29.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Jul 2014 01:29:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id hq11so5426154vcb.17 for ; Mon, 14 Jul 2014 01:29:00 -0700 (PDT) X-Received: by 10.58.212.66 with SMTP id ni2mr15065006vec.12.1405326540494; Mon, 14 Jul 2014 01:29:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp116589vcb; Mon, 14 Jul 2014 01:28:59 -0700 (PDT) X-Received: by 10.180.94.166 with SMTP id dd6mr22107267wib.33.1405326539305; Mon, 14 Jul 2014 01:28:59 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id op3si14913894wjc.12.2014.07.14.01.28.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 14 Jul 2014 01:28:59 -0700 (PDT) Received-SPF: none (google.com: linaro-mm-sig-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1X6baj-00021r-N7; Mon, 14 Jul 2014 08:26:33 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1X6baW-00020V-Hh for linaro-mm-sig@lists.linaro.org; Mon, 14 Jul 2014 08:26:20 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) 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 <0N8P00E7I0UNX810@mailout2.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Mon, 14 Jul 2014 09:27:59 +0100 (BST) X-AuditID: cbfec7f4-b7fac6d000006cfe-f3-53c3949f1d41 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 8F.BE.27902.F9493C35; Mon, 14 Jul 2014 09:28:16 +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 <0N8P00JJ10UYW070@eusync3.samsung.com>; Mon, 14 Jul 2014 09:28:15 +0100 (BST) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Mon, 14 Jul 2014 10:28:05 +0200 Message-id: <1405326487-15346-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1405326487-15346-1-git-send-email-m.szyprowski@samsung.com> References: <1405326487-15346-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsVy+t/xq7oLphwONvglbTFn/Ro2i8ev57FY /J10jN3i/bIeRov5R86xWhz4s4PRYmV3M5vFznXvGC3ONr1ht9jeOYPd4suVh0wWmx5fY7W4 vGsOm8XaI3fZLTa8PMhkseB4C6vFn+lyFmuOLGa3+Lt9E4vF+hmvWSwWzr/PbvHy4wkWBzGP NfPWMHr8/jWJ0eNyXy+Tx85Zd9k9ut5eYfK4c20Pm8eJGb9ZPB4c2szisXlJvcftf4+ZPdb9 ecXk0f/XwGPurj5Gj74tqxg9Pm+SC+CP4rJJSc3JLEst0rdL4Mr4dr6dveAoX8Xjpe9ZGxin 83QxcnJICJhILD2xnRHCFpO4cG89WxcjF4eQwFJGiYutnSwgCSGBPiaJFafLQWw2AUOJrrdd bCC2iICbxL91h8AamAVes0qsePQZrEFYIEfi2scO1i5GDg4WAVWJKZ0VIGFeAQ+JCfsWs0Is k5P4/3IFE4jNKeApMePze3aIXR4S7y/3sk5g5F3AyLCKUTS1NLmgOCk911CvODG3uDQvXS85 P3cTIySOvuxgXHzM6hCjAAejEg9vhdjhYCHWxLLiytxDjBIczEoivOFuQCHelMTKqtSi/Pii 0pzU4kOMTBycUg2MXT72ZxddKVH68ErrocyfV3k2oWbXavPv+K6f3Pa7YPtai6e26bLnnqhy aD//EBr9Mevq0g86h4X/93exCdofeFNwxSnxDLveW7ES/48trL/OCT5Ryq805d7GdF7HxG3x 0zmSJ7jYUi+2GkkYvf8tHrAwTjND5V7dFQGfvGDVF5ZiXw6HnLmoxFKckWioxVxUnAgAWqce JoECAAA= Cc: Jon Medhurst , devicetree@vger.kernel.org, Andrew Morton , Arnd Bergmann , Josh Cartwright , Catalin Marinas , Tomasz Figa , Will Deacon , Michal Nazarewicz , linaro-mm-sig@lists.linaro.org, Paul Mackerras , "Aneesh Kumar K.V." , Grant Likely , Joonsoo Kim , Sascha Hauer Subject: [Linaro-mm-sig] [PATCH v2 RESEND 2/4] drivers: of: initialize and assign reserved memory to newly created devices X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-mm-sig-bounces@lists.linaro.org Sender: linaro-mm-sig-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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);