Re: [PATCH v3 10/16] usb: phy: tegra: Use device-tree notion of reset-GPIO's active-state

From: Dmitry Osipenko
Date: Sat Jan 04 2020 - 19:58:54 EST


04.01.2020 02:53, Dmitry Osipenko ÐÐÑÐÑ:
> 03.01.2020 10:58, MichaÅ MirosÅaw ÐÐÑÐÑ:
[snip]
>> [...]
>>> - err = devm_gpio_request(&pdev->dev, tegra_phy->reset_gpio,
>>> - "ulpi_phy_reset_b");
>>> + gpiod = devm_gpiod_get_from_of_node(&pdev->dev, np,
>>> + "nvidia,phy-reset-gpio",
>>> + 0, GPIOD_OUT_HIGH,
>>> + "ulpi_phy_reset_b");
>>> + err = PTR_ERR_OR_ZERO(gpiod);
>>> if (err) {
>>> - dev_err(&pdev->dev, "Request failed for GPIO %d: %d\n",
>>> - tegra_phy->reset_gpio, err);
>>> + dev_err(&pdev->dev,
>>> + "Request failed for reset GPIO: %d\n", err);
>>> return err;
>>> }
>>> + tegra_phy->reset_gpio = gpiod;
>>
>> A nice extension to kernel's printf - "%pe" format - has just landed in
>> Linus' master tree.
>
> Thank you very much, I didn't know about that.

In this particular case PTR_ERR_OR_ZERO() results in a bit more cleaner
code than with IS_ERR() and PTR_ERR() [IMHO], so I'll probably keep it
as-is. Anyways, thanks again for the pointer to "%pe", it could come
handy later on.