Re: [PATCH v1 03/11] iio: light: tsl2563: Configure INT in one place

From: Jonathan Cameron
Date: Sun Dec 11 2022 - 08:04:52 EST


On Wed, 7 Dec 2022 21:03:40 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> Introduce tsl2563_configure_irq() to configure INT in one place.
>
> While at it, make use of TSL2563_INT_LEVEL and newly introduced
> TSL2563_INT_MASK.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> Tested-by: Ferry Toth <ftoth@xxxxxxxxxxxxxx>
Trivial note on a further improvement inline.

LGTM
> ---
> drivers/iio/light/tsl2563.c | 42 ++++++++++++++++++++++---------------
> 1 file changed, 25 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
> index d836c15ba777..d071805239ef 100644
> --- a/drivers/iio/light/tsl2563.c
> +++ b/drivers/iio/light/tsl2563.c
> @@ -69,6 +69,7 @@
>
> #define TSL2563_INT_DISABLED 0x00
> #define TSL2563_INT_LEVEL 0x10
> +#define TSL2563_INT_MASK 0x30

Better to use GENMASK etc, but given age of driver I'm not surprised no one
has made the conversion to that and FIELD_GET/ FIELD_PREP.

Nice follow up if anyone is bored enough ;)


> #define TSL2563_INT_PERSIST(n) ((n) & 0x0F)
>