Re: [PATCH 1/2] thermal/drivers/rcar_gen3: Handle -ENXIO from optional IRQ lookup

Bui Duc Phuc <[email protected]>
Newsgroups org.kernel.vger.linux-renesas-soc,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm
Message-ID <CAABR9nGAY6BjA2mRsv+2hkB1kv0QDJX6osXyEMw6jsjE+j2+vQ@mail.gmail.com>
Hi Niklas Söderlund,

Thank you for your feedback .

> > Regarding the caller, I only found rcar_gen3_thermal_request_irqs()
> > being called here:
> > https://elixir.bootlin.com/linux/v7.2-rc6/source/drivers/thermal/renesas/rcar_gen3_thermal.c#L530
> > It does not appear to handle the error return there, so I don't think
> > the caller currently handles these failures explicitly.
>
> Yes it does. If it can't get the optional interrupts the driver does not
> support setting trip-points in hardware. No?
>

Yes, for -ENXIO, you're right.
The caller treats it as the absence of optional IRQs and disables
hardware trip-point support.
However, this also means that -EPROBE_DEFER, -EINVAL, and other errors
are currently treated the same way.
The caller does not distinguish these errors from -ENXIO, so the probe
continues instead of propagating the actual error.

I think the caller should distinguish -ENXIO from other errors:
keep the current behavior for -ENXIO, but propagate -EPROBE_DEFER,
-EINVAL, and other errors.

ret = rcar_gen3_thermal_request_irqs(priv, pdev);
if (ret == -ENXIO) {
        priv->ops.set_trips = NULL;
} else if (ret) {
        return ret;
}

Best regards,
Phuc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.