lkml.org 
[lkml]   [2020]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3 03/15] iio: sx9310: Fix irq handling
On Fri, Jul 31, 2020 at 7:49 PM 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.

...

> static int sx9310_enable_irq(struct sx9310_data *data, unsigned int irq)
> {
> - return regmap_update_bits(data->regmap, SX9310_REG_IRQ_MSK, irq, irq);
> + if (data->client->irq)
> + return regmap_update_bits(data->regmap, SX9310_REG_IRQ_MSK, irq,
> + irq);
> + return 0;

Wouldn't it be better to insert rather
if (!irq)
return 0;
than disrupting the entire function?

> }
>
> static int sx9310_disable_irq(struct sx9310_data *data, unsigned int irq)
> {
> - return regmap_update_bits(data->regmap, SX9310_REG_IRQ_MSK, irq, 0);
> + if (data->client->irq)
> + return regmap_update_bits(data->regmap, SX9310_REG_IRQ_MSK, irq,
> + 0);
> + return 0;

Ditto.

> }



--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2020-07-31 20:36    [W:0.150 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site