Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1199657lqb; Thu, 30 May 2024 03:25:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYcBeKuYw4PVM0jGlyyb80kjL01ddgNjF4VnxRt0P68tnDDwGKBfmyYqq6Iiac4TLmdpkWQl2EEQN4F3KWyya9CaTRyqt7gmuK1rrm5A== X-Google-Smtp-Source: AGHT+IHNwSYZab1Vv3X/XYE1SYOqmKkWIFbWePMlGJGPxl0jm2pBWt63rywN4dOvB6Hk4GJ91Kwo X-Received: by 2002:a05:6870:390c:b0:250:129a:d0ef with SMTP id 586e51a60fabf-25060d18f04mr1777103fac.36.1717064754899; Thu, 30 May 2024 03:25:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717064754; cv=pass; d=google.com; s=arc-20160816; b=gGV0Dtze9FEWtsPcQvM2A6WA4vdn+iueuGiivK8vlvT3+CmkFfKDp52yy65c3U0M7H yp2EXtmTm0Esi84iz5AZu4VUVxCMeFjhR/Q0XlGz56a4QBmwqX2lbub3uQGDp+Bv7gZ4 sTeDDi+zGgyGcK1hyXOyJt5AW7IeeAv2rxeGha5g1Nn2pBJ/GOqZXMFOvCnG9kmkVusp Enbi36NkzLtqGVkCG6w7uicRPXCxUn3QPC/1/zcOp0zGvvql2w3uqKZdY0Pq8S67/peN VBIU71941KToVSA3jVEg8UK8MllJI8tyaPKOXYJGJshkCnG/RyjJMrLbuqq4WmX1GLbE lA9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=J8pf6YD6PYPOxhuxnDNwdGpGAeMHzezf+cUCwL+fh0o=; fh=xZWgcigVLRj7l9WT5wQbagScbcgrVpl4CAe9fw6OkI4=; b=slce9Xm17Is097iZGua1WiGp5uZBvnFGgD8cUfvU2/vfsmYzWPvfgp9gcf+1zBhiGA nf7oJim+m6ld8kL8D8HDc9vL/x5waVRn+yoobMa4mg1kihJLDW++kcIMCuobYj1gAF6m 0wzmyxSyuxCcWSokeipO+F+ZuG8jKwcwmFYG7c3ZTSUiqr0WGS06v4E3ftiw97/ptuYh dFH8c+XO3UMcWGghPSd3SSZNCME91u+WxxvBqd+hHfZdo6EtNqKbqZplrayhMoWkZEk5 M0NJLbKFOVxtNh/33UZ9gwn9wn1cGc8GJJ7SrV8xHb0XIPIhA871svBD2K5C8aWYclxu jDug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=aWhB0q8F; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-195260-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-7022b04a573si108993b3a.36.2024.05.30.03.25.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 03:25:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195260-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=aWhB0q8F; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-195260-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E215C2831DF for ; Thu, 30 May 2024 10:25:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC24217C7B9; Thu, 30 May 2024 10:24:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="aWhB0q8F" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDD97176AAE; Thu, 30 May 2024 10:24:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717064655; cv=none; b=Btm+RTJwfkQrmanek3mQ5Ym+SLb9+Eeb4PSV9Zo6XAT3AI95EyVRRE8wJWTxnT0gxXSg3YXprspGXYR6mOabiEGStoFXxgxTEglZS/rcDEJjRMCe2ZAQb38EQLVctj3VL5txIySkId5z+hSBCB7UeqFZFWB0bjzz3VVIX5cSIU8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717064655; c=relaxed/simple; bh=HeUGkiaEEtwv7kBlE3o/lEprM8J67nEM4mfW/LV/zzw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AM0cNrFK6NkodCW5C3PEOT3rgcJiBCnXGxpombFFkVJzad9DVj4d83S3/+62csUzQ7+x3KESMiTGWkLA6nI+CzZAUnn65K4j1q+3ppSM8nddzVb1hfo5lTpcONRkOgaHfnGh0lZ94xvS2TjSz1o23qsYP68fHQhzh20oa3YIQXA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=aWhB0q8F; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: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=J8pf6YD6PYPOxhuxnDNwdGpGAeMHzezf+cUCwL+fh0o=; b=aWhB0q8FGQSlqKpGjJIcrnT3F7 Zx/XgjYvWTYLMXoHUeY8mv0PKp85aDgd8vJDRO0Fk1T9t9mc409SY5JpH350Izgo+CFy8ePIF4yDU Vl0Dpi4nCJNm3K1qIk78HHqkPICKrFp9IHwh65eynTxZk1R6AoSxnaqUXmvEVehq4klMP7DZU6MWx N9iwij8balZT7Ly1MLxQq+TnRIYoXkQaQ9GjC9FyXA9pq9wVsXMotY8zUmMAfvR/1dj/zQ3udRX3q C5b2WwFnaS2DyuTgXgamN/N8sjbUnING7J9ih0sVJkqNhV5wsGy5UHGMG7gHU5852NdzAu7IQZXu2 UmqcMNbg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:40714) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sCcwo-0007FG-2a; Thu, 30 May 2024 11:23:50 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sCcwn-00054M-LC; Thu, 30 May 2024 11:23:49 +0100 Date: Thu, 30 May 2024 11:23:49 +0100 From: "Russell King (Oracle)" To: Sky Huang Cc: Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Daniel Golle , Qingfang Deng , Matthias Brugger , AngeloGioacchino Del Regno , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Steven Liu Subject: Re: [PATCH net-next v5 4/5] net: phy: mediatek: Extend 1G TX/RX link pulse time Message-ID: References: <20240530034844.11176-1-SkyLake.Huang@mediatek.com> <20240530034844.11176-5-SkyLake.Huang@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240530034844.11176-5-SkyLake.Huang@mediatek.com> Sender: Russell King (Oracle) Hi, A few suggestions: On Thu, May 30, 2024 at 11:48:43AM +0800, Sky Huang wrote: > +static int extend_an_new_lp_cnt_limit(struct phy_device *phydev) > +{ > + int mmd_read_ret; > + u32 reg_val; > + int timeout; > + > + timeout = read_poll_timeout(mmd_read_ret = phy_read_mmd, reg_val, > + (mmd_read_ret < 0) || reg_val & MTK_PHY_FINAL_SPEED_1000, > + 10000, 1000000, false, phydev, > + MDIO_MMD_VEND1, MTK_PHY_LINK_STATUS_MISC); timeout = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, MTK_PHY_LINK_STATUS_MISC, reg_val, reg_val & MTK_PHY_FINAL_SPEED_1000, 10000, 1000000, false); > + if (mmd_read_ret < 0) > + return mmd_read_ret; So, what if the poll times out (timeout == -ETIMEDOUT) ? If you want to ignore that, then: if (timeout < 0 && timeout != -ETIMEDOUT) return timeout; > +int mtk_gphy_cl22_read_status(struct phy_device *phydev) > +{ > + int ret; > + > + ret = genphy_read_status(phydev); > + if (ret) > + return ret; > + > + if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete) { > + ret = phy_read(phydev, MII_CTRL1000); > + if ((ret & ADVERTISE_1000FULL) || (ret & ADVERTISE_1000HALF)) { This is equivalent to: if (ret & (ADVERTISE_1000FULL | ADVERTISE_1000HALF)) { which is easier to read. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!