lkml.org 
[lkml]   [2021]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 1/2] net: fec: make fec_reset_phy not only usable once
>  #ifdef CONFIG_OF
> -static int fec_reset_phy(struct platform_device *pdev)
> +static int fec_reset_phy_probe(struct platform_device *pdev,
> + struct net_device *ndev)
> {
> - int err, phy_reset;
> - bool active_high = false;
> - int msec = 1, phy_post_delay = 0;
> struct device_node *np = pdev->dev.of_node;
> + struct fec_enet_private *fep = netdev_priv(ndev);
> + int tmp, ret;
>
> if (!np)
> return 0;
>
> - err = of_property_read_u32(np, "phy-reset-duration", &msec);
> + tmp = 1;
> + ret = of_property_read_u32(np, "phy-reset-duration", &tmp);
> /* A sane reset duration should not be longer than 1s */
> - if (!err && msec > 1000)
> - msec = 1;
> + if (!ret && tmp > 1000)
> + tmp = 1;
> +
> + fep->phy_reset_duration = tmp;

If you don't change the names msec and ret, this code would be
unchanged. It then becomes a lot easier to see you have not changed,
the code, only moved it around.

Andrew

\
 
 \ /
  Last update: 2021-12-06 14:14    [W:0.156 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site