media: mtk-vcodec: remove unneeded proxy functions
authorAlexandre Courbot <acourbot@chromium.org>
Fri, 14 Jun 2019 07:56:40 +0000 (03:56 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 21 Jun 2019 21:10:20 +0000 (17:10 -0400)
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 <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c
drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c
drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c
drivers/media/platform/mtk-vcodec/vdec_drv_if.c
drivers/media/platform/mtk-vcodec/vdec_drv_if.h
drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
drivers/media/platform/mtk-vcodec/venc_drv_if.c
drivers/media/platform/mtk-vcodec/venc_drv_if.h

index 67a7d4f813d583dd3f5e92930080b61056ce7115..c5f8f1fca44c2912a8f2dbe6431d915f198c5043 100644 (file)
@@ -485,16 +485,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;
-}
index 42e302650e693b8bc2d1a74f911558969806f6ec..63a8708ce6822df186e21ad99d5e658839507e21 100644 (file)
@@ -610,16 +610,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;
-}
index 7935f97989b075fe441e002ffdaa7145a91a6912..5066c283d86d1e29194a8727f6512159b2d4b9d4 100644 (file)
@@ -1000,16 +1000,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;
-}
index 8354404a7fc96da430bbb56517e32d97910f7321..2e43dd4486e08df7a7da11f758bb0d31f35b5aad 100644 (file)
 #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);
-
 int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
 {
        int ret = 0;
 
        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;
index c5bd8b0dbe13d7c3cbdf17b1e2a1bccac109554f..270d8dc9984b0028c54526448cfa44ecaae668e1 100644 (file)
@@ -54,6 +54,10 @@ struct vdec_fb_node {
        struct vdec_fb *fb;
 };
 
+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;
+
 /**
  * vdec_if_init() - initialize decode driver
  * @ctx        : [in] v4l2 context
index 0183dd395d44c781b7449215525cc78d112b5838..b9624f8df0e9797fe27b91410640a249c67623dc 100644 (file)
@@ -655,16 +655,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;
-}
index 3787e75ca902d8d5b1a2dc3ce25129a7c33c1769..8d36f0362efe4086ea374d5796b74793b0fa9b54 100644 (file)
@@ -460,16 +460,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;
-}
index b5cc645f7c6826261d6e6e02b8de4212121d2c89..c6bb82ac2dcd0e25d297c7441cf7443b65c5eea5 100644 (file)
 #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);
-
 int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)
 {
        int ret = 0;
 
        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;
index cc5bb36c273515040ded10ba726337aa6dfa074e..52fc9cc812fc371318b9e3058a93e38268dea9c0 100644 (file)
@@ -110,6 +110,9 @@ struct venc_done_result {
        bool is_key_frm;
 };
 
+extern const struct venc_common_if venc_h264_if;
+extern const struct venc_common_if venc_vp8_if;
+
 /*
  * venc_if_init - Create the driver handle
  * @ctx: device context