From 7c8b4804d65a2b3e90b04b938d99a95663ced2e3 Mon Sep 17 00:00:00 2001 From: Ding Wei Date: Mon, 22 Jun 2020 17:32:31 +0800 Subject: [PATCH] video: rockchip: mpp: adjust the scope of debugfs relative code Change-Id: Ief1bbbfc3712c38f9cf3e2468db0eb8fc5410d3f Signed-off-by: Ding Wei --- drivers/video/rockchip/mpp/mpp_iep2.c | 17 +++++++++++++---- drivers/video/rockchip/mpp/mpp_rkvdec.c | 17 +++++++++++++---- drivers/video/rockchip/mpp/mpp_rkvenc.c | 18 +++++++++++++----- drivers/video/rockchip/mpp/mpp_service.c | 19 +++++++++++++------ drivers/video/rockchip/mpp/mpp_vdpu1.c | 18 +++++++++++++----- drivers/video/rockchip/mpp/mpp_vdpu2.c | 17 +++++++++++++---- drivers/video/rockchip/mpp/mpp_vepu1.c | 17 +++++++++++++---- drivers/video/rockchip/mpp/mpp_vepu2.c | 17 +++++++++++++---- 8 files changed, 104 insertions(+), 36 deletions(-) diff --git a/drivers/video/rockchip/mpp/mpp_iep2.c b/drivers/video/rockchip/mpp/mpp_iep2.c index f511793472d8..e79e52f5b330 100644 --- a/drivers/video/rockchip/mpp/mpp_iep2.c +++ b/drivers/video/rockchip/mpp/mpp_iep2.c @@ -759,13 +759,13 @@ static int iep2_free_task(struct mpp_session *session, return 0; } +#ifdef CONFIG_DEBUG_FS static int iep2_debugfs_remove(struct mpp_dev *mpp) { -#ifdef CONFIG_DEBUG_FS struct iep2_dev *iep = to_iep2_dev(mpp); debugfs_remove_recursive(iep->debugfs); -#endif + return 0; } @@ -775,7 +775,6 @@ static int iep2_debugfs_init(struct mpp_dev *mpp) iep->aclk_debug = 0; iep->session_max_buffers_debug = 0; -#ifdef CONFIG_DEBUG_FS iep->debugfs = debugfs_create_dir(mpp->dev->of_node->name, mpp->srv->debugfs); if (IS_ERR_OR_NULL(iep->debugfs)) { @@ -787,11 +786,21 @@ static int iep2_debugfs_init(struct mpp_dev *mpp) iep->debugfs, &iep->aclk_debug); debugfs_create_u32("session_buffers", 0644, iep->debugfs, &iep->session_max_buffers_debug); -#endif if (iep->session_max_buffers_debug) mpp->session_max_buffers = iep->session_max_buffers_debug; return 0; } +#else +static inline int iep2_debugfs_remove(struct mpp_dev *mpp) +{ + return 0; +} + +static inline int iep2_debugfs_init(struct mpp_dev *mpp) +{ + return 0; +} +#endif #define IEP2_TILE_W_MAX 120 #define IEP2_TILE_H_MAX 272 diff --git a/drivers/video/rockchip/mpp/mpp_rkvdec.c b/drivers/video/rockchip/mpp/mpp_rkvdec.c index 8f7ffb7b2b3e..3e8f9f3de048 100644 --- a/drivers/video/rockchip/mpp/mpp_rkvdec.c +++ b/drivers/video/rockchip/mpp/mpp_rkvdec.c @@ -1106,13 +1106,13 @@ static int rkvdec_free_task(struct mpp_session *session, return 0; } +#ifdef CONFIG_DEBUG_FS static int rkvdec_debugfs_remove(struct mpp_dev *mpp) { -#ifdef CONFIG_DEBUG_FS struct rkvdec_dev *dec = to_rkvdec_dev(mpp); debugfs_remove_recursive(dec->debugfs); -#endif + return 0; } @@ -1125,7 +1125,6 @@ static int rkvdec_debugfs_init(struct mpp_dev *mpp) dec->clk_cabac_debug = 0; dec->clk_hevc_cabac_debug = 0; dec->session_max_buffers_debug = 0; -#ifdef CONFIG_DEBUG_FS dec->debugfs = debugfs_create_dir(mpp->dev->of_node->name, mpp->srv->debugfs); if (IS_ERR_OR_NULL(dec->debugfs)) { @@ -1143,12 +1142,22 @@ static int rkvdec_debugfs_init(struct mpp_dev *mpp) dec->debugfs, &dec->clk_hevc_cabac_debug); debugfs_create_u32("session_buffers", 0644, dec->debugfs, &dec->session_max_buffers_debug); -#endif if (dec->session_max_buffers_debug) mpp->session_max_buffers = dec->session_max_buffers_debug; return 0; } +#else +static inline int rkvdec_debugfs_remove(struct mpp_dev *mpp) +{ + return 0; +} + +static inline int rkvdec_debugfs_init(struct mpp_dev *mpp) +{ + return 0; +} +#endif static int rkvdec_init(struct mpp_dev *mpp) { diff --git a/drivers/video/rockchip/mpp/mpp_rkvenc.c b/drivers/video/rockchip/mpp/mpp_rkvenc.c index cba28de65f23..3f37f5dc3d08 100644 --- a/drivers/video/rockchip/mpp/mpp_rkvenc.c +++ b/drivers/video/rockchip/mpp/mpp_rkvenc.c @@ -589,13 +589,13 @@ static int rkvenc_free_task(struct mpp_session *session, return 0; } +#ifdef CONFIG_DEBUG_FS static int rkvenc_debugfs_remove(struct mpp_dev *mpp) { -#ifdef CONFIG_DEBUG_FS struct rkvenc_dev *enc = to_rkvenc_dev(mpp); debugfs_remove_recursive(enc->debugfs); -#endif + return 0; } @@ -606,7 +606,6 @@ static int rkvenc_debugfs_init(struct mpp_dev *mpp) enc->aclk_debug_mhz = 0; enc->clk_core_debug_mhz = 0; enc->session_max_buffers_debug = 0; -#ifdef CONFIG_DEBUG_FS enc->debugfs = debugfs_create_dir(mpp->dev->of_node->name, mpp->srv->debugfs); if (IS_ERR_OR_NULL(enc->debugfs)) { @@ -620,12 +619,22 @@ static int rkvenc_debugfs_init(struct mpp_dev *mpp) enc->debugfs, &enc->clk_core_debug_mhz); debugfs_create_u32("session_buffers", 0644, enc->debugfs, &enc->session_max_buffers_debug); -#endif if (enc->session_max_buffers_debug) mpp->session_max_buffers = enc->session_max_buffers_debug; return 0; } +#else +static inline int rkvenc_debugfs_remove(struct mpp_dev *mpp) +{ + return 0; +} + +static inline int rkvenc_debugfs_init(struct mpp_dev *mpp) +{ + return 0; +} +#endif #ifdef CONFIG_PM_DEVFREQ static int rkvenc_devfreq_target(struct device *dev, @@ -1093,7 +1102,6 @@ static int rkvenc_probe(struct platform_device *pdev) mpp->session_max_buffers = RKVENC_SESSION_MAX_BUFFERS; rkvenc_debugfs_init(mpp); - dev_info(dev, "probing finish\n"); return 0; diff --git a/drivers/video/rockchip/mpp/mpp_service.c b/drivers/video/rockchip/mpp/mpp_service.c index 868c8b40bc9f..3add901e6cba 100644 --- a/drivers/video/rockchip/mpp/mpp_service.c +++ b/drivers/video/rockchip/mpp/mpp_service.c @@ -115,26 +115,35 @@ static int mpp_remove_service(struct mpp_service *srv) return 0; } +#ifdef CONFIG_DEBUG_FS static int mpp_debugfs_remove(struct mpp_service *srv) { -#ifdef CONFIG_DEBUG_FS debugfs_remove_recursive(srv->debugfs); -#endif + return 0; } static int mpp_debugfs_init(struct mpp_service *srv) { -#ifdef CONFIG_DEBUG_FS srv->debugfs = debugfs_create_dir(MPP_SERVICE_NAME, NULL); if (IS_ERR_OR_NULL(srv->debugfs)) { mpp_err("failed on open debugfs\n"); srv->debugfs = NULL; } -#endif return 0; } +#else +static inline int mpp_debugfs_remove(struct mpp_service *srv) +{ + return 0; +} + +static inline int mpp_debugfs_init(struct mpp_service *srv) +{ + return 0; +} +#endif static int mpp_service_probe(struct platform_device *pdev) { @@ -215,9 +224,7 @@ static int mpp_service_probe(struct platform_device *pdev) goto fail_register; } mpp_sub_drivers = srv->sub_drivers; - mpp_debugfs_init(srv); - dev_info(dev, "probe success\n"); return 0; diff --git a/drivers/video/rockchip/mpp/mpp_vdpu1.c b/drivers/video/rockchip/mpp/mpp_vdpu1.c index c7fdbe368dfe..3b56301577cf 100644 --- a/drivers/video/rockchip/mpp/mpp_vdpu1.c +++ b/drivers/video/rockchip/mpp/mpp_vdpu1.c @@ -490,13 +490,13 @@ static int vdpu_free_task(struct mpp_session *session, return 0; } +#ifdef CONFIG_DEBUG_FS static int vdpu_debugfs_remove(struct mpp_dev *mpp) { -#ifdef CONFIG_DEBUG_FS struct vdpu_dev *dec = to_vdpu_dev(mpp); debugfs_remove_recursive(dec->debugfs); -#endif + return 0; } @@ -506,8 +506,6 @@ static int vdpu_debugfs_init(struct mpp_dev *mpp) dec->aclk_debug = 0; dec->session_max_buffers_debug = 0; - -#ifdef CONFIG_DEBUG_FS dec->debugfs = debugfs_create_dir(mpp->dev->of_node->name, mpp->srv->debugfs); if (IS_ERR_OR_NULL(dec->debugfs)) { @@ -519,12 +517,22 @@ static int vdpu_debugfs_init(struct mpp_dev *mpp) dec->debugfs, &dec->aclk_debug); debugfs_create_u32("session_buffers", 0644, dec->debugfs, &dec->session_max_buffers_debug); -#endif if (dec->session_max_buffers_debug) mpp->session_max_buffers = dec->session_max_buffers_debug; return 0; } +#else +static inline int vdpu_debugfs_remove(struct mpp_dev *mpp) +{ + return 0; +} + +static inline int vdpu_debugfs_init(struct mpp_dev *mpp) +{ + return 0; +} +#endif static int vdpu_init(struct mpp_dev *mpp) { diff --git a/drivers/video/rockchip/mpp/mpp_vdpu2.c b/drivers/video/rockchip/mpp/mpp_vdpu2.c index c5b6f31cb23e..197349778062 100644 --- a/drivers/video/rockchip/mpp/mpp_vdpu2.c +++ b/drivers/video/rockchip/mpp/mpp_vdpu2.c @@ -442,13 +442,13 @@ static int vdpu_free_task(struct mpp_session *session, return 0; } +#ifdef CONFIG_DEBUG_FS static int vdpu_debugfs_remove(struct mpp_dev *mpp) { -#ifdef CONFIG_DEBUG_FS struct vdpu_dev *dec = to_vdpu_dev(mpp); debugfs_remove_recursive(dec->debugfs); -#endif + return 0; } @@ -458,7 +458,6 @@ static int vdpu_debugfs_init(struct mpp_dev *mpp) dec->aclk_debug = 0; dec->session_max_buffers_debug = 0; -#ifdef CONFIG_DEBUG_FS dec->debugfs = debugfs_create_dir(mpp->dev->of_node->name, mpp->srv->debugfs); if (IS_ERR_OR_NULL(dec->debugfs)) { @@ -470,12 +469,22 @@ static int vdpu_debugfs_init(struct mpp_dev *mpp) dec->debugfs, &dec->aclk_debug); debugfs_create_u32("session_buffers", 0644, dec->debugfs, &dec->session_max_buffers_debug); -#endif if (dec->session_max_buffers_debug) mpp->session_max_buffers = dec->session_max_buffers_debug; return 0; } +#else +static inline int vdpu_debugfs_remove(struct mpp_dev *mpp) +{ + return 0; +} + +static inline int vdpu_debugfs_init(struct mpp_dev *mpp) +{ + return 0; +} +#endif static int vdpu_init(struct mpp_dev *mpp) { diff --git a/drivers/video/rockchip/mpp/mpp_vepu1.c b/drivers/video/rockchip/mpp/mpp_vepu1.c index 6d0bb2843868..b4286386d2bc 100644 --- a/drivers/video/rockchip/mpp/mpp_vepu1.c +++ b/drivers/video/rockchip/mpp/mpp_vepu1.c @@ -396,13 +396,13 @@ static int vepu_free_task(struct mpp_session *session, return 0; } +#ifdef CONFIG_DEBUG_FS static int vepu_debugfs_remove(struct mpp_dev *mpp) { -#ifdef CONFIG_DEBUG_FS struct vepu_dev *enc = to_vepu_dev(mpp); debugfs_remove_recursive(enc->debugfs); -#endif + return 0; } @@ -412,7 +412,6 @@ static int vepu_debugfs_init(struct mpp_dev *mpp) enc->aclk_debug = 0; enc->session_max_buffers_debug = 0; -#ifdef CONFIG_DEBUG_FS enc->debugfs = debugfs_create_dir(mpp->dev->of_node->name, mpp->srv->debugfs); if (IS_ERR_OR_NULL(enc->debugfs)) { @@ -424,12 +423,22 @@ static int vepu_debugfs_init(struct mpp_dev *mpp) enc->debugfs, &enc->aclk_debug); debugfs_create_u32("session_buffers", 0644, enc->debugfs, &enc->session_max_buffers_debug); -#endif if (enc->session_max_buffers_debug) mpp->session_max_buffers = enc->session_max_buffers_debug; return 0; } +#else +static inline int vepu_debugfs_remove(struct mpp_dev *mpp) +{ + return 0; +} + +static inline int vepu_debugfs_init(struct mpp_dev *mpp) +{ + return 0; +} +#endif static int vepu_init(struct mpp_dev *mpp) { diff --git a/drivers/video/rockchip/mpp/mpp_vepu2.c b/drivers/video/rockchip/mpp/mpp_vepu2.c index fc4f305a1ae6..519d00c50a5d 100644 --- a/drivers/video/rockchip/mpp/mpp_vepu2.c +++ b/drivers/video/rockchip/mpp/mpp_vepu2.c @@ -407,13 +407,13 @@ static int vepu_free_task(struct mpp_session *session, return 0; } +#ifdef CONFIG_DEBUG_FS static int vepu_debugfs_remove(struct mpp_dev *mpp) { -#ifdef CONFIG_DEBUG_FS struct vepu_dev *enc = to_vepu_dev(mpp); debugfs_remove_recursive(enc->debugfs); -#endif + return 0; } @@ -423,7 +423,6 @@ static int vepu_debugfs_init(struct mpp_dev *mpp) enc->aclk_debug = 0; enc->session_max_buffers_debug = 0; -#ifdef CONFIG_DEBUG_FS enc->debugfs = debugfs_create_dir(mpp->dev->of_node->name, mpp->srv->debugfs); if (IS_ERR_OR_NULL(enc->debugfs)) { @@ -435,11 +434,21 @@ static int vepu_debugfs_init(struct mpp_dev *mpp) enc->debugfs, &enc->aclk_debug); debugfs_create_u32("session_buffers", 0644, enc->debugfs, &enc->session_max_buffers_debug); -#endif if (enc->session_max_buffers_debug) mpp->session_max_buffers = enc->session_max_buffers_debug; return 0; } +#else +static inline int vepu_debugfs_remove(struct mpp_dev *mpp) +{ + return 0; +} + +static inline int vepu_debugfs_init(struct mpp_dev *mpp) +{ + return 0; +} +#endif static int vepu_init(struct mpp_dev *mpp) {