Re: [PATCH v2 1/3] w1: ds2482: Add regulator support
From: Krzysztof Kozlowski
Date: Sun Nov 24 2024 - 05:50:32 EST
On 24/11/2024 11:22, Kryštof Černý wrote:
>>> + /* Get the vcc regulator */
>>> + data->vcc_reg = devm_regulator_get(&client->dev, "vcc");
>>> + if (IS_ERR(data->vcc_reg))
>>> + return PTR_ERR(data->vcc_reg);
>>> +
>>> + /* Enable the vcc regulator */
>>> + ret = regulator_enable(data->vcc_reg);
>>
>> You wanted devm_regulator_get_enable().
>>
>> ... but your comment also suggests devm_regulator_get_enable_optional().
>>
>
> This is a good point, my implementation is based on observation of a few
> other drivers and it's not needed in this case. This will reduce the
> amount of changes.
>
> I think my wording was not correct. By optionally I meant that most
> hardware designs do not use a separate power supply regulator, so they
> do not need to specify one, but the device needs power to function.
> My current view is that it should not be optional after all, so I would
> go with devm_regulator_get_enable(). Could you please tell me your view
> on this?
>
Sure, fine.
Best regards,
Krzysztof