From patchwork Mon Aug 5 12:26:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 2838667 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 25E0D9F479 for ; Mon, 5 Aug 2013 12:28:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF50B20164 for ; Mon, 5 Aug 2013 12:28:39 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7E4862015B for ; Mon, 5 Aug 2013 12:28:38 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V6JtV-0002j9-H5; Mon, 05 Aug 2013 12:28:13 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V6JtJ-0001MK-Mk; Mon, 05 Aug 2013 12:28:01 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V6Jt6-0001JC-6J for linux-arm-kernel@lists.infradead.org; Mon, 05 Aug 2013 12:27:49 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MR200J4A59G3WS0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 05 Aug 2013 21:27:28 +0900 (KST) X-AuditID: cbfee61b-b7efe6d000007b11-b1-51ff9a2f1842 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id E2.15.31505.F2A9FF15; Mon, 05 Aug 2013 21:27:28 +0900 (KST) Received: from localhost.localdomain ([106.116.147.30]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MR200DEH58SIG60@mmp2.samsung.com>; Mon, 05 Aug 2013 21:27:27 +0900 (KST) From: Marek Szyprowski To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 2/2] media: s5p-mfc: remove DT hacks and simplify initialization code Date: Mon, 05 Aug 2013 14:26:50 +0200 Message-id: <1375705610-12724-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1375705610-12724-1-git-send-email-m.szyprowski@samsung.com> References: <1375705610-12724-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRmVeSWpSXmKPExsVy+t9jQV2DWf8DDb6/5bKYf+Qcq8WrMxvZ LN70drBY/Hh9gc2id8FVNouzTW/YLTY9vsZq0bNhK6vFjPP7mCzWHrnLbrH0+kUmi1PXP7NZ TJi+lsXi+7dvbBaH37SzWpz808to8epgG4vF+hmvWRyEPNbMW8Po8XryBEaPnbPusnvcubaH zWPzknqPKyeaWD36tqxi9Pj5Usfj8yY5j41zQwO4orhsUlJzMstSi/TtErgyzm18wlgwT6pi 0o5e1gbG06JdjJwcEgImEm82PWCGsMUkLtxbzwZiCwlMZ5ToesrSxcgFZLczSWx+dp4VJMEm YCjR9baLDSQhItDGKLG+rYMRxGEW2MAicejtN3aQKmGBcImLV0+AjWIRUJX48P0VE4jNK+Ah sXrLOaAGDqB1ChJzJtmAhDkFPCVWz+xmh9jsIfHq0HnmCYy8CxgZVjGKphYkFxQnpeca6RUn 5haX5qXrJefnbmIEB/wz6R2MqxosDjEKcDAq8fAqsP8PFGJNLCuuzD3EKMHBrCTCe60EKMSb klhZlVqUH19UmpNafIhRmoNFSZz3YKt1oJBAemJJanZqakFqEUyWiYNTqoFRaWm2QDnTvaNC K0Q3HZVY9WT+ju+O9RtOBPbXtX5/aurP/v1L28L1G8smXWI0XqR4YOfFpxqfhWSuXnknEShU 7aBYnLMp4EjGT6tlb9M/aTMaVSxXC7Yo0rq/pvDQJo+U8laLN3zOxT5q1U+VnG8un8O99Hvo 0meT4hcViSwXnqgmn6gtkGmgxFKckWioxVxUnAgA2550r3QCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130805_082748_483667_F9BB9887 X-CRM114-Status: GOOD ( 13.98 ) X-Spam-Score: -5.2 (-----) Cc: Mark Rutland , Kamil Debski , Kukjin Kim , Ian Campbell , Pawel Moll , Stephen Warren , Sachin Kamat , Tomasz Figa , Grant Likely , Kyungmin Park , Sylwester Nawrocki , Olof Johansson , Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-2.5 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, 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 This patch removes custom initialization of reserved memory regions from s5p-mfc driver. Memory initialization can be now handled by generic code. Signed-off-by: Marek Szyprowski Acked-by: Kamil Debski --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 75 ++++++------------------------ 1 file changed, 15 insertions(+), 60 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index a130dcd..696e0e0 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1011,51 +1011,11 @@ static int match_child(struct device *dev, void *data) { if (!dev_name(dev)) return 0; - return !strcmp(dev_name(dev), (char *)data); + return !!strstr(dev_name(dev), (char *)data); } static void *mfc_get_drv_data(struct platform_device *pdev); -static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev) -{ - unsigned int mem_info[2] = { }; - - dev->mem_dev_l = devm_kzalloc(&dev->plat_dev->dev, - sizeof(struct device), GFP_KERNEL); - if (!dev->mem_dev_l) { - mfc_err("Not enough memory\n"); - return -ENOMEM; - } - device_initialize(dev->mem_dev_l); - of_property_read_u32_array(dev->plat_dev->dev.of_node, - "samsung,mfc-l", mem_info, 2); - if (dma_declare_coherent_memory(dev->mem_dev_l, mem_info[0], - mem_info[0], mem_info[1], - DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE) == 0) { - mfc_err("Failed to declare coherent memory for\n" - "MFC device\n"); - return -ENOMEM; - } - - dev->mem_dev_r = devm_kzalloc(&dev->plat_dev->dev, - sizeof(struct device), GFP_KERNEL); - if (!dev->mem_dev_r) { - mfc_err("Not enough memory\n"); - return -ENOMEM; - } - device_initialize(dev->mem_dev_r); - of_property_read_u32_array(dev->plat_dev->dev.of_node, - "samsung,mfc-r", mem_info, 2); - if (dma_declare_coherent_memory(dev->mem_dev_r, mem_info[0], - mem_info[0], mem_info[1], - DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE) == 0) { - pr_err("Failed to declare coherent memory for\n" - "MFC device\n"); - return -ENOMEM; - } - return 0; -} - /* MFC probe function */ static int s5p_mfc_probe(struct platform_device *pdev) { @@ -1107,25 +1067,20 @@ static int s5p_mfc_probe(struct platform_device *pdev) goto err_res; } - if (pdev->dev.of_node) { - ret = s5p_mfc_alloc_memdevs(dev); - if (ret < 0) - goto err_res; - } else { - dev->mem_dev_l = device_find_child(&dev->plat_dev->dev, - "s5p-mfc-l", match_child); - if (!dev->mem_dev_l) { - mfc_err("Mem child (L) device get failed\n"); - ret = -ENODEV; - goto err_res; - } - dev->mem_dev_r = device_find_child(&dev->plat_dev->dev, - "s5p-mfc-r", match_child); - if (!dev->mem_dev_r) { - mfc_err("Mem child (R) device get failed\n"); - ret = -ENODEV; - goto err_res; - } + dev->mem_dev_l = device_find_child(&dev->plat_dev->dev, "-l", + match_child); + if (!dev->mem_dev_l) { + mfc_err("Mem child (L) device get failed\n"); + ret = -ENODEV; + goto err_res; + } + + dev->mem_dev_r = device_find_child(&dev->plat_dev->dev, "-r", + match_child); + if (!dev->mem_dev_r) { + mfc_err("Mem child (R) device get failed\n"); + ret = -ENODEV; + goto err_res; } dev->alloc_ctx[0] = vb2_dma_contig_init_ctx(dev->mem_dev_l);