[PATCH v7,06/11] media: mediatek: vcodec: replace pr_* with dev_* for v4l2 debug message
Hans Verkuil
hverkuil-cisco at xs4all.nl
Tue Jul 25 02:37:21 PDT 2023
On 22/07/2023 09:42, Yunfei Dong wrote:
> Adding different macro mtk_v4l2_vdec_dbg and mtk_v4l2_venc_dbg for
> encoder and decoder. Then calling the common macro mtk_v4l2_debug to
> print debug message.
>
> Replace pr_err with dev_err for 'mtk_v4l2_err' debug message.
> Replace pr_debug with dev_dbg for 'mtk_v4l2_debug' debug message.
>
> Signed-off-by: Yunfei Dong <yunfei.dong at mediatek.com>
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
> ---
> .../platform/mediatek/vcodec/mtk_vcodec_dec.c | 116 +++++-----
> .../mediatek/vcodec/mtk_vcodec_dec_drv.c | 54 +++--
> .../mediatek/vcodec/mtk_vcodec_dec_hw.c | 7 +-
> .../mediatek/vcodec/mtk_vcodec_dec_pm.c | 19 +-
> .../mediatek/vcodec/mtk_vcodec_dec_stateful.c | 143 ++++++------
> .../vcodec/mtk_vcodec_dec_stateless.c | 62 ++---
> .../platform/mediatek/vcodec/mtk_vcodec_enc.c | 211 ++++++++----------
> .../mediatek/vcodec/mtk_vcodec_enc_drv.c | 45 ++--
> .../mediatek/vcodec/mtk_vcodec_enc_pm.c | 8 +-
> .../platform/mediatek/vcodec/mtk_vcodec_fw.c | 2 +-
> .../mediatek/vcodec/mtk_vcodec_fw_scp.c | 2 +-
> .../mediatek/vcodec/mtk_vcodec_fw_vpu.c | 7 +-
> .../mediatek/vcodec/mtk_vcodec_intr.c | 12 +-
> .../mediatek/vcodec/mtk_vcodec_util.c | 30 ++-
> .../mediatek/vcodec/mtk_vcodec_util.h | 27 ++-
> .../vcodec/vdec/vdec_av1_req_lat_if.c | 10 +-
> .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 14 +-
> .../vcodec/vdec/vdec_h264_req_multi_if.c | 16 +-
> .../vcodec/vdec/vdec_hevc_req_multi_if.c | 14 +-
> .../platform/mediatek/vcodec/vdec_drv_if.c | 4 +-
> .../platform/mediatek/vcodec/vdec_msg_queue.c | 52 +++--
> .../platform/mediatek/vcodec/vdec_msg_queue.h | 2 +
> .../platform/mediatek/vcodec/vdec_vpu_if.c | 2 +-
> 23 files changed, 417 insertions(+), 442 deletions(-)
>
<snip>
> diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h
> index fd951ff47fc3..6bc822c7d825 100644
> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h
> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h
> @@ -11,6 +11,9 @@
> #include <linux/types.h>
> #include <linux/dma-direction.h>
>
> +#define MTK_DBG_VCODEC_STR "[MTK_VCODEC]"
> +#define MTK_DBG_V4L2_STR "[MTK_V4L2]"
> +
> struct mtk_vcodec_mem {
> size_t size;
> void *va;
> @@ -28,8 +31,8 @@ struct mtk_vcodec_dev;
> #undef pr_fmt
> #define pr_fmt(fmt) "%s(),%d: " fmt, __func__, __LINE__
>
> -#define mtk_v4l2_err(fmt, args...) \
> - pr_err("[MTK_V4L2][ERROR] " fmt "\n", ##args)
> +#define mtk_v4l2_err(plat_dev, fmt, args...) \
> + dev_err(&(plat_dev)->dev, "[MTK_V4L2][ERROR] " fmt "\n", ##args)
>
> #define mtk_vcodec_err(inst_id, plat_dev, fmt, args...) \
> dev_err(&(plat_dev)->dev, "[MTK_VCODEC][ERROR][%d]: " fmt "\n", inst_id, ##args)
> @@ -38,11 +41,11 @@ struct mtk_vcodec_dev;
> extern int mtk_v4l2_dbg_level;
> extern int mtk_vcodec_dbg;
>
> -#define mtk_v4l2_debug(level, fmt, args...) \
> - do { \
> - if (mtk_v4l2_dbg_level >= (level)) \
> - pr_debug("[MTK_V4L2] %s, %d: " fmt "\n", \
> - __func__, __LINE__, ##args); \
> +#define mtk_v4l2_debug(plat_dev, level, fmt, args...) \
> + do { \
> + if (mtk_v4l2_dbg_level >= (level)) \
> + dev_dbg(&(plat_dev)->dev, "[MTK_V4L2] %s, %d: " fmt "\n", \
> + __func__, __LINE__, ##args); \
> } while (0)
You forgot to add 'plat_dev' to the argument list of the mtk_v4l2_debug
macro when CONFIG_DEBUG_FS is not set. That causes zillions of compiler
warnings.
>
> #define mtk_vcodec_debug(inst_id, plat_dev, fmt, args...) \
> @@ -70,6 +73,16 @@ extern int mtk_vcodec_dbg;
> #define mtk_venc_debug(ctx, fmt, args...) \
> mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
>
> +#define mtk_v4l2_vdec_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args)
> +
> +#define mtk_v4l2_vdec_dbg(level, ctx, fmt, args...) \
> + mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args)
> +
> +#define mtk_v4l2_venc_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args)
> +
> +#define mtk_v4l2_venc_dbg(level, ctx, fmt, args...) \
> + mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args)
> +
> void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base, unsigned int reg_idx);
> int mtk_vcodec_write_vdecsys(struct mtk_vcodec_ctx *ctx, unsigned int reg, unsigned int val);
> int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem);
Regards,
Hans
More information about the linux-arm-kernel
mailing list