Re: [PATCH] fec: convert to gpio descriptor

From: Arnd Bergmann
Date: Thu Jan 26 2023 - 15:32:59 EST


On Thu, Jan 26, 2023, at 19:02, Andrew Lunn wrote:
> On Thu, Jan 26, 2023 at 02:52:58PM +0100, Arnd Bergmann wrote:
>> static int fec_reset_phy(struct platform_device *pdev)
>> {
>> - int err, phy_reset;
>> + int err;
>> + struct gpio_desc *phy_reset;
>> bool active_high = false;
>> int msec = 1, phy_post_delay = 0;
>> struct device_node *np = pdev->dev.of_node;
>
> Hi Arnd
>
> netdev drivers are supposed to use 'reverse Christmas tree'. It looks
> like this function is actually using 'Christmas tree' :-) Please could
> you keep with the current coding style.

My feeling is that the style in this file is just random,
but having 'err' as the last one fits with the usual style
and with what some of the other functions do, so I'll do that.

>> + active_high ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW);
>> + if (IS_ERR(phy_reset)) {
>> + err = PTR_ERR(phy_reset);
>> + if (err != -EPROBE_DEFER)
>> + dev_err(&pdev->dev,
>> + "failed to get phy-reset-gpios: %d\n", err);
>
> dev_err_probe() looks usable here.

Ah nice, I've never been able to use that one so far.

Will send a v2 with both suggestions.

ARnd