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: 2838665 Return-Path: X-Original-To: patchwork-linux-media@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 E570FBF535 for ; Mon, 5 Aug 2013 12:27:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C30C32015B for ; Mon, 5 Aug 2013 12:27:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 89E5A20119 for ; Mon, 5 Aug 2013 12:27:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752295Ab3HEM1c (ORCPT ); Mon, 5 Aug 2013 08:27:32 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:25372 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752014Ab3HEM13 (ORCPT ); Mon, 5 Aug 2013 08:27:29 -0400 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>; 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 Cc: Marek Szyprowski , Kyungmin Park , Grant Likely , Tomasz Figa , Sylwester Nawrocki , Kamil Debski , Sachin Kamat , Kukjin Kim , Rob Herring , Olof Johansson , Pawel Moll , Mark Rutland , Stephen Warren , Ian Campbell 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= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_HI, 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);