From: Stephan Gerhold <stephan@gerhold.net>
To: Amit Kucheria <amit.kucheria@linaro.org>
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
bjorn.andersson@linaro.org, agross@kernel.org,
swboyd@chromium.org, olof@lixom.net,
Daniel Lezcano <daniel.lezcano@linaro.org>,
linux-pm@vger.kernel.org
Subject: Re: [PATCH] drivers: thermal: tsens: Work with old DTBs
Date: Wed, 11 Dec 2019 18:13:13 +0100 [thread overview]
Message-ID: <20191211171313.GA1530@gerhold.net> (raw)
In-Reply-To: <39d6b8e4b2cc5836839cfae7cdf0ee3470653b64.1576058136.git.amit.kucheria@linaro.org>
Hi Amit,
Thanks for the patch!
On Wed, Dec 11, 2019 at 03:28:33PM +0530, Amit Kucheria wrote:
> In order for the old DTBs to continue working, the new interrupt code
> must not return an error if interrupts are not defined.
>
> Fixes: 634e11d5b450a ("drivers: thermal: tsens: Add interrupt support")
> Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
> ---
> drivers/thermal/qcom/tsens.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
> index 015e7d2015985..d8f51067ed411 100644
> --- a/drivers/thermal/qcom/tsens.c
> +++ b/drivers/thermal/qcom/tsens.c
> @@ -109,7 +109,7 @@ static int tsens_register(struct tsens_priv *priv)
>
> irq = platform_get_irq_byname(pdev, "uplow");
> if (irq < 0) {
> - ret = irq;
> + dev_warn(&pdev->dev, "Missing uplow irq in DT\n");
> goto err_put_device;
> }
platform_get_irq_byname() already logs an error if the IRQ cannot be
found: qcom-tsens 4a9000.thermal-sensor: IRQ uplow not found
To replace that error with a warning (not sure if that is worth it),
we would need to replace the call with platform_get_irq_byname_optional().
>
> @@ -118,7 +118,8 @@ static int tsens_register(struct tsens_priv *priv)
> IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> dev_name(&pdev->dev), priv);
> if (ret) {
> - dev_err(&pdev->dev, "%s: failed to get irq\n", __func__);
> + dev_warn(&pdev->dev, "%s: failed to get uplow irq\n", __func__);
> + ret = 0;
> goto err_put_device;
In case of the old DT, platform_get_irq_byname() will return -ENXIO,
because no interrupt is specified in the device tree.
So we should have already run into the error earlier,
and jumped to "err_put_device".
Is this hunk really necessary?
In other words, wouldn't it be enough to do something like
@@ -110,6 +110,8 @@ static int tsens_register(struct tsens_priv *priv)
irq = platform_get_irq_byname(pdev, "uplow");
if (irq < 0) {
ret = irq;
+ if (ret == -ENXIO)
+ ret = 0;
goto err_put_device;
}
... to essentially ignore only the "IRQ does not exist" condition
for old device trees?
Thanks,
Stephan
next prev parent reply other threads:[~2019-12-11 17:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1576058136.git.amit.kucheria@linaro.org>
2019-12-11 9:58 ` [PATCH] drivers: thermal: tsens: Work with old DTBs Amit Kucheria
2019-12-11 15:09 ` Daniel Lezcano
2019-12-12 9:50 ` Amit Kucheria
2019-12-11 17:13 ` Stephan Gerhold [this message]
2019-12-12 9:47 ` Amit Kucheria
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=20191211171313.GA1530@gerhold.net \
--to=stephan@gerhold.net \
--cc=agross@kernel.org \
--cc=amit.kucheria@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=olof@lixom.net \
--cc=swboyd@chromium.org \
/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