From: Myeonghun Pak <mhun512@gmail.com>
To: Eddie James <eajames@linux.ibm.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Jammy Huang <jammy_huang@aspeedtech.com>,
Joel Stanley <joel@jms.id.au>,
Andrew Jeffery <andrew@codeconstruct.com.au>,
Ryan Chen <ryan_chen@aspeedtech.com>,
Billy Tsai <billy_tsai@aspeedtech.com>,
linux-media@vger.kernel.org, openbmc@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Ijae Kim <ae878000@gmail.com>
Subject: [PATCH v2 1/2] media: aspeed: join IRQ and work before probe cleanup
Date: Mon, 9 Nov 2026 23:58:08 -0500 [thread overview]
Message-ID: <20261109235731-aspeed-v2-1-mhun512@gmail.com> (raw)
In-Reply-To: <20261109235731-aspeed-v2-0-mhun512@gmail.com>
The setup failure path unprepares the clocks before devres frees the IRQ.
An IRQ handler that has sampled an enabled status can still queue
resolution work. Masking the source does not synchronize that handler.
Save the IRQ number after a successful request, then free the action and
drain resolution work before the manual JPEG and clock cleanup. Turn the
engine off after the work has finished. Request the IRQ after reset,
clock and JPEG initialization so earlier init failures have no live IRQ.
Fixes: 3536169f8531 ("media: aspeed: fix clock handling logic")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
No hardware testing.
With reset-default masking, no probe IRQ failure has been demonstrated;
this part hardens cleanup ordering.
Changes in v2:
- Join the IRQ and resolution work before manual probe-failure cleanup.
- Rebase onto managed reserved-memory initialization.
- Clean up JPEG and clocks if the late IRQ request fails.
- Split normal last-close ordering into patch 2.
drivers/media/platform/aspeed/aspeed-video.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/aspeed/aspeed-video.c b/drivers/media/platform/aspeed/aspeed-video.c
--- a/drivers/media/platform/aspeed/aspeed-video.c
+++ b/drivers/media/platform/aspeed/aspeed-video.c
@@ -308,6 +308,7 @@
* perf: holds the statistics primary for debugfs
*/
struct aspeed_video {
+ int irq;
void __iomem *base;
struct clk *eclk;
struct clk *vclk;
@@ -2232,14 +2233,6 @@
return -ENODEV;
}
- rc = devm_request_threaded_irq(dev, irq, NULL, aspeed_video_irq,
- IRQF_ONESHOT, DEVICE_NAME, video);
- if (rc < 0) {
- dev_err(dev, "Unable to request IRQ %d\n", irq);
- return rc;
- }
- dev_info(video->dev, "irq %d\n", irq);
-
video->reset = devm_reset_control_get(dev, NULL);
if (IS_ERR(video->reset)) {
dev_err(dev, "Unable to get reset\n");
@@ -2286,8 +2279,19 @@
aspeed_video_init_jpeg_table(video->jpeg.virt, video->yuv420);
+ rc = devm_request_threaded_irq(dev, irq, NULL, aspeed_video_irq,
+ IRQF_ONESHOT, DEVICE_NAME, video);
+ if (rc < 0) {
+ dev_err(dev, "Unable to request IRQ %d\n", irq);
+ goto err_free_jpeg;
+ }
+ video->irq = irq;
+ dev_info(video->dev, "irq %d\n", irq);
+
return 0;
+err_free_jpeg:
+ aspeed_video_free_buf(video, &video->jpeg);
err_unprepare_vclk:
clk_unprepare(video->vclk);
err_unprepare_eclk:
@@ -2341,6 +2345,10 @@
rc = aspeed_video_setup_video(video);
if (rc) {
+ set_bit(VIDEO_STOPPED, &video->flags);
+ devm_free_irq(video->dev, video->irq, video);
+ cancel_delayed_work_sync(&video->res_work);
+ aspeed_video_off(video);
aspeed_video_free_buf(video, &video->jpeg);
clk_unprepare(video->vclk);
clk_unprepare(video->eclk);
next prev parent reply other threads:[~2026-11-10 4:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 4:58 [PATCH v2 0/2] media: aspeed: order probe cleanup and last close Myeonghun Pak
2026-11-10 4:58 ` Myeonghun Pak [this message]
2026-11-10 4:58 ` [PATCH v2 2/2] media: aspeed: drain IRQ work before stopping the engine Myeonghun Pak
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=20261109235731-aspeed-v2-1-mhun512@gmail.com \
--to=mhun512@gmail.com \
--cc=ae878000@gmail.com \
--cc=andrew@codeconstruct.com.au \
--cc=billy_tsai@aspeedtech.com \
--cc=eajames@linux.ibm.com \
--cc=jammy_huang@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=ryan_chen@aspeedtech.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®