Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2579080rwi; Fri, 21 Oct 2022 05:39:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hdTMKIzwmW9483ZldzQiDiEmg638QYJF/Lu/7BABOcHcbSa+s61Vjd1ycNCJqvncxtmAU X-Received: by 2002:a17:90b:4d90:b0:20d:7f17:5983 with SMTP id oj16-20020a17090b4d9000b0020d7f175983mr58535944pjb.197.1666355994530; Fri, 21 Oct 2022 05:39:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666355994; cv=none; d=google.com; s=arc-20160816; b=JB96hLN2wzdt9L/0ctoJ4vsPbFM54f8SLSQkGW2fZXY5Dha+vr8sDaz7SWJ02MHvpD BW58+c2d8ok8SPzY1K/+jBBu3atlpyCVD1hr9e6O+CD7NqUNC6hENHfm82O7du2IivSc dDXAe6x7BYaZHgp7NL4xI+5rYahJdxNRmiNZScpmb3Q3rLcjXuDeCH0+SzLrEVeWKCm9 MrHTYzNM621jYJunWjQs6l9oOxOq29F0G1/3AGBd58kC9CXrDBqIWQBa5sJMIt2Z/NtQ 5lyVG7qsRvDejoRqnbCUTnoV963WQkcXCBU5R1sfS0Hp0KrfFh5CEQe7kiuEApxSlXW1 wZHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ybzj+4INELQ+p10Y7K/jRSkq7s5IXHsyCClX4FS/l14=; b=blp7clWn/RbDjXniX1ZXiSwW2m8xmSuBo15wii2vQJM+CcgZF/AMyCDGHzTabQMmU8 evfh/TyToPZ771p4K04W/K99yE6TL/lnEnZ4/6hlCsLIex/N2cIUSYAzirNnzBS9xB7f hVxAhPYrqZPKUaRPyNnBFvEBapeoYRDNoWjojgbdpxofO1o2dAMvcVc0ZjtVTQoFc9ON NAYe6qL8zKije8iXZwtkChSJBnwwF/NdUbCPE+stb760p9w4c5mS9q63Br9Kp90C8UfD Hz9iN00MwuWjPo4RHkAGo61gfGg0DJcjDTwvduNqLoXrDwKtHdnHdV/rglOAr38Y+TJ/ 0Kqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=F2+zcW8N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e29-20020a056a0000dd00b00565ba4c5001si25319708pfj.252.2022.10.21.05.39.42; Fri, 21 Oct 2022 05:39:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=F2+zcW8N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbiJULlB (ORCPT + 99 others); Fri, 21 Oct 2022 07:41:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230156AbiJULlA (ORCPT ); Fri, 21 Oct 2022 07:41:00 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 165931E8B8A; Fri, 21 Oct 2022 04:40:56 -0700 (PDT) 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=ybzj+4INELQ+p10Y7K/jRSkq7s5IXHsyCClX4FS/l14=; b=F2+zcW8NX3aYgLlejVS2joun3r cnmlcNvTL3nMYgQY7GkQpFApFoz44GGlQWZHwEkSi95aUNkzJBxNSGCPhORGM3aE751T/TtnrgiEn RwFzIcPrbWy2phovgkzgpy5TaWRvz5bTyCsQSTBundZzGkYHA1sJIFQCoO5nFdfqoHi5p7T+jZAWu KHEsmUF7hRWuG/Nu+8gga/kd9/B4ncS1S3ElH2yqHWLbRWWtCnJsZPjwFtVJuvac3McqEnZsEhwK1 8K6092yiN3hd9Unz8UitPmn2i63TD2xt1eLJPPUGP/XD8OlrtLuiyq5rO5X1mZvLlchZSHkc7v28V xGc2YRbg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34860) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1olqOT-00008I-FO; Fri, 21 Oct 2022 12:40:53 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1olqOR-00048B-B4; Fri, 21 Oct 2022 12:40:51 +0100 Date: Fri, 21 Oct 2022 12:40:51 +0100 From: "Russell King (Oracle)" To: Raju Lakkaraju Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org, lxu@maxlinear.com, hkallweit1@gmail.com, pabeni@redhat.com, edumazet@google.com, UNGLinuxDriver@microchip.com, andrew@lunn.ch, Ian.Saturley@microchip.com Subject: Re: [PATCH net-next] net: phy: mxl-gpy: Add PHY Auto/MDI/MDI-X set driver for GPY211 chips Message-ID: References: <20221021100305.6576-1-Raju.Lakkaraju@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221021100305.6576-1-Raju.Lakkaraju@microchip.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Oct 21, 2022 at 03:33:05PM +0530, Raju Lakkaraju wrote: > @@ -370,6 +415,38 @@ static int gpy_config_aneg(struct phy_device *phydev) > VSPEC1_SGMII_CTRL_ANRS, VSPEC1_SGMII_CTRL_ANRS); > } > > +static void gpy_update_mdix(struct phy_device *phydev) > +{ > + int ret; > + > + ret = phy_read(phydev, PHY_CTL1); > + if (ret < 0) { > + phydev_err(phydev, "Error: MDIO register access failed: %d\n", > + ret); > + return; > + } > + > + if (ret & PHY_CTL1_AMDIX) > + phydev->mdix_ctrl = ETH_TP_MDI_AUTO; > + else > + if (ret & PHY_CTL1_MDICD || ret & PHY_CTL1_MDIAB) > + phydev->mdix_ctrl = ETH_TP_MDI_X; > + else > + phydev->mdix_ctrl = ETH_TP_MDI; I think this would be better formatted as: if (...) ... else if (...) ... else ... We don't indent unless there's braces, and if there's braces, coding style advises braces on both sides of the "else". So, much better to use the formatting I suggest above. Apart from that, nothing stands out as being wrong in this patch. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!