Re: [PATCH 2/2] drivers: iio: light: cm3323: Add device tree support

From: Jonathan Cameron
Date: Wed Jul 28 2021 - 13:54:12 EST


On Wed, 28 Jul 2021 17:52:16 +0530
Siddharth Manthan <siddharth_manthan@xxxxxxxxxxx> wrote:

> Add Device Tree support for Capella cm3323 Ambient Light Sensor
>
> Signed-off-by: Siddharth Manthan <siddharth_manthan@xxxxxxxxxxx>
It 'should' have worked without the explicit of_device_id table,
via the fallback that I2C has to use the i2c_device_id table.

I'm fine with making it explicit though as that route doesn't
use the vendor ID at all, so we 'might' get a clash.

I'll change the patch title when applying to something like
iio:light:cm3323: Add of_device_id table

Note also drop the drivers bit as we don't normally have that for
IIO devices.

Jonathan

> ---
> drivers/iio/light/cm3323.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/iio/light/cm3323.c b/drivers/iio/light/cm3323.c
> index 6d1b0ffd1..fd9a8c27d 100644
> --- a/drivers/iio/light/cm3323.c
> +++ b/drivers/iio/light/cm3323.c
> @@ -256,9 +256,16 @@ static const struct i2c_device_id cm3323_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, cm3323_id);
>
> +static const struct of_device_id cm3323_of_match[] = {
> + { .compatible = "capella,cm3323", },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, cm3323_of_match);
> +
> static struct i2c_driver cm3323_driver = {
> .driver = {
> .name = CM3323_DRV_NAME,
> + .of_match_table = cm3323_of_match,
> },
> .probe = cm3323_probe,
> .id_table = cm3323_id,