Re: [PATCH v2 2/2] serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC)

From: Andy Shevchenko
Date: Tue Feb 11 2025 - 04:46:20 EST


On Tue, Feb 11, 2025 at 08:23:47AM +0100, Jiri Slaby wrote:
> On 11. 02. 25, 7:19, Kartik Rajput wrote:

...

> > +static irqreturn_t tegra_utc_isr(int irq, void *dev_id)
> > +{
> > + struct tegra_utc_port *tup = dev_id;
> > + unsigned long flags;
> > + u32 status;
> > +
> > + uart_port_lock_irqsave(&tup->port, &flags);
> > +
> > + /* Process RX_REQ and RX_TIMEOUT interrupts. */
> > + do {
> > + status = tegra_utc_rx_readl(tup, TEGRA_UTC_INTR_STATUS) & tup->rx_irqmask;
> > + if (status) {
> > + tegra_utc_rx_writel(tup, tup->rx_irqmask, TEGRA_UTC_INTR_CLEAR);
> > + tegra_utc_rx_chars(tup);
> > + }
> > + } while (status);
> > +
> > + /* Process TX_REQ interrupt. */
> > + do {
> > + status = tegra_utc_tx_readl(tup, TEGRA_UTC_INTR_STATUS) & tup->tx_irqmask;
> > + if (status) {
> > + tegra_utc_tx_writel(tup, tup->tx_irqmask, TEGRA_UTC_INTR_CLEAR);
> > + tegra_utc_tx_chars(tup);
> > + }
> > + } while (status);
> > +
> > + uart_port_unlock_irqrestore(&tup->port, flags);
> > +
> > + return IRQ_HANDLED;
>
> You do not let the irq subsystem to kill this IRQ if you do not handle it
> above (in case HW gets mad, triggers IRQ, but does not set rx/tx flags).
> That is, return IRQ_HANDLED only when you really handled it (some status
> above was nonzero).
>
> > +}

I am also wondering why _irqsave / _irqrestore? Don't you have interrupts
already being disabled at this point?

--
With Best Regards,
Andy Shevchenko