Re: [PATCH V4 03/10] iio: imu: inv_icm42607: Add I2C and SPI For icm42607

Jonathan Cameron
2026-05-04T18:15:48Z

On Fri, 1 May 2026 17:11:42 -0500
Chris Morgan <macroalpha82@gmail.com> wrote:

> From: Chris Morgan <macromorgan@hotmail.com>
>
> Add I2C and SPI driver support for InvenSense ICM-42607 devices.
> Add necessary Kconfig and Makefile to allow building of (incomplete)
> driver.
>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>

> diff --git a/drivers/iio/imu/inv_icm42607/inv_icm42607_spi.c b/drivers/iio/imu/inv_icm42607/inv_icm42607_spi.c
> new file mode 100644
> index 000000000000..7a02bbab3a63
> --- /dev/null
> +++ b/drivers/iio/imu/inv_icm42607/inv_icm42607_spi.c

> +static const struct of_device_id inv_icm42607_of_matches[] = {
> + {
> + .compatible = "invensense,icm42607",
> + .data = (void *)INV_CHIP_ICM42607,
> + },
> + {
> + .compatible = "invensense,icm42607p",
> + .data = (void *)INV_CHIP_ICM42607P,
> + },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, inv_icm42607_of_matches);
> +
> +static const struct spi_device_id inv_icm42607_spi_id_table[] = {
> + { "icm42607", INV_CHIP_ICM42607 },
> + { "icm42607p", INV_CHIP_ICM42607P },
Very strong preference in new code to not use enums for the data.
That explains why you need the magic invalid in previous patch.

Can we instead just use pointers to the per chip data relevant
to each one? That usually means some externs in the header.

We used to do things how you have it here, but the enums always
end up proving a pain as drivers get more complex. They also
encourage part specific code when it should almost always be
part specific constant data.

Currently I'm not sure what is different between these parts.
If nothing yet from point of view of what the driver supports
then don't bother providing data 'yet'.

Jonathan

> + { }
> +};