Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2856651ybb; Sun, 22 Mar 2020 09:19:16 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuxzMIPOmEC5Vsm7e1W6X2iPVSUkRu7xF8xTe//x5+erk2jbCgK5dDB6/yiLiDjj3QzvMY+ X-Received: by 2002:a05:6808:16:: with SMTP id u22mr14331539oic.127.1584893955962; Sun, 22 Mar 2020 09:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584893955; cv=none; d=google.com; s=arc-20160816; b=T9mIwMQyzXrOruyU2r/cBsQC/mbOhR4BHxMJiioc9Paf9/4/AsbiqikDd6q+zL5V2p oGsHEUCqrN4eZded1YSCDDKmuyUj8upZZBj2WEmDaacnoeVp68GeKrBCWuHX46kd8urC UQeaYiCzXfhEUx+4qxGJDRNDhTMU2Kdb1xM0bbt2e62WcYyMmRYdEp1ycmHdcG2T1u6x DQtpkuauJ880m0WRqi90IzD4WZ7NB31qXAvTNmTpwXoP0Pd28zN9LLHEqZJefX2fJAIN xK/1cDl0KPXAjnUIbENBgYVKFBp0eaf64EDDgpvvik5OW3mDMuxOAAunYx4xlDct9+dA /g8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZgXf5QsLU8moUeFbGruEqUCy/5/OEI1y7w06IrP82bU=; b=c4LjDcxXKanvCfG2k6xIBhirm1qYz9bedtKYJBzQcSEa0bcD6C3osTAhSje5jbEtJa ixFP2xfc9DrRRf4gagnb2zbOfxaekgYZsOdi3fcSeFCzEdOzqicGixjZlRR1rBKsz12H LG9Qsiz1XJpTuuFX7UHpcbzNtQkiiavcK3/IsWrM50iJ+/FL9cOxJN9k8LRKW10wuCWg HmqkcQ/x0nDQBTzeR6FnsUSNoTPi1G/KFS7zHOwbDDi1tZ+k/GEriSXNO68Y2IfCpP+Z 5rwUraIv19b71qulWsVtvGLzUBUORw7IBmpjlvtIJoAYQfheOdLZ2cqFcT3HUrEJhExF 5EZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RtLaXqzw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u9si6526124oia.62.2020.03.22.09.19.03; Sun, 22 Mar 2020 09:19:15 -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=pass header.i=@gmail.com header.s=20161025 header.b=RtLaXqzw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726946AbgCVQSW (ORCPT + 99 others); Sun, 22 Mar 2020 12:18:22 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39613 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726502AbgCVQSV (ORCPT ); Sun, 22 Mar 2020 12:18:21 -0400 Received: by mail-pg1-f195.google.com with SMTP id b22so5863467pgb.6; Sun, 22 Mar 2020 09:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZgXf5QsLU8moUeFbGruEqUCy/5/OEI1y7w06IrP82bU=; b=RtLaXqzwZI9+/JGvMRZAHdpZi8i8pV0EDDKeoyZeKUR7X0F+Y1CGzGNtCwdlSZ9zFs rparodvlt1pi2kMcwA5cPjdY0AcEzgJATpDsoqFG4THrRz1v+uu8xSMMQeio5I//Kj/q +l2BnGahK6KoX+vGIsJXyNFdOZez5GO8F5bjNesohBbplmNsbHabWf9+u14bZ4PcJFWL HcFmxfGwB15OdcFUPVxtmFDLAamB/tx7MvVaWb+mORSFuhmEcO3ZX4Pslz17xzB1TerA Hb8WBZdzu68ADjptzoZgwSdD2X//RkO1YwTcPekPY+BuRd8y04QJWJLnIySslbUU6EEG 7u0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZgXf5QsLU8moUeFbGruEqUCy/5/OEI1y7w06IrP82bU=; b=PjUDgJkjIidbUvKY3QTyG+4l+fkSpP11DpvL5Y2P3lsOZ5/+z5ZdTCq4CfrQ5JpG6J 12zSEwBTnVzRQele+7HuSGJiqg3R5/3z/CeuxnuN2gmjSlkWLD2INnaFcjPxAHlPao25 Ptj7Qe2TWcWArtvGsH7pcBP5ZOmOmfQDNqZfBpfOa4zwn8RvAtsfGJLmc23MJJA2O4sM A6Q0qkl/qfkXIZa5YO/ym9HuFMxlSLsGf2zhT6rmnDp+4vJyE6a/VIy5vAP8eDgu7Zgl BiaWXYJUzLv7zzz5q2V4F5dMgGOjC9Mpeh5OapMJG0sucRdoHSIADKPrEAG+VGBJOLz5 rCIg== X-Gm-Message-State: ANhLgQ2imhliaLRtci4jyEfKhmjSBaoXAIrnhSfRdTpDH1TeD8TfKxHY +rtbCQbZTQx/6F6vzfBX4RU= X-Received: by 2002:a63:1e57:: with SMTP id p23mr18544525pgm.316.1584893899795; Sun, 22 Mar 2020 09:18:19 -0700 (PDT) Received: from localhost (216.24.188.11.16clouds.com. [216.24.188.11]) by smtp.gmail.com with ESMTPSA id mq18sm10682596pjb.6.2020.03.22.09.18.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Mar 2020 09:18:19 -0700 (PDT) Date: Mon, 23 Mar 2020 00:18:14 +0800 From: Dejin Zheng To: Andrew Lunn 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: <20200322161814.GA20189@nuc8i5> References: <20200322065555.17742-1-zhengdejin5@gmail.com> <20200322065555.17742-7-zhengdejin5@gmail.com> <20200322153659.GO11481@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200322153659.GO11481@lunn.ch> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 22, 2020 at 04:36:59PM +0100, Andrew Lunn wrote: > > --- 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 Andrew, you're right, do it right away. Thank you for helping me so patiently!