Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2477177ybb; Sat, 21 Mar 2020 23:57:15 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsoBDg+6orYwjNBj/tfChMZ4GsknYH3Jw9+pTPZl+XSiczowxTnc9emO9OfgNmyfp3AUrNw X-Received: by 2002:aca:5444:: with SMTP id i65mr6852936oib.101.1584860235249; Sat, 21 Mar 2020 23:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584860235; cv=none; d=google.com; s=arc-20160816; b=gHJloI/sQyb5BS8azR6Xx67O8c5WthBVtQqp6w0q78vKtcA6NJ8CMmaRgVN9d1NE3M vo2SV63SLqjF3rpthfqmJRtcOJ+ui72QdTSSMwSVmLiYlo0tZVVQRCvx+r6Bqx70gDbX KrkIWvpvQRajBb1ur8U9CMzm0RLLOd6QXh5m54jmfnQbKgGNacz7c5JinvUSxnXP5yjH 70dNYDp19GVn88u+ql1N7Sd1s4RhkVtmRQMk/9iH4gxgL8aesOGmxLISc+L45bTYOda9 WYJcovFhcuf0YQD0gMCChcRUdzEOCJDgyABKV2lAfTBZHlqFagevJbtYyAuupVaYtTXT S4BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=v/Y9MRgSestXRv5aFL8kUofLFxL8S+t01EkAKu3WkqU=; b=JPdH8ODbrFGnwbp0o/6jsql1xsB6RzlY7Ul+smBfwI0i6IL8IzzTOEWe9r24FwfWCF UyRZLeeeWrDqd9A7shLIJwKBAW9eTfTk38DfHHBz0KIM1a8HU5Bwp2jMXjYhF1Udtci5 TgNRccbVdOPSVqPv/xw0XajlU/T7NlEpclU2hPb9UJHUcixg3UThktm+SadJW1JCi8TW rNUJkS6jwhlLm+ZkVUstoQV6pMg6NKp8k5CVpcrTJ4Wa+ALiIxgkarm/M5O3jG7Dr/48 FURYbgKDOMUM5yHLgw22Q3jm+wsIIi9iub+71TrGfs7JlC68GjuBEtlwSLFbDZA9fPkm tzQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZwwUB76Q; 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 d8si6301010oti.306.2020.03.21.23.57.03; Sat, 21 Mar 2020 23:57: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=ZwwUB76Q; 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 S1727008AbgCVG41 (ORCPT + 99 others); Sun, 22 Mar 2020 02:56:27 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:32846 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbgCVG40 (ORCPT ); Sun, 22 Mar 2020 02:56:26 -0400 Received: by mail-pg1-f195.google.com with SMTP id d17so4849078pgo.0; Sat, 21 Mar 2020 23:56:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v/Y9MRgSestXRv5aFL8kUofLFxL8S+t01EkAKu3WkqU=; b=ZwwUB76QnbPnqF3lxT+AD2ijN0eEERaXZ23yMNZ613vZZyimndIs36zNTR9ppXPwVp ggiJ2oZFPyadu+b2u4zhft5jzL8Ln5WAQkMhIYAEeh/cFqUjL42Vr+CY5bUs6LjLvZu8 UZjRX4OUJ1E/9Zwu4DUl/k6oVJR3cyuwxqjeNtqjLX+egsLxS7ilRtdktiCBfEM+wGok IiBrA1svG0mu2NblxkChTXhZPzWM3HX9Buvn3cS0yJc1sntzcH2ULkOSGmyXTKPG55d5 htyCglWusroRxZcky49BJNZuJ7r6DcFMCvtYQYhPXJqZrxVe/lQZ3qDa48QLaCtKH91Z X/1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v/Y9MRgSestXRv5aFL8kUofLFxL8S+t01EkAKu3WkqU=; b=kh5mviPlJNFJgdj4R3o1z59F61H1lQeDeTqmByWFXui4omq1QX5kiMB5jWRn999BKe CWwzhHkrOC+22ea5z0/aNoq9ffAWwTZV3X0yMnCYL0Ytvf6ZTTSkOUZBcAr4RTHMmKvn LvAaew2NxMf9aAoH4uXhl0EFZx7nx4lvVY5C8KMBDJRCtxMGLjksvS8tm7KzJYwkW4J5 J7D4WjJgqrM2TSdAuBhsLkGCEWqaUoPymNCWvDANLjH1kadN2VhmmOLBekJXWFtoI9ST sxtkoKWiakR9f5Co8CgkEi5yn6wXJKC4ucKAKj6xJAcUEeYMxvtMTnpEim0gt+Ibnh0f c1Dw== X-Gm-Message-State: ANhLgQ2mnhrLDcLVytg7YRDt7mLye8WxzEwZK9TvLZhvIciLdLD31A1u XtaVKfw5bbuAgunMn6ZsE2Y= X-Received: by 2002:a63:9c4:: with SMTP id 187mr16010147pgj.389.1584860183744; Sat, 21 Mar 2020 23:56:23 -0700 (PDT) Received: from localhost (216.24.188.11.16clouds.com. [216.24.188.11]) by smtp.gmail.com with ESMTPSA id x4sm390612pfi.202.2020.03.21.23.56.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Mar 2020 23:56:23 -0700 (PDT) From: Dejin Zheng To: andrew@lunn.ch, 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 Cc: linux-kernel@vger.kernel.org, Dejin Zheng Subject: [PATCH net-next v4 5/9] net: phy: aquantia: use phy_read_mmd_poll_timeout() to simplify the code Date: Sun, 22 Mar 2020 14:55:51 +0800 Message-Id: <20200322065555.17742-6-zhengdejin5@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200322065555.17742-1-zhengdejin5@gmail.com> References: <20200322065555.17742-1-zhengdejin5@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org use phy_read_mmd_poll_timeout() to replace the poll codes for simplify aqr107_wait_reset_complete() function. Signed-off-by: Dejin Zheng --- v3 -> v4: - no changed v2 -> v3: - adapt to it after modifying the parameter order of the newly added function v1 -> v2: - remove the handle of phy_read_mmd's return error. drivers/net/phy/aquantia_main.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c index 31927b2c7d5a..db3e20938729 100644 --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c @@ -451,16 +451,11 @@ static int aqr107_set_tunable(struct phy_device *phydev, */ static int aqr107_wait_reset_complete(struct phy_device *phydev) { - int val, retries = 100; - - do { - val = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_GLOBAL_FW_ID); - if (val < 0) - return val; - msleep(20); - } while (!val && --retries); + int val; - return val ? 0 : -ETIMEDOUT; + return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, + VEND1_GLOBAL_FW_ID, val, + val != 0, 20000, 2000000); } static void aqr107_chip_info(struct phy_device *phydev) -- 2.25.0