From patchwork Thu Apr 10 07:32:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 3960201 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8C9699F336 for ; Thu, 10 Apr 2014 07:32:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B678420630 for ; Thu, 10 Apr 2014 07:32:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 81B0420629 for ; Thu, 10 Apr 2014 07:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965163AbaDJHc1 (ORCPT ); Thu, 10 Apr 2014 03:32:27 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:63457 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965070AbaDJHc0 (ORCPT ); Thu, 10 Apr 2014 03:32:26 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N3T0091G0Y1ODD0@mailout2.samsung.com> for linux-media@vger.kernel.org; Thu, 10 Apr 2014 16:32:25 +0900 (KST) X-AuditID: cbfee61a-b7fb26d00000724f-95-53464909ae99 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 18.C3.29263.90946435; Thu, 10 Apr 2014 16:32:25 +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:25 +0900 (KST) From: Jacek Anaszewski To: linux-media@vger.kernel.org Cc: s.nawrocki@samsung.com, Jacek Anaszewski , Kyungmin Park Subject: [PATCH v2 1/8] s5p-jpeg: Add fmt_ver_flag field to the s5p_jpeg_variant structure Date: Thu, 10 Apr 2014 09:32:11 +0200 Message-id: <1397115138-1095-1-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFJMWRmVeSWpSXmKPExsVy+t9jQV1OT7dgg0m/lCx6rz5ntDjb9Ibd omfDVlaLw2/aWR1YPPq2rGL0+LxJLoApissmJTUnsyy1SN8ugSvj5uwvjAVdIhWLX3WxNDDe Eehi5OSQEDCRaO66xAphi0lcuLeerYuRi0NIYDqjxMVtC5ggnHYmiYavB9hBqtgEDCV+vnjN BGKLCMhLPOm9AdTBwcEsUCJxaL0iiCksECPxfVIaiMkioCrxe7YwSDGvgLvE6j0XwYolBBQk 5kyymcDIvYCRYRWjaGpBckFxUnquoV5xYm5xaV66XnJ+7iZGsI+fSe1gXNlgcYhRgINRiYf3 wDLXYCHWxLLiytxDjBIczEoivApCbsFCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeQ+0WgcKCaQn lqRmp6YWpBbBZJk4OKUaGPUZS7wU4z8lmZs9Xj/f55DW7Z2WrrNzP3Sb1ARz1B/8E/ZnxRdL 7YnB/azt5faJ9/9e4nwsxbiWJWDaVYGy8/1VzXdNfyctKX9mzfBQ4emB2rtH5rHMj32Z8pQh edfOpboxU/fl/CqKk5aKOPjQsfRS83Ge0luqDQzh4rwuB7ZFxM5mbdSxV2Ipzkg01GIuKk4E APJfSbPtAQAA 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 fmt_ver_flag field to the s5p_jpeg_variant structure which allows to avoid "if" statement in the s5p_jpeg_find_format function. Signed-off-by: Jacek Anaszewski Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 11 ++++------- drivers/media/platform/s5p-jpeg/jpeg-core.h | 1 + 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 8a18972..3ae9210 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -959,7 +959,7 @@ static int s5p_jpeg_g_fmt(struct file *file, void *priv, struct v4l2_format *f) static struct s5p_jpeg_fmt *s5p_jpeg_find_format(struct s5p_jpeg_ctx *ctx, u32 pixelformat, unsigned int fmt_type) { - unsigned int k, fmt_flag, ver_flag; + unsigned int k, fmt_flag; if (ctx->mode == S5P_JPEG_ENCODE) fmt_flag = (fmt_type == FMT_TYPE_OUTPUT) ? @@ -970,16 +970,11 @@ static struct s5p_jpeg_fmt *s5p_jpeg_find_format(struct s5p_jpeg_ctx *ctx, SJPEG_FMT_FLAG_DEC_OUTPUT : SJPEG_FMT_FLAG_DEC_CAPTURE; - if (ctx->jpeg->variant->version == SJPEG_S5P) - ver_flag = SJPEG_FMT_FLAG_S5P; - else - ver_flag = SJPEG_FMT_FLAG_EXYNOS4; - for (k = 0; k < ARRAY_SIZE(sjpeg_formats); k++) { struct s5p_jpeg_fmt *fmt = &sjpeg_formats[k]; if (fmt->fourcc == pixelformat && fmt->flags & fmt_flag && - fmt->flags & ver_flag) { + fmt->flags & ctx->jpeg->variant->fmt_ver_flag) { return fmt; } } @@ -2106,11 +2101,13 @@ 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, + .fmt_ver_flag = SJPEG_FMT_FLAG_S5P, }; static struct s5p_jpeg_variant exynos4_jpeg_drvdata = { .version = SJPEG_EXYNOS4, .jpeg_irq = exynos4_jpeg_irq, + .fmt_ver_flag = SJPEG_FMT_FLAG_EXYNOS4, }; static const struct of_device_id samsung_jpeg_match[] = { diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.h b/drivers/media/platform/s5p-jpeg/jpeg-core.h index f482dbf..c222436 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.h +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.h @@ -118,6 +118,7 @@ struct s5p_jpeg { struct s5p_jpeg_variant { unsigned int version; + unsigned int fmt_ver_flag; irqreturn_t (*jpeg_irq)(int irq, void *priv); };