Commit 364e853c authored by Daniel Campello's avatar Daniel Campello Committed by Jonathan Cameron

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: default avatarDaniel Campello <campello@chromium.org>
Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent d9f753f3
...@@ -323,11 +323,15 @@ static int sx9310_put_event_channel(struct sx9310_data *data, int channel) ...@@ -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) 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); return regmap_update_bits(data->regmap, SX9310_REG_IRQ_MSK, irq, irq);
} }
static int sx9310_disable_irq(struct sx9310_data *data, unsigned int 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); 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, ...@@ -381,7 +385,7 @@ static int sx9310_read_proximity(struct sx9310_data *data,
mutex_unlock(&data->mutex); mutex_unlock(&data->mutex);
if (data->client->irq > 0) { if (data->client->irq) {
ret = wait_for_completion_interruptible(&data->completion); ret = wait_for_completion_interruptible(&data->completion);
reinit_completion(&data->completion); reinit_completion(&data->completion);
} else { } else {
...@@ -1007,10 +1011,11 @@ static int __maybe_unused sx9310_resume(struct device *dev) ...@@ -1007,10 +1011,11 @@ static int __maybe_unused sx9310_resume(struct device *dev)
out: out:
mutex_unlock(&data->mutex); mutex_unlock(&data->mutex);
if (ret)
return ret;
enable_irq(data->client->irq); enable_irq(data->client->irq);
return 0;
return ret;
} }
static const struct dev_pm_ops sx9310_pm_ops = { static const struct dev_pm_ops sx9310_pm_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment