spi: tegra210-quad: Return IRQ_HANDLED when timeout already processed transfer

When the ISR thread wakes up late and finds that the timeout handler
has already processed the transfer (curr_xfer is NULL), return
IRQ_HANDLED instead of IRQ_NONE.

Use a similar approach to tegra_qspi_handle_timeout() by reading
QSPI_TRANS_STATUS and checking the QSPI_RDY bit to determine if the
hardware actually completed the transfer. If QSPI_RDY is set, the
interrupt was legitimate and triggered by real hardware activity.
The fact that the timeout path handled it first doesn't make it
spurious. Returning IRQ_NONE incorrectly suggests the interrupt
wasn't for this device, which can cause issues with shared interrupt
lines and interrupt accounting.

Fixes: b4e002d8a7ce ("spi: tegra210-quad: Fix timeout handling")
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Usama Arif <usamaarif642@gmail.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/20260126-tegra_xfer-v2-1-6d2115e4f387@debian.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by Breno Leitao and committed by Mark Brown aabd8ea0 63804fed

+17 -2
+17 -2
drivers/spi/spi-tegra210-quad.c
··· 1552 1552 static irqreturn_t tegra_qspi_isr_thread(int irq, void *context_data) 1553 1553 { 1554 1554 struct tegra_qspi *tqspi = context_data; 1555 + u32 status; 1556 + 1557 + /* 1558 + * Read transfer status to check if interrupt was triggered by transfer 1559 + * completion 1560 + */ 1561 + status = tegra_qspi_readl(tqspi, QSPI_TRANS_STATUS); 1555 1562 1556 1563 /* 1557 1564 * Occasionally the IRQ thread takes a long time to wake up (usually 1558 1565 * when the CPU that it's running on is excessively busy) and we have 1559 1566 * already reached the timeout before and cleaned up the timed out 1560 1567 * transfer. Avoid any processing in that case and bail out early. 1568 + * 1569 + * If no transfer is in progress, check if this was a real interrupt 1570 + * that the timeout handler already processed, or a spurious one. 1561 1571 */ 1562 - if (!tqspi->curr_xfer) 1563 - return IRQ_NONE; 1572 + if (!tqspi->curr_xfer) { 1573 + /* Spurious interrupt - transfer not ready */ 1574 + if (!(status & QSPI_RDY)) 1575 + return IRQ_NONE; 1576 + /* Real interrupt, already handled by timeout path */ 1577 + return IRQ_HANDLED; 1578 + } 1564 1579 1565 1580 tqspi->status_reg = tegra_qspi_readl(tqspi, QSPI_FIFO_STATUS); 1566 1581