mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Guangshuo Li <lgs201920130244@gmail.com>,
	Minghsiu Tsai	 <minghsiu.tsai@mediatek.com>,
	Houlong Wei <houlong.wei@mediatek.com>,
	 Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Matthias Brugger	 <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno	
	<angelogioacchino.delregno@collabora.com>,
	Tiffany Lin	 <tiffany.lin@mediatek.com>,
	Yunfei Dong <yunfei.dong@mediatek.com>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	Chen-Yu Tsai <wenst@chromium.org>, Fei Shao	 <fshao@chromium.org>,
	Tomasz Figa <tfiga@chromium.org>,
	Haoxiang Li	 <haoxiang_li2024@163.com>,
	Eizan Miyamoto <eizan@chromium.org>,
	Enric Balletbo i Serra <eballetbo@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
		linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v2 1/3] media: mediatek: vpu: add watchdog handler unregister helper
Date: Thu, 19 Nov 2026 12:09:45 -0500	[thread overview]
Message-ID: <7af073fd2a783c58543ff89103b49c0fd139b8c9.camel@collabora.com> (raw)
In-Reply-To: <20260720085756.465667-2-lgs201920130244@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2568 bytes --]

Hi,

Le lundi 20 juillet 2026 à 16:57 +0800, Guangshuo Li a écrit :
> VPU clients register watchdog reset handlers with private data owned by
> the client device. The VPU driver currently provides no way to clear a
> handler when client initialization fails or when the client device is
> removed.
> 
> Add vpu_wdt_unreg_handler() to clear the reset callback and its private
> data while holding the VPU mutex. This allows clients to remove stale
> watchdog entries before releasing their device references.
> 
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
>  drivers/media/platform/mediatek/vpu/mtk_vpu.c | 14 ++++++++++++++
>  drivers/media/platform/mediatek/vpu/mtk_vpu.h |  2 ++
>  2 files changed, 16 insertions(+)
> 
> diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.c b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
> index 8d8319f0cd22..a2b937095248 100644
> --- a/drivers/media/platform/mediatek/vpu/mtk_vpu.c
> +++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.c
> @@ -437,6 +437,20 @@ int vpu_wdt_reg_handler(struct platform_device *pdev,
>  }
>  EXPORT_SYMBOL_GPL(vpu_wdt_reg_handler);
>  
> +void vpu_wdt_unreg_handler(struct platform_device *pdev, enum rst_id id)
> +{
> +	struct mtk_vpu *vpu = platform_get_drvdata(pdev);
> +
> +	if (!vpu || id >= VPU_RST_MAX)
> +		return;
> +
> +	mutex_lock(&vpu->vpu_mutex);
> +	vpu->wdt.handler[id].reset_func = NULL;
> +	vpu->wdt.handler[id].priv = NULL;
> +	mutex_unlock(&vpu->vpu_mutex);

I just read sashiko report, and I tend to agree that this fix is incomplete. I
think though you that you can just extend the critical section in
vpu_wdt_reset_func(). Add comment that vpu_mutex is helpd when reset_func is
called, might spare someone a headache.

Nicolas

> +}
> +EXPORT_SYMBOL_GPL(vpu_wdt_unreg_handler);
> +
>  unsigned int vpu_get_vdec_hw_capa(struct platform_device *pdev)
>  {
>  	struct mtk_vpu *vpu = platform_get_drvdata(pdev);
> diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.h b/drivers/media/platform/mediatek/vpu/mtk_vpu.h
> index 3951547e9ec5..2ccb481a04cf 100644
> --- a/drivers/media/platform/mediatek/vpu/mtk_vpu.h
> +++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.h
> @@ -141,6 +141,8 @@ int vpu_wdt_reg_handler(struct platform_device *pdev,
>  			void vpu_wdt_reset_func(void *priv),
>  			void *priv, enum rst_id id);
>  
> +void vpu_wdt_unreg_handler(struct platform_device *pdev, enum rst_id id);
> +
>  /**
>   * vpu_get_vdec_hw_capa - get video decoder hardware capability
>   *

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-11-19 17:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20  8:57 [PATCH v2 0/3] media: mediatek: unregister VPU watchdog handlers Guangshuo Li
2026-07-20  8:57 ` [PATCH v2 1/3] media: mediatek: vpu: add watchdog handler unregister helper Guangshuo Li
2026-11-19 17:09   ` Nicolas Dufresne [this message]
2026-07-20  8:57 ` [PATCH v2 2/3] media: mediatek: vcodec: unregister VPU watchdog handler Guangshuo Li
2026-07-20  8:57 ` [PATCH v2 3/3] media: mtk-mdp: " Guangshuo Li

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=7af073fd2a783c58543ff89103b49c0fd139b8c9.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=andrew-ct.chen@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=eballetbo@kernel.org \
    --cc=eizan@chromium.org \
    --cc=fshao@chromium.org \
    --cc=haoxiang_li2024@163.com \
    --cc=houlong.wei@mediatek.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=lgs201920130244@gmail.com \
    --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=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=minghsiu.tsai@mediatek.com \
    --cc=tfiga@chromium.org \
    --cc=tiffany.lin@mediatek.com \
    --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

all inboxes | Powered by JetHome®