Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp90832ybl; Fri, 9 Aug 2019 03:01:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYOFPMXbXLOrx5FBAS62IRXIP5zLDlL5hhA2fEJd7K3Ol/Y5L16RYPuggp4ngPj0/T5vIY X-Received: by 2002:a62:6d84:: with SMTP id i126mr20055902pfc.129.1565344914467; Fri, 09 Aug 2019 03:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565344914; cv=none; d=google.com; s=arc-20160816; b=OA3kSWfEcJTPrwkEgZ6cj5zVN/yOX/Blaa+NNGMEQLtE5NQyjjdEou7rq/EVwQjgPc 8WAzDyM0zvU1hJ1CIiZl+AYWF6Ngr2dOwdPwxzRJNzBFJioVs+s8DE9/zHmxqwYC6Z5P ogoERSB6kzw947S4MdgQ5Ud14+Hq5E67VFwU75xq1DP3ZaTSnkNpEcuSSnNJL2+0iHUy v3O2Pt9etXDWYwceyDjPNANJw0SSY3XZQvtDS64eaJ5KqtI+4nU0TseRSxLLfo+jXUCd 2359mWGW6UYIVGf+6GhxAOJ9oaIG33KvfH7H7LdmBYc9Z2GRM7EPlgs+AlUlvrl5L+xq 3xew== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=LCdSOwFwrhZScC72O9wronCj2Ku4lPGGJvmSIWng7Ms=; b=KmJZq2jX/hrOyhWa3DYKGvO5zxVcLIYRPwAbLf1pQkMIs1PZnxJieILI30OQ/MsK+t W2gKZ/djZ9P6kcY73CXCkIC5sfpVN1l7IVvBshzVWsqwBMNDS8ErochAF1semBza7ghw Dh1pcs1sJ1GJC+OfXuU9jyhH5sc3j8mVo0wNdufPNTDX+TRttE+2OsGr8xaApPKGxwte 7dg7auHBT9DZh5o983QLArf5MZuQWJ3Qd8dstUp+c+TWX9ngfzKPxlfv4P8D6dPNCys3 daC6l+R4+oP62eZmxW4uHN741DInTTidp4YFavFsB27xcn5A67hL8oTSX8E8XaGjdlRw ZCYQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s24si2067396pgq.372.2019.08.09.03.01.36; Fri, 09 Aug 2019 03:01: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406236AbfHIKAq (ORCPT + 99 others); Fri, 9 Aug 2019 06:00:46 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38873 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726195AbfHIKAq (ORCPT ); Fri, 9 Aug 2019 06:00:46 -0400 Received: by mail-wm1-f66.google.com with SMTP id m125so1036006wmm.3; Fri, 09 Aug 2019 03:00:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=LCdSOwFwrhZScC72O9wronCj2Ku4lPGGJvmSIWng7Ms=; b=WMlY2/odH9qGgAJpKidendcn3iak2xV4QhOj79pGSLjRn5JpufASioUk7DCw6QPRfA hG0aYW1IoLkmanjdlxg8lYJmZWiecNJ9Rr4Zwgwoplud7OlebfCRLc+8/u8j0aZkMDqs KU2MRNSNwGC6KMscUx/3wmJn8r1CvAQ2+gDYIbKYzUuEBvDrr/lf8mQLc4p0ImBvzm/+ vJshF2Q/mxigGU5LdKbMgqSD9lVlclE7jspbWjMSYfkFn4DQnzDyD2Cl9eHgD8gxxcQe xSdmfLZ0oCJ5naB6QAqwiQM9iPKSAEUc6EPplzRT2tPX4Hr1RNwV2sNkQRIWgd3+5e4P 1k6g== X-Gm-Message-State: APjAAAWOMtPeKR4g8Cc8fDTGpE7+pjTR/o3BE0GGYFKWUo8BBwnAS7tg tZjiBjsD1TSS3o8qGmFNhs4= X-Received: by 2002:a1c:6a17:: with SMTP id f23mr9702686wmc.91.1565344844302; Fri, 09 Aug 2019 03:00:44 -0700 (PDT) Received: from 1aq-andre ([77.107.218.170]) by smtp.gmail.com with ESMTPSA id w23sm5060001wmi.45.2019.08.09.03.00.42 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 03:00:43 -0700 (PDT) Message-ID: <14396bfacec0c4877cb0ea9009dc92b33c169cac.camel@andred.net> Subject: Re: [PATCH] net: phy: at803x: stop switching phy delay config needlessly From: =?ISO-8859-1?Q?Andr=E9?= Draszik To: Vladimir Oltean Cc: lkml , Andrew Lunn , Florian Fainelli , Heiner Kallweit , "David S. Miller" , netdev Date: Fri, 09 Aug 2019 11:00:05 +0100 In-Reply-To: References: <20190809005754.23009-1-git@andred.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 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 Hi Vladimir, On Fri, 2019-08-09 at 12:43 +0300, Vladimir Oltean wrote: > Hi Andre, > > On Fri, 9 Aug 2019 at 03:58, André Draszik wrote: > > This driver does a funny dance disabling and re-enabling > > RX and/or TX delays. In any of the RGMII-ID modes, it first > > disables the delays, just to re-enable them again right > > away. This looks like a needless exercise. > > > > Just enable the respective delays when in any of the > > relevant 'id' modes, and disable them otherwise. > > > > Also, remove comments which don't add anything that can't be > > seen by looking at the code. > > > > Signed-off-by: André Draszik > > CC: Andrew Lunn > > CC: Florian Fainelli > > CC: Heiner Kallweit > > CC: "David S. Miller" > > CC: netdev@vger.kernel.org > > --- > > Is there any particular problem you're facing? Does this make any difference? This is a clean-up, reducing the number of lines and if statements by removing unnecessary code paths and comments. Cheers, Andre' > > > drivers/net/phy/at803x.c | 26 ++++++-------------------- > > 1 file changed, 6 insertions(+), 20 deletions(-) > > > > diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c > > index 222ccd9ecfce..2ab51f552e92 100644 > > --- a/drivers/net/phy/at803x.c > > +++ b/drivers/net/phy/at803x.c > > @@ -257,35 +257,21 @@ static int at803x_config_init(struct phy_device *phydev) > > * after HW reset: RX delay enabled and TX delay disabled > > * after SW reset: RX delay enabled, while TX delay retains the > > * value before reset. > > - * > > - * So let's first disable the RX and TX delays in PHY and enable > > - * them based on the mode selected (this also takes care of RGMII > > - * mode where we expect delays to be disabled) > > */ > > - > > - ret = at803x_disable_rx_delay(phydev); > > - if (ret < 0) > > - return ret; > > - ret = at803x_disable_tx_delay(phydev); > > - if (ret < 0) > > - return ret; > > - > > if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || > > phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) { > > - /* If RGMII_ID or RGMII_RXID are specified enable RX delay, > > - * otherwise keep it disabled > > - */ > > ret = at803x_enable_rx_delay(phydev); > > - if (ret < 0) > > - return ret; > > + } else { > > + ret = at803x_disable_rx_delay(phydev); > > } > > + if (ret < 0) > > + return ret; > > > > if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID || > > phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) { > > - /* If RGMII_ID or RGMII_TXID are specified enable TX delay, > > - * otherwise keep it disabled > > - */ > > ret = at803x_enable_tx_delay(phydev); > > + } else { > > + ret = at803x_disable_tx_delay(phydev); > > } > > > > return ret; > > -- > > 2.20.1 > > > > Regards, > -Vladimir