From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Daniel Campello <campello@chromium.org>
Cc: LKML <devicetree@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
Stephen Boyd <swboyd@chromium.org>,
Douglas Anderson <dianders@chromium.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v5 03/15] iio: sx9310: Fix irq handling
Date: Tue, 4 Aug 2020 10:26:55 +0300 [thread overview]
Message-ID: <CAHp75VcftUCi-4w=NWXUb=zPYL9zz6BEHw6y1wUKPD8vXcX9zA@mail.gmail.com> (raw)
In-Reply-To: <20200803175559.v5.3.Idbfcd2e92d2fd89b6ed2e83211bd3e6c06852c33@changeid>
On Tue, Aug 4, 2020 at 2:58 AM Daniel Campello <campello@chromium.org> wrote:
>
> Fixes enable/disable irq handling at various points. The driver needs to
> only enable/disable irqs if there is an actual irq handler installed.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Daniel Campello <campello@chromium.org>
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
> ---
>
> Changes in v5: None
> Changes in v4:
> - Reverted condition check logic on enable/disable_irq methods.
>
> Changes in v3:
> - Moved irq presence check down to lower methods
>
> Changes in v2:
> - Reordered error handling on sx9310_resume()
>
> drivers/iio/proximity/sx9310.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/proximity/sx9310.c b/drivers/iio/proximity/sx9310.c
> index d7c77fc661ba86..dafee85018aa6d 100644
> --- a/drivers/iio/proximity/sx9310.c
> +++ b/drivers/iio/proximity/sx9310.c
> @@ -323,11 +323,15 @@ static int sx9310_put_event_channel(struct sx9310_data *data, int channel)
>
> static int sx9310_enable_irq(struct sx9310_data *data, unsigned int irq)
> {
> + if (!data->client->irq)
> + return 0;
> return regmap_update_bits(data->regmap, SX9310_REG_IRQ_MSK, irq, irq);
> }
>
> static int sx9310_disable_irq(struct sx9310_data *data, unsigned int irq)
> {
> + if (!data->client->irq)
> + return 0;
> return regmap_update_bits(data->regmap, SX9310_REG_IRQ_MSK, irq, 0);
> }
>
> @@ -381,7 +385,7 @@ static int sx9310_read_proximity(struct sx9310_data *data,
>
> mutex_unlock(&data->mutex);
>
> - if (data->client->irq > 0) {
> + if (data->client->irq) {
> ret = wait_for_completion_interruptible(&data->completion);
> reinit_completion(&data->completion);
> } else {
> @@ -1010,10 +1014,11 @@ static int __maybe_unused sx9310_resume(struct device *dev)
>
> out:
> mutex_unlock(&data->mutex);
> + if (ret)
> + return ret;
>
> enable_irq(data->client->irq);
> -
> - return ret;
> + return 0;
> }
>
> static const struct dev_pm_ops sx9310_pm_ops = {
> --
> 2.28.0.163.g6104cc2f0b6-goog
>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2020-08-04 7:27 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-03 23:58 [PATCH v5 00/15] sx9310 iio driver updates Daniel Campello
2020-08-03 23:58 ` [PATCH v5 01/15] dt-bindings: iio: Add bindings for sx9310 sensor Daniel Campello
2020-08-06 18:14 ` Jonathan Cameron
2020-08-03 23:58 ` [PATCH v5 02/15] iio: sx9310: Update macros declarations Daniel Campello
2020-08-06 18:15 ` Jonathan Cameron
2020-08-03 23:58 ` [PATCH v5 03/15] iio: sx9310: Fix irq handling Daniel Campello
2020-08-04 7:26 ` Andy Shevchenko [this message]
2020-08-03 23:58 ` [PATCH v5 04/15] iio: sx9310: Remove acpi and of table macros Daniel Campello
2020-08-06 18:28 ` Jonathan Cameron
2020-08-03 23:58 ` [PATCH v5 05/15] iio: sx9310: Change from .probe to .probe_new Daniel Campello
2020-08-06 18:29 ` Jonathan Cameron
2020-08-03 23:58 ` [PATCH v5 06/15] iio: sx9310: Fixes various memory handling Daniel Campello
2020-08-06 18:29 ` Jonathan Cameron
2020-08-03 23:58 ` [PATCH v5 07/15] iio: sx9310: Use long instead of int for channel bitmaps Daniel Campello
2020-08-06 18:30 ` Jonathan Cameron
2020-08-16 9:36 ` Jonathan Cameron
2020-08-03 23:58 ` [PATCH v5 08/15] iio: sx9310: Use regmap_read_poll_timeout() for compensation Daniel Campello
2020-08-03 23:58 ` [PATCH v5 09/15] iio: sx9310: Update copyright Daniel Campello
2020-08-18 1:45 ` Daniel Campello
2020-08-22 10:34 ` Jonathan Cameron
2020-08-03 23:58 ` [PATCH v5 10/15] iio: sx9310: Simplify error return handling Daniel Campello
2020-08-03 23:58 ` [PATCH v5 11/15] iio: sx9310: Use variable to hold &client->dev Daniel Campello
2020-08-06 18:38 ` Jonathan Cameron
2020-08-03 23:58 ` [PATCH v5 12/15] iio: sx9310: Miscellaneous format fixes Daniel Campello
2020-08-03 23:58 ` [PATCH v5 13/15] iio: sx9310: Drop channel_users[] Daniel Campello
2020-08-03 23:58 ` [PATCH v5 14/15] iio: sx9310: Enable vdd and svdd regulators at probe Daniel Campello
2020-08-03 23:58 ` [PATCH v5 15/15] iio: sx9310: Use irq trigger flags from firmware Daniel Campello
2020-08-06 18:42 ` Jonathan Cameron
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='CAHp75VcftUCi-4w=NWXUb=zPYL9zz6BEHw6y1wUKPD8vXcX9zA@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=campello@chromium.org \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.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;
as well as URLs for NNTP newsgroup(s).