From: Keke Li <keke.li@amlogic.com>
To: Runyu Xiao <runyu.xiao@seu.edu.cn>
Cc: mchehab@kernel.org, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org, jianhao.xu@seu.edu.cn,
stable@vger.kernel.org
Subject: Re: [PATCH] media: platform: c3-isp: Register IRQ after video state init
Date: Mon, 31 Aug 2026 10:17:14 +0800 [thread overview]
Message-ID: <09dd4fb7-ec95-440f-9d6f-74ead72cde4f@amlogic.com> (raw)
In-Reply-To: <20260830143945.2700038-1-runyu.xiao@seu.edu.cn>
hi runyu
Thanks for your patch.
On 8/30/26 22:39, Runyu Xiao wrote:
> [You don't often get email from runyu.xiao@seu.edu.cn. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> [ EXTERNAL EMAIL ]
>
> c3_isp_probe() requests the shared IRQ before
> c3_isp_videos_register() initializes the capture, statistics, and
> parameter state used by the IRQ handler. request_irq() permits the
> handler to run as soon as registration completes, so a frame-end
> interrupt can acquire an uninitialized buffer lock.
>
> Register the video state before requesting the IRQ and free the managed
> IRQ before tearing that state down. Store the IRQ number for the remove
> path and preserve the existing probe error unwinding.
>
> Fixes: fb2e135208f3 ("media: platform: Add C3 ISP driver")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:GPT-5
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
> ---
> .../media/platform/amlogic/c3/isp/c3-isp-common.h | 2 ++
> drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c | 14 +++++++++-----
> 2 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/platform/amlogic/c3/isp/c3-isp-common.h b/drivers/media/platform/amlogic/c3/isp/c3-isp-common.h
> index cb470802e..56b7d48e1 100644
> --- a/drivers/media/platform/amlogic/c3/isp/c3-isp-common.h
> +++ b/drivers/media/platform/amlogic/c3/isp/c3-isp-common.h
> @@ -293,6 +293,7 @@ struct c3_isp_info {
> * @stats: ISP stats device
> * @params: ISP params device
> * @caps: array of ISP capture device
> + * @irq: ISP interrupt number
> * @frm_sequence: used to record frame id
> * @info: version-specific ISP information
> */
> @@ -312,6 +313,7 @@ struct c3_isp_device {
> struct c3_isp_params params;
> struct c3_isp_capture caps[C3_ISP_NUM_CAP_DEVS];
>
> + int irq;
> u32 frm_sequence;
> const struct c3_isp_info *info;
> };
> diff --git a/drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c b/drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c
> index c3b779f63..66242544e 100644
> --- a/drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c
> +++ b/drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c
> @@ -330,6 +330,7 @@ static int c3_isp_probe(struct platform_device *pdev)
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> return irq;
> + isp->irq = irq;
>
> ret = c3_isp_get_clocks(isp);
> if (ret)
> @@ -355,18 +356,20 @@ static int c3_isp_probe(struct platform_device *pdev)
> if (ret)
> goto err_resizers_unregister;
>
> - ret = devm_request_irq(dev, irq,
> - c3_isp_irq_handler, IRQF_SHARED,
> - dev_driver_string(dev), isp);
> + ret = c3_isp_videos_register(isp);
> if (ret)
> goto err_nf_unregister;
>
> - ret = c3_isp_videos_register(isp);
> + ret = devm_request_irq(dev, irq,
> + c3_isp_irq_handler, IRQF_SHARED,
> + dev_driver_string(dev), isp);
> if (ret)
> - goto err_nf_unregister;
> + goto err_videos_unregister;
>
> return 0;
>
> +err_videos_unregister:
> + c3_isp_videos_unregister(isp);
> err_nf_unregister:
> c3_isp_async_nf_unregister(isp);
> err_resizers_unregister:
> @@ -384,6 +387,7 @@ static void c3_isp_remove(struct platform_device *pdev)
> {
> struct c3_isp_device *isp = platform_get_drvdata(pdev);
>
> + devm_free_irq(isp->dev, isp->irq, isp);
Explicitly calling devm_free_irq is unnecessary when using
devm_request_irq.
Thanks!
> c3_isp_videos_unregister(isp);
> c3_isp_async_nf_unregister(isp);
> c3_isp_core_unregister(isp);
> --
> 2.34.1
next prev parent reply other threads:[~2026-08-31 2:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 14:39 Runyu Xiao
2026-08-31 2:17 ` Keke Li [this message]
2026-08-31 2:44 ` Keke Li
2026-08-31 11:38 ` Runyu Xiao
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=09dd4fb7-ec95-440f-9d6f-74ead72cde4f@amlogic.com \
--to=keke.li@amlogic.com \
--cc=jianhao.xu@seu.edu.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=runyu.xiao@seu.edu.cn \
--cc=stable@vger.kernel.org \
/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®