diff options
author | Daniel Campello <campello@chromium.org> | 2020-08-04 02:58:03 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2020-09-03 21:40:41 +0300 |
commit | 364e853ceec92cafe2c0d7fe7cc1d89891903234 (patch) | |
tree | 4833f9319c2770bd7278770e933151670ca1add7 /drivers/iio/proximity | |
parent | d9f753f3e9edc0b4c0acdbe2708746242f7c7a79 (diff) | |
download | linux-364e853ceec92cafe2c0d7fe7cc1d89891903234.tar.xz |
iio: sx9310: Fix irq handling
Fixes enable/disable irq handling at various points. The driver needs to
only enable/disable irqs if there is an actual irq handler installed.
Signed-off-by: Daniel Campello <campello@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/proximity')
-rw-r--r-- | drivers/iio/proximity/sx9310.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/iio/proximity/sx9310.c b/drivers/iio/proximity/sx9310.c index c02a9e8b7a7a..4ad8194c70a9 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 { @@ -1007,10 +1011,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 = { |