lkml.org 
[lkml]   [2017]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net-next v3 1/4] phylib: Add device reset delay support
From
Date
Hi Andrew,

On 12/05/2017 06:28 PM, Andrew Lunn wrote:
> Hi Richard
>
>> +++ b/drivers/of/of_mdio.c
>> @@ -77,6 +77,14 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio,
>> if (of_property_read_bool(child, "broken-turn-around"))
>> mdio->phy_ignore_ta_mask |= 1 << addr;
>>
>> + if (of_property_read_u32(child, "reset-delay-us",
>> + &phy->mdio.reset_delay))
>> + phy->mdio.reset_delay = 0;
>> +
>> + if (of_property_read_u32(child, "reset-post-delay-us",
>> + &phy->mdio.reset_post_delay))
>> + phy->mdio.reset_post_delay = 0;
>
> of_property_read_u32() should not change the variable you pass to it,
> if it does not find the property. So you can change this to:
>
> phy->mdio.reset_delay = 0;
> phy->mdio.reset_post_delay = 0;
>
> of_property_read_u32(child, "reset-delay-us",
> &phy->mdio.reset_delay);
>
> of_property_read_u32(child, "reset-post-delay-us",
> &phy->mdio.reset_post_delay);

Geert already pointed this out, but he said it's possible to omit also
the zeroing of the variables.

> On 12/05/2017 02:54 PM, Geert Uytterhoeven wrote:
>> If of_property_read_u32() fails, it doesn't write to its output
>> parameter.
>> As the structure should be zeroed during allocation, you can just
>> write:
>>
>> of_property_read_u32(child, "reset-delay-us",&phy->mdio.reset_delay);
>> of_property_read_u32(child, "reset-post-delay-us",
>> &phy->mdio.reset_post_delay);

If that's ok I'll take the shorter (Geerts) suggestion for v4.

Nonetheless thanks for your quick feedback!

regards;Richard.L

\
 
 \ /
  Last update: 2017-12-05 19:07    [W:0.104 / U:2.940 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site