Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2344267ybb; Sat, 21 Mar 2020 19:51:54 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt3Ut4ff9v3Nvaer+2xjxF78EFST0/YU4NKrpFJX4FA2z6ImLBOJz8G/HMoeTn5qAK5tA69 X-Received: by 2002:aca:3ad7:: with SMTP id h206mr11898774oia.169.1584845514579; Sat, 21 Mar 2020 19:51:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584845514; cv=none; d=google.com; s=arc-20160816; b=KxXsWff7JhrBT+gZ1m45MZ+m58NIx/AirMLuHZJsZ66KKYk93Bhj1qhTkHXhsS1YM1 DkXqFPG/pSkue8f+ouQO/lzMjeWP6EuiQuGXpAJ67hESjeJGjVQIRuBok5KGzDNXfxNp +0rvpBlL52qDnitikU9eenEce8MG4cu1otDYAeVQhABcb9iB+U6f47MuqFuriMn/s87t J962Tccj+Xc3tETuv4bh9nyL5xsV0OPXE2iV3G8SF38sTD6b279r81LIpw87O7q9x2IV a6QmO7AjKEB6rotRUvDt+0JhH8k5IHVPWpCvDLrj/KYUm+DGHv8rSLnQ4gBPK7N8nPAZ nsqA== 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=i03boqnLAKIXm7IsxoZ9x9d/wqr8Z5h4zwehOBg1CH8=; b=MjAWuNiMHScC8z/32Usq0WgAnDwNeZfcl4PUfhHaucMpL3LgLDQPOFe1MdWUUX6G/j l1lF1pVYaZJmmk+28UELnWszJKfelvb/eZY/+ZUbEqJFiNDQQISAJeOS03tR71jNIxZc 3RQ0CUOMKi38oaepaur3jLj1I+0OrlG3rUniSSlvGyM7h6mVVgE1fxk51INjNvLwp7w/ aVmK8n2j9RfreD0Uhz1uUhQbSEB/3Ovv960XKZJYQmryEOuDxLrtFAwAyuebAdjp7nRo 51lcE2+Nay7fChQ+KS2tnl61xNi94y52WbLi12i/pYXOMdodhDo/jSjJjzNLXfOXwBj1 chJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JJF4wN28; 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 y123si5704831oia.141.2020.03.21.19.51.42; Sat, 21 Mar 2020 19:51: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=pass header.i=@gmail.com header.s=20161025 header.b=JJF4wN28; 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 S1728446AbgCVCtq (ORCPT + 99 others); Sat, 21 Mar 2020 22:49:46 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44710 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728423AbgCVCtm (ORCPT ); Sat, 21 Mar 2020 22:49:42 -0400 Received: by mail-pf1-f193.google.com with SMTP id b72so5574573pfb.11; Sat, 21 Mar 2020 19:49:41 -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=i03boqnLAKIXm7IsxoZ9x9d/wqr8Z5h4zwehOBg1CH8=; b=JJF4wN28ZoiIMynq1XCF6HGHjQ0iAFU6VkAZA0q9p7t5k8SA9vnknlnM2gYaSd/M6Q PMgLTv/Agdb3WWTqpGWx1L/8FaDkcUftRIV4dEo4gB8WU8asnqEBkeissdWSAAA7NNIF X4TC14jcv0OgntonX/0FSFw80yXeLVO3wfNlfm4oQEjvdl7EVQDSnUDJZVvhT7MHDj7L 4jzdVK4vWufh2fOqHE85V5xTh4tY1DhOwyammziLPZt2rZ78rePwlbD54zLxhcC5h6Qo f8Z0MkFxJBQ4dONz56wIgyondFqKQuYjTOLvoxJ4FKZ0RKXsAFQN7YqfOX2nMfkEX1yh BTQA== 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=i03boqnLAKIXm7IsxoZ9x9d/wqr8Z5h4zwehOBg1CH8=; b=VZnpaauyJulsMArkXHIcK507Qb4txTp0j4H0sK6dJGOviSyDrA4Kl/RV0hApQgOHIz eY1m+4R8IxminmxG0qykefxv0OS774N6clQ52bBlDhmYpOtfIMhUNwc4MM3dcPjghvJl WpeC68pE2i5PZmiI5t4PFyiPdQWrmzDx76W9U/3aufHwx7TEcTyQ8IGYW/2t3OyKweUs WOSJxkRBD2KxyjpWYvFd0AFw2IVQ5l9ox5KJnC7L+BfdQeESDTLwVsfASz61sCqzUbxf Ow32MA5pnHNQb1kXOqYSZsxFRJWwrIV+xjSTbYREeyVxgP13KEY/Rz470PJu+lUGRAXR tOwQ== X-Gm-Message-State: ANhLgQ3qVr246KllT56/xxTrkGMwVnQwki9YsEFdGlNNUvQ4sb3/6k39 xPnsROvf5NXqr0elWwRV56c= X-Received: by 2002:a63:334a:: with SMTP id z71mr16454335pgz.305.1584845380977; Sat, 21 Mar 2020 19:49:40 -0700 (PDT) Received: from localhost ([216.24.188.11]) by smtp.gmail.com with ESMTPSA id p4sm9502186pfg.163.2020.03.21.19.49.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Mar 2020 19:49:40 -0700 (PDT) From: Dejin Zheng To: andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, allison@lohutok.net, tglx@linutronix.de, gregkh@linuxfoundation.org, mchehab+samsung@kernel.org, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dejin Zheng Subject: [PATCH net-next v3 5/7] net: phy: aquantia: use phy_read_mmd_poll_timeout() to simplify the code Date: Sun, 22 Mar 2020 10:48:32 +0800 Message-Id: <20200322024834.31402-6-zhengdejin5@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200322024834.31402-1-zhengdejin5@gmail.com> References: <20200322024834.31402-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 the code in aqr107_wait_reset_complete() function. Signed-off-by: Dejin Zheng --- 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