Re: [PATCH v6 4/4] iio: light: veml6031x00: add support for events and trigger
From: Javier Carrasco
Date: Fri Aug 14 2026 - 18:30:50 EST
> static int veml6031x00_probe(struct i2c_client *i2c)
> {
...
> + ret = devm_add_action_or_reset(dev, veml6031x00_disable_event_action, data);
> + if (ret) {
> + dev_err_probe(dev, ret, "Failed to add event cleanup action\n");
> + goto err_pm_put;
> + }
> +
I just realized that this action is added without taking into account if
an interrupt is registered or not. It passes because the function checks
if the events are enabled, but it is unnecessary if there is no
interrupt in the first place. I will move it right after
veml6031x00_setup_irq(), and when at it, I will take the whole IIO
device initialization to a dedicated function to make it more readable.
> ret = veml6031x00_validate_part_id(data);
> if (ret)
> goto err_pm_put;
> @@ -693,6 +1212,20 @@ static int veml6031x00_probe(struct i2c_client *i2c)
> if (ret)
> goto err_pm_put;
>
> + if (i2c->irq) {
> + iio->channels = veml6031x00_channels_irq;
> + iio->num_channels = ARRAY_SIZE(veml6031x00_channels_irq);
> + ret = veml6031x00_setup_irq(i2c, iio);
> + if (ret)
> + goto err_pm_put;
> +
> + iio->info = &veml6031x00_info;
> + } else {
> + iio->channels = veml6031x00_channels;
> + iio->num_channels = ARRAY_SIZE(veml6031x00_channels);
> + iio->info = &veml6031x00_info_no_irq;
> + }
> +
> pm_runtime_put_autosuspend(dev);
>
> ret = devm_iio_triggered_buffer_setup(dev, iio,
Best regards,
Javier