From: Myeonghun Pak <mhun512@gmail.com>
To: Dipen Patel <dipenp@nvidia.com>
Cc: Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
timestamp@lists.linux.dev, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Ijae Kim <ae878000@gmail.com>
Subject: [PATCH] hte: tegra194: stop IRQ before releasing provider state
Date: Sat, 3 Oct 2026 23:39:35 -0400 [thread overview]
Message-ID: <20261004033935.1114168-1-mhun512@gmail.com> (raw)
Devres unregisters the HTE chip before releasing the IRQ. Disabling
the controller does not wait for an already running FIFO handler,
which can still call hte_push_ts_ns() after chip->gdev has been freed.
Request the IRQ with IRQF_NO_AUTOEN after initializing its dependencies
and enable it after chip registration. Add managed actions to stop the
controller and disable and synchronize the IRQ before unregistering
the chip.
This builds on the linked slice-lock fix in the HTE maintainer tree.
The IRQ lifetime issue was found by static analysis.
Fixes: 09574cca6ad6 ("hte: Add Tegra194 HTE kernel provider")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20260830161747.2719220-1-runyu.xiao@seu.edu.cn/
Assisted-by: LLM
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
Based on HTE for-next at 30167fadbf87. This IRQ-only patch requires
the slice-lock initialization fix:
1329abe1bae4 ("hte: tegra194: Initialize slice locks before registering chip")
already applied to the HTE maintainer for-next tree. The same
prerequisite is required when backporting onto older trees. The
diff also preserves the earlier IRQ logging cleanup c21530a75b95;
older trees without that cleanup need its context applied/adapted.
drivers/hte/hte-tegra194.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/drivers/hte/hte-tegra194.c b/drivers/hte/hte-tegra194.c
index 189f7fcffbe2..9fb16b6be231 100644
--- a/drivers/hte/hte-tegra194.c
+++ b/drivers/hte/hte-tegra194.c
@@ -799,6 +799,13 @@ static void tegra_gte_disable(void *data)
tegra_hte_writel(gs, HTE_TECTRL, 0);
}
+static void tegra_hte_disable_irq(void *data)
+{
+ struct tegra_hte_soc *gs = data;
+
+ disable_irq(gs->hte_irq);
+}
+
static void tegra_hte_put_gpio_device(void *data)
{
struct gpio_device *gdev = data;
@@ -854,10 +861,6 @@ static int tegra_hte_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
hte_dev->hte_irq = ret;
- ret = devm_request_irq(dev, hte_dev->hte_irq, tegra_hte_isr, 0,
- dev_name(dev), hte_dev);
- if (ret < 0)
- return ret;
gc->nlines = nlines;
gc->ops = &g_ops;
@@ -913,21 +916,33 @@ static int tegra_hte_probe(struct platform_device *pdev)
spin_lock_init(&hte_dev->sl[i].s_lock);
}
+ tegra_hte_writel(hte_dev, HTE_TECTRL, 0);
+
+ ret = devm_request_irq(dev, hte_dev->hte_irq, tegra_hte_isr,
+ IRQF_NO_AUTOEN, dev_name(dev), hte_dev);
+ if (ret < 0)
+ return ret;
+
ret = devm_hte_register_chip(hte_dev->chip);
if (ret) {
dev_err(gc->dev, "hte chip register failed");
return ret;
}
+ enable_irq(hte_dev->hte_irq);
+ ret = devm_add_action_or_reset(dev, tegra_hte_disable_irq, hte_dev);
+ if (ret)
+ return ret;
+
+ ret = devm_add_action_or_reset(dev, tegra_gte_disable, pdev);
+ if (ret)
+ return ret;
+
val = HTE_TECTRL_ENABLE_ENABLE |
(HTE_TECTRL_INTR_ENABLE << HTE_TECTRL_INTR_SHIFT) |
(hte_dev->itr_thrshld << HTE_TECTRL_OCCU_SHIFT);
tegra_hte_writel(hte_dev, HTE_TECTRL, val);
- ret = devm_add_action_or_reset(&pdev->dev, tegra_gte_disable, pdev);
- if (ret)
- return ret;
-
dev_dbg(gc->dev, "lines: %d, slices:%d", gc->nlines, slices);
return 0;
reply other threads:[~2026-10-04 3:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261004033935.1114168-1-mhun512@gmail.com \
--to=mhun512@gmail.com \
--cc=ae878000@gmail.com \
--cc=dipenp@nvidia.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=thierry.reding@kernel.org \
--cc=timestamp@lists.linux.dev \
/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®