On Tue, Mar 31, 2020 at 2:49 PM Nuno Sá <nuno.sa@xxxxxxxxxx> wrote: > > There are some ADIS devices that can configure the data ready pin > polarity. Hence, we cannot hardcode our IRQ mask as IRQF_TRIGGER_RISING > since we might want to have it as IRQF_TRIGGER_FALLING. ... > +static int adis_validate_irq_mask(struct adis *adis) > +{ > + if (!adis->irq_mask) { > + adis->irq_mask = IRQF_TRIGGER_RISING; > + return 0; > + } else if (adis->irq_mask != IRQF_TRIGGER_RISING && 'else' is redundant. > + adis->irq_mask != IRQF_TRIGGER_FALLING) { But this condition rises questions. Why i can't configure both? Why I can't configure other flags there? > + dev_err(&adis->spi->dev, "Invalid IRQ mask: %08lx\n", > + adis->irq_mask); > + return -EINVAL; > + } > + return 0; > +} And actually name of the function is not exactly what it does. It validates *or* initializes. -- With Best Regards, Andy Shevchenko