Re: [PATCH 2/2] hwmon: chipcap2: disable sensor if request ready irq fails

From: Javier Carrasco
Date: Mon Aug 12 2024 - 16:00:11 EST


On 12/08/2024 18:49, Guenter Roeck wrote:
> On 8/12/24 08:43, Javier Carrasco wrote:
>> This check is carried out after getting the regulator, and the device
>> can be disabled if an error occurs.
>>
>
> I do not see a possible path for a call to cc2_enable() at this point,
> meaning the regulator won't ever be enabled. Please provide a better
> explanation why this patch would be necessary.
>
> Guenter
>

Hi Guenter,

this patch enforces the state where the dedicated regulator is disabled,
no matter what the history of the regulator was. If a previous
regulator_disable() failed, it would still be desirable that the
regulator gets disabled the next time the driver is probed (i.e. a new
attempt to disable it on failure).
cc2_disable() checks first if the regulator is enabled to avoid any
imbalance.

Best regards,
Javier Carrasco