From patchwork Mon Mar 20 10:56:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 95506 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp882200qgd; Mon, 20 Mar 2017 04:00:25 -0700 (PDT) X-Received: by 10.84.177.164 with SMTP id x33mr38669777plb.75.1490007625219; Mon, 20 Mar 2017 04:00:25 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si17052423pgj.392.2017.03.20.04.00.24; Mon, 20 Mar 2017 04:00:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754082AbdCTLAX (ORCPT + 4 others); Mon, 20 Mar 2017 07:00:23 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:35464 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753651AbdCTK5O (ORCPT ); Mon, 20 Mar 2017 06:57:14 -0400 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 <0ON400COL12TV220@mailout1.w1.samsung.com>; Mon, 20 Mar 2017 10:56:53 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170320105653eucas1p286130363d62fc14b9a3edfe7a5b4dc5e~tkdkTIEm00928009280eucas1p2g; Mon, 20 Mar 2017 10:56:53 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 6C.7B.17477.475BFC85; Mon, 20 Mar 2017 10:56:52 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170320105652eucas1p1176471116a8764dd0b0c70e58a2806b3~tkdjoEMFP0562005620eucas1p1t; Mon, 20 Mar 2017 10:56:52 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d000004445-79-58cfb574f635 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 00.EA.10233.285BFC85; Mon, 20 Mar 2017 10:57:06 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ON4005OP12KYT20@eusync4.samsung.com>; Mon, 20 Mar 2017 10:56:52 +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 v3 09/16] media: s5p-mfc: Allocate firmware with internal private buffer alloc function Date: Mon, 20 Mar 2017 11:56:35 +0100 Message-id: <1490007402-30265-10-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1490007402-30265-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsWy7djPc7olW89HGJxrt7G4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwefVtWMXp83iQXwBzFZZOS mpNZllqkb5fAlfHhxV6Wgnt8Fd+OuDUwbuTpYuTkkBAwkdh24T8ThC0mceHeerYuRi4OIYGl jBKP3k6Ec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MERt4FjAyrGEVSS4tz03OL jfSKE3OLS/PS9ZLzczcxAsN327GfW3Ywdr0LPsQowMGoxMNrcPVchBBrYllxZe4hRgkOZiUR 3o9zz0cI8aYkVlalFuXHF5XmpBYfYjQFOmois5Rocj4wtvJK4g1NDM0tDY2MLSzMjYyUxHmn frgSLiSQnliSmp2aWpBaBNPHxMEp1cB4oY45Iv6Iq0QEd2/QzZ7Z1g+mfugTe/vTZLIiUx7f 5by3jckV3dUMi1d4sEZ66vGt5PVe6/BbpnnSX/2dArdlN8WLlM+Oem5c+W7nJR/he5d/7px/ lnu3/4Jqi7rJpWemby6aGRwjG5G46AA798PJz6pPRs8rdJiSmMoasHZxeUfqeXM713tKLMUZ iYZazEXFiQAbjdv6dQIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170320105652eucas1p1176471116a8764dd0b0c70e58a2806b3 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 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: 20170320105652eucas1p1176471116a8764dd0b0c70e58a2806b3 X-RootMTR: 20170320105652eucas1p1176471116a8764dd0b0c70e58a2806b3 References: <1490007402-30265-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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 Acked-by: Andrzej Hajda Tested-by: Smitha T Murthy --- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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; }