Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752841AbdLESGo (ORCPT ); Tue, 5 Dec 2017 13:06:44 -0500 Received: from mail1.skidata.com ([91.230.2.99]:42728 "EHLO mail1.skidata.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752126AbdLESGk (ORCPT ); Tue, 5 Dec 2017 13:06:40 -0500 X-IronPort-AV: E=Sophos;i="5.45,364,1508796000"; d="scan'208";a="7475545" Subject: Re: [PATCH net-next v3 1/4] phylib: Add device reset delay support To: Andrew Lunn , Richard Leitner CC: , , , , , , , , , , , , , References: <20171205132600.13796-1-dev@g0hl1n.net> <20171205132600.13796-2-dev@g0hl1n.net> <20171205172852.GM12805@lunn.ch> From: Richard Leitner Message-ID: <964bce1a-4f18-575e-1274-e5c2d877b706@skidata.com> Date: Tue, 5 Dec 2017 19:06:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171205172852.GM12805@lunn.ch> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: de-AT Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.24.99] X-ClientProxiedBy: sdex1srv.skidata.net (172.16.10.92) To sdex1srv.skidata.net (172.16.10.92) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1585 Lines: 48 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