Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2920698ybb; Sun, 22 Mar 2020 10:52:19 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtypUS2BjbXIysM2qAHkOxrzR3InkkoySrE5z9lavWjMWwb/QzlheN8Xk7DOHK+waARNS4N X-Received: by 2002:aca:b605:: with SMTP id g5mr14652879oif.159.1584899539608; Sun, 22 Mar 2020 10:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584899539; cv=none; d=google.com; s=arc-20160816; b=Ox0jRKkIWqk0JIXE52G9mb160lT6oCrkQE5j+rzMnchylniKJniBBCMZEfXgd7MDi4 gSJ6hp1UIuzI0KDjB7IdWg+eGtTtKwqjXL+sHa9ol7kTIoWTMjiXRJtHkk3YSH8vwpNE dpz1QQ9LnIW1E1z0iku+rkAJVxe0kq8O7AxUDmKDoFQ9TV4mX6k9B9/BPcqWBU83nGFb yKBwkgFhAgk8EwPrUZwdE5O9mMyv0ojGbg5A3jd9x883j4MER6d3xMEHW7p0kxZNQDHl YTiLOSfzbaBIBzEGXxcWy/i64Uj1kdf3Wut4TCMM7tEuh9GXJIpS9d/hDI49ApmJKl3U 0m6g== 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=n2XYXavZMeYoAHc5mBv6tNDgFoTw76pNiSWNX3EEa9Q=; b=gYstxaZmIUx1t4ROOuLQiyyCJXTlhNeVld86d71mHFi7ZE+Q69EPvVeHuieT4zdWQU e24OV5eCVa6QXfijtX2qGu6dh/JIKE00quhEW48PkH9JfopC3W2Bx7YMC6CikPfSUvpC ZYAxwbf2iNkFsSx0b4KNmOHg9/uRzxBUrXywuYclC3BW804mmmwvpCdZJnQH+J3mF8lg 4y2OWWaJg0oSFfPA8jHNpQJG+79+cLt7/8pEQRvTnCYlBDM3qWRBn9r9FySU6eiNp2Fc VppjNL2Rtxgt1f9lIHQ1ezWsWQW85XLz/JDueUusxhbhX43tqSfZrJt+E/jObbJ1Qbtx AmJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pcxm9UqZ; 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 x202si5465821oix.199.2020.03.22.10.52.07; Sun, 22 Mar 2020 10:52:19 -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=pcxm9UqZ; 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 S1727107AbgCVRuR (ORCPT + 99 others); Sun, 22 Mar 2020 13:50:17 -0400 Received: from mail-pj1-f66.google.com ([209.85.216.66]:36510 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726810AbgCVRuN (ORCPT ); Sun, 22 Mar 2020 13:50:13 -0400 Received: by mail-pj1-f66.google.com with SMTP id nu11so4956397pjb.1; Sun, 22 Mar 2020 10:50:12 -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=n2XYXavZMeYoAHc5mBv6tNDgFoTw76pNiSWNX3EEa9Q=; b=pcxm9UqZ/HAL0OwPYcs8XshKDVUzxHE5vqSAML7ZGwDWBL87tX9LzqHPxf0Vr9ROoP fAsu/S9YFGMA2SkRtG68jKO1/HLH76jlrqZws/qJM5AI1PnjFXYLGdd9QahqogxEHgAt i8Uzzb2ffn35pW1gFKRQNkoe9jIYY4t6d0d07+a7wNK8hoscfFFmnSVkbY9gv1fdJ1Y8 vMO0skSFZ/HJnd+/S4PdIiPV/YSUSffvpNfYFXsuxgW6ocqKUEOaiR/k79Oi42VQyP2Y Q93DMXy7n3V+Kv3RrcTZaZViZDsRHRRaGx55jufJwy9vPIXMSMqQ2pkFDpCY/fRGytmV F0iA== 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=n2XYXavZMeYoAHc5mBv6tNDgFoTw76pNiSWNX3EEa9Q=; b=IuvIB8dkMoy3ivp0cLdfHl6nOZyWlrT4Oah9Yb4wn0Ym4Yn+4ePiotG/L9OhUOJUuG Pg/ew2jmptsKxZV0JIemLWDA2h7D6HrWuQ5vtvzZKEhwC8ecmSyuPfB8u24V4bWbLTx2 8wD1mo0/W52rJw6kED4bMoO1/KcNBL2mY0MMv4Ht/a6ICHB+Agy0H+toHLkUq8h+GCPN mxceKJZuO0n6FLWP8tGJubuVM5NZNoasSbDwi/I/iPmlV87ut61F4izoKemT3dN9ZJQJ Df6bbEZ7VUZ0LtWL3Q0S/Zt4gbd8ZSntOBDAUKj9iKdEbmSLsc40ZeCIWAX6HQIRm3f+ Cpvw== X-Gm-Message-State: ANhLgQ3KAUIqX8cIlCPnTH6nZKhLGxaBGEkehcwnEzR99JjkRNAUOGcw q6Wg1x8JT9MBJYYlHXn6IzA= X-Received: by 2002:a17:90a:8806:: with SMTP id s6mr21311160pjn.141.1584899412228; Sun, 22 Mar 2020 10:50:12 -0700 (PDT) Received: from localhost (216.24.188.11.16clouds.com. [216.24.188.11]) by smtp.gmail.com with ESMTPSA id nk12sm1366666pjb.41.2020.03.22.10.50.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Mar 2020 10:50:11 -0700 (PDT) From: Dejin Zheng To: andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, mchehab+samsung@kernel.org, corbet@lwn.net, gregkh@linuxfoundation.org, broonie@kernel.org, tglx@linutronix.de, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dejin Zheng Subject: [PATCH net-next v5 05/10] net: phy: aquantia: use phy_read_mmd_poll_timeout() to simplify the code Date: Mon, 23 Mar 2020 01:49:38 +0800 Message-Id: <20200322174943.26332-6-zhengdejin5@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200322174943.26332-1-zhengdejin5@gmail.com> References: <20200322174943.26332-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. Reviewed-by: Andrew Lunn Signed-off-by: Dejin Zheng --- v4 -> v5: - no changed 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