lkml.org 
[lkml]   [2023]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 4/7] thermal: exynos: simplify regulator (de)initialization
From
On 29.09.2023 12:46, Daniel Lezcano wrote:
> On 26/09/2023 13:02, Mateusz Majewski wrote:
>> Hi,
>>
>>> This is not equivalent. If regulator is provided and enable fails, the
>>> old code is nicely returning error. Now, it will print misleading
>>> message - failed to get regulator - and continue.
>>>
>>> While this simplifies the code, it ignores important running
>>> condition -
>>> having regulator enabled.
>>
>> Would doing this be correct?
>>
>> ret = devm_regulator_get_enable_optional(&pdev->dev, "vtmu");
>> switch (ret) {
>> case 0:
>> case -ENODEV:
>
> Not sure to understand why -NODEV is not an error


Because this what devm_regulator_get_enable_optional() returns if no
regulator is defined. I also got confused by this a few times.


>
>>     break;
>> case -EPROBE_DEFER:
>>     return -EPROBE_DEFER;
>> default:
>>     dev_err(&pdev->dev, "Failed to get enabled regulator: %d\n",
>>         ret);
>>     return ret;
>> }
>
> ret = devm_regulator_get_enable_optional(&pdev->dev, "vtmu");
> if (ret < 0) {
>     if (ret != EPROBE_DEFER)
>         dev_err(&pdev->dev, "Failed to get enabled regulator: %d\n",
> ret);
>     return ret;
> }
>
> ??
>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

\
 
 \ /
  Last update: 2023-09-29 13:04    [W:0.055 / U:1.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site