Linux Media Controller development
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: "Yunfei Dong" <yunfei.dong@mediatek.com>,
	"Chen-Yu Tsai" <wenst@chromium.org>,
	"Nicolas Dufresne" <nicolas.dufresne@collabora.com>,
	"Hans Verkuil" <hverkuil-cisco@xs4all.nl>,
	"Benjamin Gaignard" <benjamin.gaignard@collabora.com>,
	"Nícolas F . R . A . Prado" <nfraprado@collabora.com>,
	"Nathan Hebert" <nhebert@chromium.org>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>,
	Fritz Koenig <frkoenig@chromium.org>,
	Daniel Vetter <daniel@ffwll.ch>,
	Steve Cho <stevecho@chromium.org>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Project_Global_Chrome_Upstream_Group@mediatek.com
Subject: Re: [PATCH v5,8/8] media: mediatek: vcodec: Add dbgfs help function
Date: Tue, 30 May 2023 12:06:00 +0200	[thread overview]
Message-ID: <f3322e41-1891-a33b-daaa-731ec548ec4e@collabora.com> (raw)
In-Reply-To: <20230525021219.23638-9-yunfei.dong@mediatek.com>

Il 25/05/23 04:12, Yunfei Dong ha scritto:
> Getting dbgfs help information with command "echo -help > vdec".
> 
> Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> ---
>   .../mediatek/vcodec/mtk_vcodec_dbgfs.c        | 24 ++++++++++++++++++-
>   1 file changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c
> index 237d0dc8a1fc..2372fc449b45 100644
> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c
> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c
> @@ -52,6 +52,23 @@ static void mtk_vdec_dbgfs_get_format_type(struct mtk_vcodec_ctx *ctx, char *buf
>   	*used += curr_len;
>   }
>   
> +static void mtk_vdec_dbgfs_get_help(char *buf, int *used, int total)
> +{
> +	int curr_len;
> +
> +	curr_len = snprintf(buf + *used, total - *used,
> +			    "help: (1: echo -'info' > vdec 2: cat vdec)\n");
> +	*used += curr_len;
> +
> +	curr_len = snprintf(buf + *used, total - *used,
> +			    "\t-picinfo: get resolution\n");
> +	*used += curr_len;
> +
> +	curr_len = snprintf(buf + *used, total - *used,
> +			    "\t-format: get output & capture queue format\n");
> +	*used += curr_len;
> +}
> +
>   static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf,
>   				    size_t count, loff_t *ppos)
>   {
> @@ -84,6 +101,11 @@ static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf,
>   	if (!buf)
>   		return -ENOMEM;
>   
> +	if (strstr(dbgfs->dbgfs_buf, "-help")) {

I would print the help strings in two conditions:
1. -help
2. (nothing)

...so that if you don't echo anything to vdec (no params), you get the help text.
Otherwise, you would have to know that "-help" is a parameter that gives you help
text in the first place.

As for this commit "as is", it works as intended and it is useful to retrieve
the help text; you can either send a followup commit that extends the help to
the corner case that I've explained, or send a v6 adding that to this same commit.

I would prefer to see a v6 -- BUT -- since this series was sent a long time ago,
you will get my R-b and I will leave the final choice to Hans.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



  reply	other threads:[~2023-05-30 10:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25  2:12 [PATCH v5,0/8] media: mediatek: vcodec: Add debugfs file for decode and encode Yunfei Dong
2023-05-25  2:12 ` [PATCH v5,1/8] media: mediatek: vcodec: Add debugfs interface to get debug information Yunfei Dong
2023-05-25  2:12 ` [PATCH v5,2/8] media: mediatek: vcodec: Add debug params to control different log level Yunfei Dong
2023-05-25  2:12 ` [PATCH v5,3/8] media: mediatek: vcodec: Add a debugfs file to get different useful information Yunfei Dong
2023-05-30 10:05   ` AngeloGioacchino Del Regno
2023-05-25  2:12 ` [PATCH v5,4/8] media: mediatek: vcodec: Get each context resolution information Yunfei Dong
2023-05-30 10:05   ` AngeloGioacchino Del Regno
2023-05-25  2:12 ` [PATCH v5,5/8] media: mediatek: vcodec: Get each instance format type Yunfei Dong
2023-05-30 10:05   ` AngeloGioacchino Del Regno
2023-05-25  2:12 ` [PATCH v5,6/8] media: mediatek: vcodec: Change dbgfs interface to support encode Yunfei Dong
2023-05-25  2:12 ` [PATCH v5,7/8] media: mediatek: vcodec: Add encode to support dbgfs Yunfei Dong
2023-05-25  2:12 ` [PATCH v5,8/8] media: mediatek: vcodec: Add dbgfs help function Yunfei Dong
2023-05-30 10:06   ` AngeloGioacchino Del Regno [this message]
2023-05-30 10:15     ` Chen-Yu Tsai
2023-05-30 10:33     ` Hans Verkuil
2023-05-31 10:22       ` Yunfei Dong (董云飞)
2023-05-30  8:27 ` [PATCH v5,0/8] media: mediatek: vcodec: Add debugfs file for decode and encode Yunfei Dong (董云飞)
2023-05-30  8:55   ` Hans Verkuil
2023-05-30 10:13 ` Chen-Yu Tsai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f3322e41-1891-a33b-daaa-731ec548ec4e@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=frkoenig@chromium.org \
    --cc=hsinyi@chromium.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=nfraprado@collabora.com \
    --cc=nhebert@chromium.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=stevecho@chromium.org \
    --cc=wenst@chromium.org \
    --cc=yunfei.dong@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox