From patchwork Tue Aug 5 10:47:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 34926 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BBA5220523 for ; Tue, 5 Aug 2014 10:50:13 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id 29sf2452855yhl.10 for ; Tue, 05 Aug 2014 03:50:13 -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=p1BSF1QCbP3+tXd4U/vibqhCLoKp+sbQXqoMVufZBy8=; b=g5FlNoS6R2XNUTgtkNagYQnQeU4z13rDjWrhTU2WaoB9MgOjU0YH9ZomHEqtlGbSr5 qOJ7l8+DpLd8wsFFKBHgrNZFwmDNQQClVPtWNr0DYvMwnZwNZ26p+bzbTF3ZBeMKkBsh B60mygqU8+QwiBQ2wbOtMYNXlknv3L56HkopOlQrL+WRYTnvu5onWIKW6crT0xS5BkNw 1Q/1xvXTDIZkfpqG/2H3OhvYLdHPMELLHWLvE4jqpuKVXhZMLtfU+MVsJImln8X/IMq6 g9GD6BPMvzjLG1hPAsvsUv2XFZwYGNNP70aNstDCp3D5KBuzHEFiALORRCHDdsnueXCm jieQ== X-Gm-Message-State: ALoCoQlg0T403DrJewNhLJ7w4sMEjMCqrObftawsRs9fWgF53oOpRXd498rdvGj5M/Vg5EvE+wQt X-Received: by 10.236.150.170 with SMTP id z30mr83524yhj.58.1407235813580; Tue, 05 Aug 2014 03:50:13 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.82 with SMTP id y76ls221276qgy.75.gmail; Tue, 05 Aug 2014 03:50:13 -0700 (PDT) X-Received: by 10.220.189.3 with SMTP id dc3mr515727vcb.64.1407235813484; Tue, 05 Aug 2014 03:50:13 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id y6si783951vef.45.2014.08.05.03.50.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:50:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id lf12so1108318vcb.15 for ; Tue, 05 Aug 2014 03:50:13 -0700 (PDT) X-Received: by 10.220.167.9 with SMTP id o9mr2460284vcy.8.1407235813400; Tue, 05 Aug 2014 03:50:13 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp374624vcb; Tue, 5 Aug 2014 03:50:12 -0700 (PDT) X-Received: by 10.224.46.138 with SMTP id j10mr4062102qaf.85.1407235812848; Tue, 05 Aug 2014 03:50:12 -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 t73si2127464qge.118.2014.08.05.03.50.12 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 05 Aug 2014 03:50:12 -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 1XEcJn-0005Pg-Cf; Tue, 05 Aug 2014 10:50:11 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XEcIk-0005FP-Dh for linaro-mm-sig@lists.linaro.org; Tue, 05 Aug 2014 10:49:06 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9T00D9ZY1ELQ00@mailout4.w1.samsung.com> for linaro-mm-sig@lists.linaro.org; Tue, 05 Aug 2014 11:48:50 +0100 (BST) X-AuditID: cbfec7f4-b7f156d0000063c7-c1-53e0b69c058c Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 03.1C.25543.C96B0E35; Tue, 05 Aug 2014 11:49:00 +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 <0N9T0057MY17SE80@eusync3.samsung.com>; Tue, 05 Aug 2014 11:49:00 +0100 (BST) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Tue, 05 Aug 2014 12:47:41 +0200 Message-id: <1407235677-26324-14-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> References: <1407235677-26324-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRmVeSWpSXmKPExsVy+t/xq7pztj0INvjVKGzxd9IxdovmxevZ LCbdn8BisWC/tUXn7A3sFr0LrrJZnG16w27ROXEJu8WXKw+ZLDY9vsZqcXnXHDaLGef3MVms PXKX3eLU9c9sFv96DzJanDl9idXi/54d7BaH37SzWhx5uJvdYtWuP4wWt3/zOYh6PDk4j8nj 969JjB47Z91l95jdMZPVY9OqTjaP/XPXsHtsXlLvcfvfY2aPyTeWM3pcOdHE6tHb/I7NY8vV dhaPvi2rGD0+b5IL4IvisklJzcksSy3St0vgyji9YzZrwRbpiobtExkbGJ+IdTFyckgImEic /D6RGcIWk7hwbz1bFyMXh5DAUkaJqf8fs0I4fUwSl7d9ZAGpYhMwlOh62wVWJSLQyyjR3/SD CcRhFljHKrG/9zpYlbBAjsSHfU1gc1kEVCX27D4EZvMKeErc+zGHDWKfnMT/lyuYQGxOoPjh mwdYQWwhAQ+JnxvWsE9g5F3AyLCKUTS1NLmgOCk911CvODG3uDQvXS85P3cTIyR2vuxgXHzM 6hCjAAejEg+vwem7wUKsiWXFlbmHGCU4mJVEeCXWPAgW4k1JrKxKLcqPLyrNSS0+xMjEwSnV wFh5Sf4Sy4lEVU5bg+ibmjo+3Fb/nJUNNZs6eL5NPGq+ar+CTvjb6mlN0/YZNDikci07fb+0 /ord/+j2r8FCgZyLKxIcVzNPMAh9N+ujpeqzOe/cFhi84pxxbFH7MZl1qzZNnRC0VYf79Mnu vIem8q7iP9eLOiekr5NbKX0gVztNkWm2b9v8SCWW4oxEQy3mouJEAEoc1uV7AgAA Cc: Rob Herring , Thierry Reding , Shaik Ameer Basha , Arnd Bergmann , Inki Dae , Greg Kroah-Hartman , Joerg Roedel , "Rafael J. Wysocki" , Tomasz Figa , linaro-mm-sig@lists.linaro.org, Kyungmin Park , Kukjin Kim , Laurent Pinchart , Sylwester Nawrocki , Olof Johansson , Cho KyongHo Subject: [Linaro-mm-sig] [PATCH 13/29] temporary: media: s5p-mfc: remove DT hacks & initialization custom memory init code 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.170 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 This patch removes custom initialization of reserved memory regions from s5p-mfc driver. Driver will use main device pointer for all memory allocations. This patch is temporary, do not merge it yet. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 73 +------------------------------- 1 file changed, 2 insertions(+), 71 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index d35b041..77b99ae 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -996,55 +996,8 @@ static const struct v4l2_file_operations s5p_mfc_fops = { .mmap = s5p_mfc_mmap, }; -static int match_child(struct device *dev, void *data) -{ - if (!dev_name(dev)) - return 0; - return !strcmp(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) { @@ -1096,26 +1049,8 @@ 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 = &dev->plat_dev->dev; + dev->mem_dev_r = &dev->plat_dev->dev; dev->alloc_ctx[0] = vb2_dma_contig_init_ctx(dev->mem_dev_l); if (IS_ERR(dev->alloc_ctx[0])) { @@ -1246,10 +1181,6 @@ static int s5p_mfc_remove(struct platform_device *pdev) s5p_mfc_release_firmware(dev); vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]); vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[1]); - if (pdev->dev.of_node) { - put_device(dev->mem_dev_l); - put_device(dev->mem_dev_r); - } s5p_mfc_final_pm(dev); return 0;