From patchwork Mon Feb 20 13:38:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 94215 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1327168qgi; Mon, 20 Feb 2017 05:39:57 -0800 (PST) X-Received: by 10.99.137.66 with SMTP id v63mr5177210pgd.94.1487597997076; Mon, 20 Feb 2017 05:39:57 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si18592166pge.343.2017.02.20.05.39.56; Mon, 20 Feb 2017 05:39:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753294AbdBTNjW (ORCPT + 4 others); Mon, 20 Feb 2017 08:39:22 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:21738 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752707AbdBTNjR (ORCPT ); Mon, 20 Feb 2017 08:39:17 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLO0067ADXGYY50@mailout1.w1.samsung.com>; Mon, 20 Feb 2017 13:39:16 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170220133915eucas1p154b1a9669f26183f88132134a09189f1~lAnV-37Yj3254632546eucas1p1D; Mon, 20 Feb 2017 13:39:15 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id B0.F8.09557.381FAA85; Mon, 20 Feb 2017 13:39:15 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170220133914eucas1p1d45c1e88319669e3c63b1b3626b1b519~lAnVR5PWf3063330633eucas1p1j; Mon, 20 Feb 2017 13:39:14 +0000 (GMT) X-AuditID: cbfec7f2-f790f6d000002555-c9-58aaf1833c07 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id AC.E7.06687.6D1FAA85; Mon, 20 Feb 2017 13:40:38 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLO00HBFDX6PK30@eusync1.samsung.com>; Mon, 20 Feb 2017 13:39:14 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH v2 09/15] media: s5p-mfc: Allocate firmware with internal private buffer alloc function Date: Mon, 20 Feb 2017 14:38:58 +0100 Message-id: <1487597944-2000-10-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487597944-2000-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrIIsWRmVeSWpSXmKPExsWy7djP87rNH1dFGEx+IGJxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK+Pzl9usBX94Kx6c283UwHiLu4uRk0NCwESi//c2NghbTOLCvfVANheHkMBS Rolva5+xQDifGSWeP9jFDtNx9s5pqMQyRokl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FzAyrGIUSS0t zk3PLTbUK07MLS7NS9dLzs/dxAgM323Hfm7ewXhpY/AhRgEORiUeXo2ZKyOEWBPLiitzDzFK cDArifBefrkqQog3JbGyKrUoP76oNCe1+BCjKdBNE5mlRJPzgbGVVxJvaGJobmloZGxhYW5k pCTOW/LhSriQQHpiSWp2ampBahFMHxMHp1QDo13e5c9tnIu/zVtnUnBfTOh/17JH+5smFX3W /Cm8ofNt/MtHbU0zyll9N39jvPx9cua0My7RRyvi0ttO/e07rfjJ9OB1z52BH+Ztyjohv3aS hmPcqrun3h1mvScnpPh3vZ1spKPAzlLR6qhObu2PCSJXpIR8RJZfl3XXrNTR+iUjMWPy7qWS O5RYijMSDbWYi4oTARZNO7Z1AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170220133914eucas1p1d45c1e88319669e3c63b1b3626b1b519 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170220133914eucas1p1d45c1e88319669e3c63b1b3626b1b519 X-RootMTR: 20170220133914eucas1p1d45c1e88319669e3c63b1b3626b1b519 References: <1487597944-2000-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Once firmware buffer has been converted to use s5p_mfc_priv_buf structure, it is possible to allocate it with existing s5p_mfc_alloc_priv_buf() function. This change will help to reduce code variants in the next patches. Signed-off-by: Marek Szyprowski Reviewed-by: Javier Martinez Canillas --- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) -- 1.9.1 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index b0cf3970117a..a1811ee538bd 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c @@ -27,6 +27,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) { struct s5p_mfc_priv_buf *fw_buf = &dev->fw_buf; + int err; fw_buf->size = dev->variant->buf_size->fw; @@ -35,11 +36,10 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) return -ENOMEM; } - fw_buf->virt = dma_alloc_coherent(dev->mem_dev[BANK1_CTX], fw_buf->size, - &fw_buf->dma, GFP_KERNEL); - if (!fw_buf->virt) { + err = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &dev->fw_buf); + if (err) { mfc_err("Allocating bitprocessor buffer failed\n"); - return -ENOMEM; + return err; } return 0; @@ -92,11 +92,7 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev) { /* Before calling this function one has to make sure * that MFC is no longer processing */ - if (!dev->fw_buf.virt) - return -EINVAL; - dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_buf.size, - dev->fw_buf.virt, dev->fw_buf.dma); - dev->fw_buf.virt = NULL; + s5p_mfc_release_priv_buf(dev, &dev->fw_buf); return 0; }