public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Song Chen <chensong_2000@189.cn>,
	lgirdwood@gmail.com, broonie@kernel.org, lee@kernel.org,
	linus.walleij@linaro.org, brgl@bgdev.pl
Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH] regulator:s5m8767 Fully convert to GPIO descriptors
Date: Mon, 9 Dec 2024 20:50:07 +0100	[thread overview]
Message-ID: <bf80a815-a602-4bbe-a950-e8b6c1b0789a@kernel.org> (raw)
In-Reply-To: <862662aa-c5a2-4e15-b97f-ca1b4757ab25@189.cn>

On 07/12/2024 07:16, Song Chen wrote:
>>>   		}
>>> -		pdata->buck_gpios[i] = gpio;
>>> +
>>> +		/* SET GPIO*/
>>
>> What is a SET GPIO?
>>
>>> +		snprintf(label, sizeof(label), "%s%d", "S5M8767 SET", i + 1);
>>
>> Why using "SET" as name, not the actual name it is used for? Buck DVS?
> 
> from below snippets:
> s5m8767_pmic_probe of drivers/regulator/s5m8767.c
>          ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[0],
>                      "S5M8767 SET1");
>          if (ret)
>              return ret;
> 
>          ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[1],
>                      "S5M8767 SET2");
>          if (ret)
>              return ret;
> 
>          ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[2],
>                      "S5M8767 SET3");


Yeah, your code is fine.

> 
> and arch/arm/boot/dts/samsung/exynos5250-spring.dts
> 
>          s5m8767,pmic-buck-dvs-gpios = <&gpd1 0 GPIO_ACTIVE_LOW>, /* DVS1 */
>                            <&gpd1 1 GPIO_ACTIVE_LOW>, /* DVS2 */
>                            <&gpd1 2 GPIO_ACTIVE_LOW>; /* DVS3 */
> 
>          s5m8767,pmic-buck-ds-gpios = <&gpx2 3 GPIO_ACTIVE_LOW>, /* SET1 */
>                           <&gpx2 4 GPIO_ACTIVE_LOW>, /* SET2 */
>                           <&gpx2 5 GPIO_ACTIVE_LOW>; /* SET3 */
> 
>>
>>> +		gpiod_set_consumer_name(pdata->buck_gpios[i], label);
>>> +		gpiod_direction_output(pdata->buck_gpios[i],
>>> +					(pdata->buck_default_idx >> (2 - i)) & 0x1);
>>
>> This is not an equivalent code. You set values for GPIOs 0-1 even if
>> requesting GPIO 2 fails.
>>
>> On which board did you test it?
> 
> You are right ,it's not equivalent with original code, i will fix it. 
> but i have a question here:
> 
>          ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[0],
>                      "S5M8767 SET1");
>          if (ret)
>              return ret;
> 
>          ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[1],
>                      "S5M8767 SET2");
>          if (ret)
>              return ret;
> 
>          ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[2],
>                      "S5M8767 SET3");
>          if (ret)
>              return ret;
> 
> if it fails to request buck_gpios[2] after successfully requests 
> buck_gpios[0] and buck_gpios[1], the probe fails as well, should it call 
> gpiod_put to return gpio resource?


Aren't you using devm interface? Please read the API. You do not need to
put anything, unless you use some other interface and I missed the point
of the question.

Best regards,
Krzysztof

  reply	other threads:[~2024-12-09 19:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06  5:13 [PATCH] regulator:s5m8767 Fully convert to GPIO descriptors Song Chen
2024-12-06  8:33 ` Krzysztof Kozlowski
2024-12-07  6:16   ` Song Chen
2024-12-09 19:50     ` Krzysztof Kozlowski [this message]
2024-12-10  6:51       ` Song Chen
2024-12-13 10:30       ` Song Chen
2025-01-06  9:23         ` Song Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf80a815-a602-4bbe-a950-e8b6c1b0789a@kernel.org \
    --to=krzk@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=chensong_2000@189.cn \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox