From patchwork Thu Apr 10 07:32:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 3960221 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 54F42BFF02 for ; Thu, 10 Apr 2014 07:32:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8897120630 for ; Thu, 10 Apr 2014 07:32:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9641920629 for ; Thu, 10 Apr 2014 07:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965070AbaDJHcd (ORCPT ); Thu, 10 Apr 2014 03:32:33 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:18150 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965168AbaDJHca (ORCPT ); Thu, 10 Apr 2014 03:32:30 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N3T00L310Y5GHE0@mailout1.samsung.com> for linux-media@vger.kernel.org; Thu, 10 Apr 2014 16:32:29 +0900 (KST) X-AuditID: cbfee61b-b7f456d000006dfd-da-5346490db8c7 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id B3.18.28157.D0946435; Thu, 10 Apr 2014 16:32:29 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N3T005990XW0YD0@mmp2.samsung.com>; Thu, 10 Apr 2014 16:32:29 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org Cc: s.nawrocki@samsung.com, Jacek Anaszewski , Kyungmin Park Subject: [PATCH v2 3/8] s5p-jpeg: Add m2m_ops field to the s5p_jpeg_variant structure Date: Thu, 10 Apr 2014 09:32:13 +0200 Message-id: <1397115138-1095-3-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1397115138-1095-1-git-send-email-j.anaszewski@samsung.com> References: <1397115138-1095-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrCJMWRmVeSWpSXmKPExsVy+t9jQV1eT7dggzXLJS16rz5ntDjb9Ibd omfDVlaLw2/aWR1YPPq2rGL0+LxJLoApissmJTUnsyy1SN8ugStjQvM8loLZYhV32iczNzA+ EOpi5OSQEDCReHvoEhuELSZx4d56IJuLQ0hgOqPE/5O/mCCcdiaJy02NYFVsAoYSP1+8ZgKx RQTkJZ703gCKc3AwC5RIHFqvCBIWFgiXOHZkBTuIzSKgKvF39gEwm1fAXeLAtM9MIOUSAgoS cybZgIQ5BTwkfuxZzwxiCwGVbJx8nXkCI+8CRoZVjKKpBckFxUnpuUZ6xYm5xaV56XrJ+bmb GMFh8Ux6B+OqBotDjAIcjEo8vAeWuQYLsSaWFVfmHmKU4GBWEuFVEHILFuJNSaysSi3Kjy8q zUktPsQozcGiJM57sNU6UEggPbEkNTs1tSC1CCbLxMEp1cDY+SlAfdE6seVrYzeZHFa/8OLM /0UPGDa+uvnXj/HoR6bk5SbPMyvXJH+956D+TGb5Lw07+Q3qRm8Mtdg3rnK6HrI3xdTnmzTL fLktHYdiDr6vZuuRcby1uuVXdcuBzJQQq5MBdqlMk7Tsud8eKzS72969uWb61i3H7W3y/tdc 8rsx9/zpc39alViKMxINtZiLihMBPja2ewcCAAA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, 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 Simplify the code by adding m2m_ops field to the s5p_jpeg_variant structure which allows to avoid "if" statement in the s5p_jpeg_probe function. Signed-off-by: Jacek Anaszewski Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 12 ++++-------- drivers/media/platform/s5p-jpeg/jpeg-core.h | 7 ++++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index d307c0f..1b69b69 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -1566,7 +1566,7 @@ static struct v4l2_m2m_ops s5p_jpeg_m2m_ops = { .job_abort = s5p_jpeg_job_abort, } ; -static struct v4l2_m2m_ops exynos_jpeg_m2m_ops = { +static struct v4l2_m2m_ops exynos4_jpeg_m2m_ops = { .device_run = exynos4_jpeg_device_run, .job_ready = s5p_jpeg_job_ready, .job_abort = s5p_jpeg_job_abort, @@ -1852,7 +1852,6 @@ static int s5p_jpeg_probe(struct platform_device *pdev) { struct s5p_jpeg *jpeg; struct resource *res; - struct v4l2_m2m_ops *samsung_jpeg_m2m_ops; int ret; if (!pdev->dev.of_node) @@ -1906,13 +1905,8 @@ static int s5p_jpeg_probe(struct platform_device *pdev) goto clk_get_rollback; } - if (jpeg->variant->version == SJPEG_S5P) - samsung_jpeg_m2m_ops = &s5p_jpeg_m2m_ops; - else - samsung_jpeg_m2m_ops = &exynos_jpeg_m2m_ops; - /* mem2mem device */ - jpeg->m2m_dev = v4l2_m2m_init(samsung_jpeg_m2m_ops); + jpeg->m2m_dev = v4l2_m2m_init(jpeg->variant->m2m_ops); if (IS_ERR(jpeg->m2m_dev)) { v4l2_err(&jpeg->v4l2_dev, "Failed to init mem2mem device\n"); ret = PTR_ERR(jpeg->m2m_dev); @@ -2101,12 +2095,14 @@ static const struct dev_pm_ops s5p_jpeg_pm_ops = { static struct s5p_jpeg_variant s5p_jpeg_drvdata = { .version = SJPEG_S5P, .jpeg_irq = s5p_jpeg_irq, + .m2m_ops = &s5p_jpeg_m2m_ops, .fmt_ver_flag = SJPEG_FMT_FLAG_S5P, }; static struct s5p_jpeg_variant exynos4_jpeg_drvdata = { .version = SJPEG_EXYNOS4, .jpeg_irq = exynos4_jpeg_irq, + .m2m_ops = &exynos4_jpeg_m2m_ops, .fmt_ver_flag = SJPEG_FMT_FLAG_EXYNOS4, }; diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.h b/drivers/media/platform/s5p-jpeg/jpeg-core.h index c222436..3e47863 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.h +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.h @@ -117,9 +117,10 @@ struct s5p_jpeg { }; struct s5p_jpeg_variant { - unsigned int version; - unsigned int fmt_ver_flag; - irqreturn_t (*jpeg_irq)(int irq, void *priv); + unsigned int version; + unsigned int fmt_ver_flag; + struct v4l2_m2m_ops *m2m_ops; + irqreturn_t (*jpeg_irq)(int irq, void *priv); }; /**