Re: [PATCH] iio: light: si1133: prefer complex macros enclosed in parenthesis

From: Andy Shevchenko

Date: Mon Apr 27 2026 - 14:45:00 EST


On Mon, Apr 27, 2026 at 04:08:37PM +0200, Joshua Crofts via B4 Relay wrote:

> Enclose complex macros in parenthesis per checkpatch.pl error to
> improve code style.

...

> -#define SI1133_ADCSENS_NB_MEAS(x) fls(x) << SI1133_ADCSENS_SCALE_SHIFT
> +#define SI1133_ADCSENS_NB_MEAS(x) (fls(x) << SI1133_ADCSENS_SCALE_SHIFT)

Wow, this is used with bitwise OR, which probably works fine due to operator precedence.

...

> -#define SI1133_CMD_TIMEOUT_US SI1133_CMD_TIMEOUT_MS * 1000
> +#define SI1133_CMD_TIMEOUT_US (SI1133_CMD_TIMEOUT_MS * 1000)

Is it used at all?

I would drop unused macros (that are Linux only, not directly related to HW) in
a separate patch.

--
With Best Regards,
Andy Shevchenko