Re: [PATCH 2/3] iio: light: opt4001: refactor driver to prepare to support more devices

From: Andy Shevchenko

Date: Fri Oct 23 2026 - 05:09:10 EST


On Fri, Oct 23, 2026 at 09:48:14AM +0200, Jesper X Nilsson wrote:
> Prepare opt4001 driver to be able to support OPT4041. Extend struct
> opt4001_chip_info with fields channels and device_id because OPT4041 has
> two channels and another device id.

...

> Assisted-by: LLM

Drop this tag.

...

> +static const struct iio_chan_spec opt4001_channels[] = {
> + {
> + .type = IIO_LIGHT,
> + .address = OPT4001_LIGHT1_MSB,
> + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
> + .info_mask_shared_by_all_available = BIT(IIO_CHAN_INFO_INT_TIME),
> + .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_INT_TIME)

While at it (and I see it was in the original code), add a trailing comma here.

> + },
> +};

...

> u8 count;
> u8 crc;
> u8 calc_crc;
> - u64 lux_raw;
> - u32 rem;
> + u32 mantissa;

Try to put it to make more of reversed xmas tree order.

> int ret;

...

> + chip->chip_info = i2c_get_match_data(client);

For now it requires

if (!chip->chip_info)
return -ENODATA;

--
With Best Regards,
Andy Shevchenko