Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5183874ybi; Tue, 4 Jun 2019 02:39:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAmbSP44mWMHUKAIk6Lg5YN4aYHI6JDd32N+rSO6UXXGFzRydpy8R0GujSLhTSrPOjp/K8 X-Received: by 2002:a17:902:8f96:: with SMTP id z22mr35255105plo.248.1559641175674; Tue, 04 Jun 2019 02:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559641175; cv=none; d=google.com; s=arc-20160816; b=kaPCcaQRE7zc3ZcDxJOPUsr88rF+Id56AmyjMVsGWXk4A/j0NANcfkCXdMcDTvGTAE SxTPk+OSmvuPHvvMMhcvPmvksRkjPhXVPUWMHIBlOwv3HpHcQgsRDwMvVjllwOU6g8j1 HUYH2uqp1YSytGyPPV0bhWuEO6Xnkw4YbryRHOTYDLDCAg/rIg0e7pmubtU0nC85wB5H MEswgP7GPlpAI6QxjxHzcCc+7it3Rqvh79CYXDoxzPmM8/vIp3l6SFBxl4R02M+FJSGu JxyYQugicCFD2wNlY0sYisO/06YQESfmPGBZeiOY+Gy+fB2acYvOEiugRQRLRPX0E06F SnZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3vo0CKjVAQO8Efn26GFf+EbXSh3Y7HePB8JtNRXrXQo=; b=vO8RMAvWKVVUA2asIeImsMFLrZntZd3xzeIluD8XZ/FT2Zj/UkTQymaQXPc9AjT0fl NgAnDh5EN6RSIhE9Vb3SK667VHCTbDO4QBFRAqYee7/yAFQ4riN+4Tpx+oP3aJ2+HcnI PfFq0j4OkvFmC6m3joJK3RoFO544QJaG41Xt4ZM2JVFtdQyj7JBBWNUYyI7SW1s8HifC peq44JbNQoLVDcS+Tk4RNB74LgDpKuUQepR7s/WJCECqle8q4KFSn2y5IFBhOVKyrE1D InlOJbtRJZ1x3JJ/WxM9wmjeaVlWddHSYHTLP26691OxeZMZClU4MsEbjqndMhAEUA8+ B9hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SP2kR9aT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x26si22772395pfm.241.2019.06.04.02.39.19; Tue, 04 Jun 2019 02:39:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=SP2kR9aT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727163AbfFDJiE (ORCPT + 99 others); Tue, 4 Jun 2019 05:38:04 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40056 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbfFDJiB (ORCPT ); Tue, 4 Jun 2019 05:38:01 -0400 Received: by mail-pf1-f195.google.com with SMTP id u17so12338576pfn.7 for ; Tue, 04 Jun 2019 02:38:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3vo0CKjVAQO8Efn26GFf+EbXSh3Y7HePB8JtNRXrXQo=; b=SP2kR9aTHjK29bZKBEesqtIsZN4oZoGMbmZIJ/+FA5UMlOgTTSKTsMB2pe9Ea4lR/p NqyLYFPdRCVfD9wxloIYk6aZU/79opinVilnNWqAygu3Bi4RVOpYKbhmJYVop2pvOjGO 4gbPMPTE5V3v/7KHFQiaTjCK0PMCYe6b+A1Vg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3vo0CKjVAQO8Efn26GFf+EbXSh3Y7HePB8JtNRXrXQo=; b=TTqKPM3lzXRCEIl4K0ZUY8uhI7l0NulzSQBfTTvNmkcpaVmcofrM6wIRyozKRdyEQl VsYq+4rHuODxZ0hSF2PxkVFlGBY03u30hVAM2JMQuqnjJRBHmoSYDCVpeR2SWC6fwY7e ul0GOo1lM5vntdAnEc8oREPIh2jS2FdsheHqK3Lwpr224rEVTPVjGPbcoVVE3waCzZ0i Qqo7gHX1+pzQFiMaqoCSJaHQd/YL2CMvd2qajmhKA96Tbsf260OSOuoH9HGU94kxEx4D 7JvVKJZ0ib3xbQR0nHl2hz9uInmrxyLq7B4rFSX7IgiTE9qEMAH0OEffkF19PhRARJo9 KzeA== X-Gm-Message-State: APjAAAX+uj8vLs3KbEhYP4oteni3b5msa4H+kRC0vUh7LbnjklqA4PVP zoMbf6JbRcPvebqpsjZogZ7GKA== X-Received: by 2002:aa7:8193:: with SMTP id g19mr29469117pfi.162.1559641081312; Tue, 04 Jun 2019 02:38:01 -0700 (PDT) Received: from acourbot.tok.corp.google.com ([2401:fa00:4:4:9712:8cf1:d0f:7d33]) by smtp.gmail.com with ESMTPSA id j7sm17431588pfa.184.2019.06.04.02.37.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jun 2019 02:38:00 -0700 (PDT) From: Alexandre Courbot To: Tiffany Lin , Andrew-CT Chen , Mauro Carvalho Chehab , Yunfei Dong , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandre Courbot Subject: [PATCH 3/5] media: mtk-vcodec: remove unneeded proxy functions Date: Tue, 4 Jun 2019 18:37:35 +0900 Message-Id: <20190604093737.172599-4-acourbot@chromium.org> X-Mailer: git-send-email 2.22.0.rc1.311.g5d7573a151-goog In-Reply-To: <20190604093737.172599-1-acourbot@chromium.org> References: <20190604093737.172599-1-acourbot@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We were getting the codec interface through a proxy function that does not bring anything compared to just accessing the interface definition directly, so just do that. Also make the decoder interfaces const. Signed-off-by: Alexandre Courbot --- .../media/platform/mtk-vcodec/vdec/vdec_h264_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/vdec_drv_if.c | 12 ++++++------ .../media/platform/mtk-vcodec/venc/venc_h264_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/venc_drv_if.c | 8 ++++---- 7 files changed, 15 insertions(+), 50 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c index 0c0660d2560b..85afdd6ab093 100644 --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c @@ -481,16 +481,9 @@ static int vdec_h264_get_param(void *h_vdec, enum vdec_get_param_type type, return 0; } -static struct vdec_common_if vdec_h264_if = { +const struct vdec_common_if vdec_h264_if = { .init = vdec_h264_init, .decode = vdec_h264_decode, .get_param = vdec_h264_get_param, .deinit = vdec_h264_deinit, }; - -struct vdec_common_if *get_h264_dec_comm_if(void); - -struct vdec_common_if *get_h264_dec_comm_if(void) -{ - return &vdec_h264_if; -} diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c index 1e3763881e0d..a8ca762eac76 100644 --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c @@ -605,16 +605,9 @@ static void vdec_vp8_deinit(void *h_vdec) kfree(inst); } -static struct vdec_common_if vdec_vp8_if = { +const struct vdec_common_if vdec_vp8_if = { .init = vdec_vp8_init, .decode = vdec_vp8_decode, .get_param = vdec_vp8_get_param, .deinit = vdec_vp8_deinit, }; - -struct vdec_common_if *get_vp8_dec_comm_if(void); - -struct vdec_common_if *get_vp8_dec_comm_if(void) -{ - return &vdec_vp8_if; -} diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c index 589b2fc91da2..1f99febdfbbe 100644 --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c @@ -994,16 +994,9 @@ static int vdec_vp9_get_param(void *h_vdec, enum vdec_get_param_type type, return ret; } -static struct vdec_common_if vdec_vp9_if = { +const struct vdec_common_if vdec_vp9_if = { .init = vdec_vp9_init, .decode = vdec_vp9_decode, .get_param = vdec_vp9_get_param, .deinit = vdec_vp9_deinit, }; - -struct vdec_common_if *get_vp9_dec_comm_if(void); - -struct vdec_common_if *get_vp9_dec_comm_if(void) -{ - return &vdec_vp9_if; -} diff --git a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c index 5d8d76d55005..aa614eea3cc5 100644 --- a/drivers/media/platform/mtk-vcodec/vdec_drv_if.c +++ b/drivers/media/platform/mtk-vcodec/vdec_drv_if.c @@ -10,9 +10,9 @@ #include "mtk_vcodec_dec_pm.h" #include "mtk_vpu.h" -const struct vdec_common_if *get_h264_dec_comm_if(void); -const struct vdec_common_if *get_vp8_dec_comm_if(void); -const struct vdec_common_if *get_vp9_dec_comm_if(void); +extern const struct vdec_common_if vdec_h264_if; +extern const struct vdec_common_if vdec_vp8_if; +extern const struct vdec_common_if vdec_vp9_if; int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc) { @@ -20,13 +20,13 @@ int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc) switch (fourcc) { case V4L2_PIX_FMT_H264: - ctx->dec_if = get_h264_dec_comm_if(); + ctx->dec_if = &vdec_h264_if; break; case V4L2_PIX_FMT_VP8: - ctx->dec_if = get_vp8_dec_comm_if(); + ctx->dec_if = &vdec_vp8_if; break; case V4L2_PIX_FMT_VP9: - ctx->dec_if = get_vp9_dec_comm_if(); + ctx->dec_if = &vdec_vp9_if; break; default: return -EINVAL; diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c index bfe61d5dc1cb..4e1d933395cd 100644 --- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c +++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c @@ -649,16 +649,9 @@ static int h264_enc_deinit(void *handle) return ret; } -static const struct venc_common_if venc_h264_if = { +const struct venc_common_if venc_h264_if = { .init = h264_enc_init, .encode = h264_enc_encode, .set_param = h264_enc_set_param, .deinit = h264_enc_deinit, }; - -const struct venc_common_if *get_h264_enc_comm_if(void); - -const struct venc_common_if *get_h264_enc_comm_if(void) -{ - return &venc_h264_if; -} diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c index af23367cf1dd..2d1372ab6486 100644 --- a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c +++ b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c @@ -455,16 +455,9 @@ static int vp8_enc_deinit(void *handle) return ret; } -static const struct venc_common_if venc_vp8_if = { +const struct venc_common_if venc_vp8_if = { .init = vp8_enc_init, .encode = vp8_enc_encode, .set_param = vp8_enc_set_param, .deinit = vp8_enc_deinit, }; - -const struct venc_common_if *get_vp8_enc_comm_if(void); - -const struct venc_common_if *get_vp8_enc_comm_if(void) -{ - return &venc_vp8_if; -} diff --git a/drivers/media/platform/mtk-vcodec/venc_drv_if.c b/drivers/media/platform/mtk-vcodec/venc_drv_if.c index 318af1b4b6e7..cf5bfa296d20 100644 --- a/drivers/media/platform/mtk-vcodec/venc_drv_if.c +++ b/drivers/media/platform/mtk-vcodec/venc_drv_if.c @@ -11,8 +11,8 @@ #include "mtk_vcodec_enc_pm.h" #include "mtk_vpu.h" -const struct venc_common_if *get_h264_enc_comm_if(void); -const struct venc_common_if *get_vp8_enc_comm_if(void); +extern const struct venc_common_if venc_h264_if; +extern const struct venc_common_if venc_vp8_if; int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc) { @@ -20,10 +20,10 @@ int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc) switch (fourcc) { case V4L2_PIX_FMT_VP8: - ctx->enc_if = get_vp8_enc_comm_if(); + ctx->enc_if = &venc_vp8_if; break; case V4L2_PIX_FMT_H264: - ctx->enc_if = get_h264_enc_comm_if(); + ctx->enc_if = &venc_h264_if; break; default: return -EINVAL; -- 2.22.0.rc1.311.g5d7573a151-goog