From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D671EEAA4F for ; Thu, 14 Sep 2023 15:04:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DY/FGMfc8F51ncbxSqhLPdC1TG7CeJrB7bzZwr2HJ/o=; b=RTEbM1yT7KKDBW C+3c46dQK5S0Bl3Pp0MN5RfPq9bMYbwRzrKfxq+MG/USQVfN7hvOUJV7CZgxDRUUjANNtgMKG6zdg /LTnPBcT9wSCscb5ppBv5570+FCWNRKyZkqNFSx9A6TR19H/m8zIDoHE+DcX6palusIHWXTO/vVY+ LOIJzOGfEe5iNKFAD/aJ56Q/a7/5UpwJsBrgX2i8DHfT+fOKLtYjcorOI+AAX6GYhYr0J8KIVdI9p m2ftYiF+ddJzWlNO4XwUSWiUq732C1ot1ZKYjg5mlvz9JYj3X5zz0zAR7nxUBmrufZQCFDmoliSFW Ca/2ijo28Ea35+lxk9bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgnsb-008jaN-2d; Thu, 14 Sep 2023 15:03:41 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgnsX-008jZ4-17 for linux-arm-kernel@lists.infradead.org; Thu, 14 Sep 2023 15:03:38 +0000 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=RE3IKnkVM1o//7e7tQAyrkiYmQQrfQVxuj7YjxSm9tg=; b=nhdYLCMoe8emRkBajZTeqgMGF2 9N7Aj3Jtq6ogxxz/sjndT5aWDpEVH8biPtO56utKLzIyBE+6HwBcthKC+b/2EYi55i+W54HjJQxh2 gOSYO+osjvn/NvYfaZJPB+ZdYe0KgP7Rh9BsQsOEbfGNVwqtvyBPyek4N0lf0oGVEfhNrndgB0D12 88LgA9dJ8IsMGW4SOmPy3fPvBOxv4HMsPUZ77LaCjBXHHnJASzsH8RwBzDEuI4Wc779Jubsx6jpRC QqbOHcWZIenwxmKLCazJo5l8ibGARlIILqcUS2mjdsaaHAwnQ3Tgu7vxDRaiZehFKsvznbOC4X0VR 4A0Y7owg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:49528) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qgnsH-0004Qz-2Y; Thu, 14 Sep 2023 16:03:21 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qgnsD-0004r8-H3; Thu, 14 Sep 2023 16:03:17 +0100 Date: Thu, 14 Sep 2023 16:03:17 +0100 From: "Russell King (Oracle)" To: Serge Semin Cc: Alexandre Torgue , Jose Abreu , Alexei Starovoitov , bpf@vger.kernel.org, Daniel Borkmann , "David S. Miller" , Emil Renner Berthing , Eric Dumazet , Fabio Estevam , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, NXP Linux Team , Paolo Abeni , Pengutronix Kernel Team , Samin Guo , Sascha Hauer , Shawn Guo Subject: Re: [PATCH net-next 4/6] net: stmmac: rk: use stmmac_set_tx_clk_gmii() Message-ID: References: <7vhtvd25qswsju34lgqi4em5v3utsxlvi3lltyt5yqqecddpyh@c5yvk7t5k5zz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <7vhtvd25qswsju34lgqi4em5v3utsxlvi3lltyt5yqqecddpyh@c5yvk7t5k5zz> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230914_080337_383368_054888BF X-CRM114-Status: GOOD ( 19.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 14, 2023 at 05:37:13PM +0300, Serge Semin wrote: > On Thu, Sep 14, 2023 at 02:51:35PM +0100, Russell King (Oracle) wrote: > > Use stmmac_set_tx_clk_gmii(). > > > > Signed-off-by: Russell King (Oracle) > > --- > > .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 60 +++++-------------- > > 1 file changed, 16 insertions(+), 44 deletions(-) > > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c > > index d920a50dd16c..5731a73466eb 100644 > > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c > > @@ -1081,28 +1081,14 @@ static void rk3568_set_gmac_speed(struct rk_priv_data *bsp_priv, int speed) > > { > > struct clk *clk_mac_speed = bsp_priv->clks[RK_CLK_MAC_SPEED].clk; > > struct device *dev = &bsp_priv->pdev->dev; > > - unsigned long rate; > > - int ret; > > - > > - switch (speed) { > > - case 10: > > - rate = 2500000; > > - break; > > - case 100: > > - rate = 25000000; > > - break; > > - case 1000: > > - rate = 125000000; > > - break; > > - default: > > - dev_err(dev, "unknown speed value for GMAC speed=%d", speed); > > - return; > > - } > > - > > - ret = clk_set_rate(clk_mac_speed, rate); > > - if (ret) > > - dev_err(dev, "%s: set clk_mac_speed rate %ld failed %d\n", > > - __func__, rate, ret); > > + int err; > > + > > + err = stmmac_set_tx_clk_gmii(clk_mac_speed, speed); > > + if (err == -ENOTSUPP) > > > + dev_err(dev, "invalid speed %uMbps\n", speed); > > + else if (err) > > + dev_err(dev, "failed to set tx rate for speed %uMbps: %pe\n", > > These type specifiers should have been '%d' since the speed variable > is of the signed integer type here. Okay, having re-reviewed the changes, I'm changing them _all_ back to be %d, because that is the _right_ thing. It is *not* unsigned, even if fix_mac_speed() thinks that it is. It isn't. It's signed, and it's stmmac bollocks implicitly casting it to unsigned - and that is _wrong_. So, on that point, my original submission was more correct than this one, and you led me astray. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel