Re: [PATCH v2 4/5] iio: chemical: sgp40: Implement execute_self_test-command
From: Jonathan Cameron
Date: Sat Nov 07 2026 - 20:03:20 EST
On Mon, 2 Nov 2026 11:12:57 +0200
Jaakko Koivisto <jmatko@xxxxxx> wrote:
> Add functionality for running the SGP40 sensor self-test, testing
> the heater and MOX-material.
>
> Datasheet does not clearly state if the chip is completely unusable if
> the test fails. Because of this the driver will try to use the chip
> normally even if the self-test has failed.
>
> If the test fails to run, the driver probe is aborted.
>
> Signed-off-by: Jaakko Koivisto <jmatko@xxxxxx>
> ---
> Is it ok to fail the probe if the self-test fails? Currently the driver
> will probe succesfully even if the device is powered down, or does
> not exist at all, so failing the probe is rather significant change
> from current behaviour.
Yes, it is fine to fail. In rare cases where selftest has known
issues such as a tight bound that fails one in a hundred times
we just retry it. If we think self test failing means broken device
then failing probe is definitely fine.
Given your comment on the lack of clarity above, it is reasonable
in this case to print a message but carry on anyway as long
as the test ran!
So to conclude, I think you have the right balance here.
thanks,
Jonathan
> +}