Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2827509ybb; Sun, 22 Mar 2020 08:37:54 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtw8x9YPZAsl3e/rDCGxcx0Nuu/0iwXIAiY9OUDxKsezEBfQGu/AjM4LJioti2MvGApIveB X-Received: by 2002:aca:4997:: with SMTP id w145mr14475528oia.58.1584891474776; Sun, 22 Mar 2020 08:37:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584891474; cv=none; d=google.com; s=arc-20160816; b=IVGFacYErw3bNWQNPgct7d5+0ehWjue9yGO3UA7bHN/Zp7/k+zo8uWsyVJ2NNxEu9u WUZ9mnYX2NGOIintSiUzFfZTnGrsSAPSJ3FTUZpNNKz3hQd0iryHIRU9w0JOW8jlISyE d1EcmGFkIX003SEvVeTzLs4hWXwRR2tL12LdA+lIE1twK1+yITO9UGNfMR3+aUaanCRJ 2Wu0NrxgxrnDq/b6Z/2N7OAFJmDl0i6m/cELoZtyDXEOLToFNU5HlLA4Qpsfh1tmNUrK ZyJjSSe0xoPp4i9mfKs8MLpWRPvqQEnLcXbr9uZh71zkE0P+lO/XlHVmcy3KQKE/8Fk6 hWIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2onCqIcc3JF4Rkct2eyxjN9xBx7pmz24s+lxRPXhiYE=; b=NARwztFRjNjhADt99Muf5m2Nx/a4mtFa19V2/C4ET5vHcyXim6BPvaKcPXQgrXgNLz YzPN9HyjO8+eQb7TwkVERdWzaVtCJLbYD1V5DSn6N1nzUZvI2313T110A1wgj9rfb3dz kmygmVB0QH5RyPsh82g+ONPXLG1Qb43ptD4ajqDUnKlk45HDwIxBb8UgX6A+F7rudDcT bd/bco1M4bo0bALTiTquj479webeP0XtWi7VwDoPFPpyiHJa9QisG4FvgfXNKiSOxJe/ 8PKOOnVEkXZJXmpuqEk+xPxhU8dZUBG3hw4Dt3n7GCVgrCPvojnhtrOcOlZ8VzA619eJ fxsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=b2S0ec00; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u191si6449333oia.148.2020.03.22.08.37.42; Sun, 22 Mar 2020 08:37:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b=b2S0ec00; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726814AbgCVPhJ (ORCPT + 99 others); Sun, 22 Mar 2020 11:37:09 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:50326 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbgCVPhI (ORCPT ); Sun, 22 Mar 2020 11:37:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=2onCqIcc3JF4Rkct2eyxjN9xBx7pmz24s+lxRPXhiYE=; b=b2S0ec00q/gcNeKzWmh7n+6pBZ 9BcqShjiDxzxQ/Rzd7NsHIU/63eAVMfgE2hfC/4d7RkQ47XV1FVC4a8sBjYWHRoI9asopjwoNMvGK RvLUC9v+z0aBaPDorkmnE5i7KTrQskPBa9m5dTaNRpecX7eAM/qVVUgfXS5W3t3Tv5gQ=; Received: from andrew by vps0.lunn.ch with local (Exim 4.93) (envelope-from ) id 1jG2ep-0000Zh-Vk; Sun, 22 Mar 2020 16:36:59 +0100 Date: Sun, 22 Mar 2020 16:36:59 +0100 From: Andrew Lunn To: Dejin Zheng Cc: f.fainelli@gmail.com, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, gregkh@linuxfoundation.org, broonie@kernel.org, alexios.zavras@intel.com, tglx@linutronix.de, mchehab+samsung@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v4 6/9] net: phy: marvell10g: use phy_read_mmd_poll_timeout() to simplify the code Message-ID: <20200322153659.GO11481@lunn.ch> References: <20200322065555.17742-1-zhengdejin5@gmail.com> <20200322065555.17742-7-zhengdejin5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200322065555.17742-7-zhengdejin5@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > --- a/drivers/net/phy/marvell10g.c > +++ b/drivers/net/phy/marvell10g.c > @@ -241,22 +241,17 @@ static int mv3310_power_up(struct phy_device *phydev) > > static int mv3310_reset(struct phy_device *phydev, u32 unit) > { > - int retries, val, err; > + int val, err; > > err = phy_modify_mmd(phydev, MDIO_MMD_PCS, unit + MDIO_CTRL1, > MDIO_CTRL1_RESET, MDIO_CTRL1_RESET); > if (err < 0) > return err; > > - retries = 20; > - do { > - msleep(5); > - val = phy_read_mmd(phydev, MDIO_MMD_PCS, unit + MDIO_CTRL1); > - if (val < 0) > - return val; > - } while (val & MDIO_CTRL1_RESET && --retries); This is another example of the sleep happening first. To keep the code more similar, you probably should add an msleep(5) before calling phy_read_mmd_poll_timeout(). Andrew