From patchwork Tue Feb 14 07:52:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 9571395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53C146045F for ; Tue, 14 Feb 2017 07:52:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4585426E94 for ; Tue, 14 Feb 2017 07:52:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A5C128358; Tue, 14 Feb 2017 07:52:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2AB0205AF for ; Tue, 14 Feb 2017 07:52:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752600AbdBNHwa (ORCPT ); Tue, 14 Feb 2017 02:52:30 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:39761 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752342AbdBNHwX (ORCPT ); Tue, 14 Feb 2017 02:52:23 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC002MPTV7KW20@mailout3.w1.samsung.com>; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075219eucas1p234b5f62e6c91c5c9256186508032bc98~jGAtn9Iwa1548415484eucas1p2E; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 1D.15.30614.237B2A85; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075218eucas1p188d8d26aa2a6c9157587e1c979008817~jGAs82BGq2457524575eucas1p1e; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) X-AuditID: cbfec7f1-f793f6d000007796-8f-58a2b732968a Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2F.5E.06687.187B2A85; Tue, 14 Feb 2017 07:53:37 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:18 +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 09/15] media: s5p-mfc: Allocate firmware with internal private buffer alloc function Date: Tue, 14 Feb 2017 08:52:02 +0100 Message-id: <1487058728-16501-10-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsWy7djP87pG2xdFGDxot7a4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwef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IgJPEwll/2UFsZoHvjBLLbqaB2MICaRJvZzwGi7MIqEps6NvG DGLzCnhKHPo4kRVim5zEyWOTwWxOoPimz1MYQWwhAQ+Js2t2sE9g5F3AyLCKUSS1tDg3PbfY UK84Mbe4NC9dLzk/dxMjMIC3Hfu5eQfjpY3BhxgFOBiVeHgnHFgYIcSaWFZcmXuIUYKDWUmE l6F3UYQQb0piZVVqUX58UWlOavEhRlOgoyYyS4km5wOjK68k3tDE0NzS0MjYwsLcyEhJnLfk w5VwIYH0xJLU7NTUgtQimD4mDk6pBsaW5nNS6myK7/Srbyxhm168WPKzhvqzjmQjNpHLW2dL 1vbfW7bceFHF+h+lu39kPLpjViVmrbYivYTdsHD6m1vvAriuhpQ0uc72kwq8xNnoo8W+e6YO 06JXq3SemLyevD2mwWH1PtbMUq/tVjb1rKIOeVqhe/tUO7ynJp42Yc4SNRHrOn2sVYmlOCPR UIu5qDgRAJT1aVt2AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075218eucas1p188d8d26aa2a6c9157587e1c979008817 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075218eucas1p188d8d26aa2a6c9157587e1c979008817 X-RootMTR: 20170214075218eucas1p188d8d26aa2a6c9157587e1c979008817 References: <1487058728-16501-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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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; }