Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933081AbcK1QEX (ORCPT ); Mon, 28 Nov 2016 11:04:23 -0500 Received: from smtprelay0171.hostedemail.com ([216.40.44.171]:51828 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932373AbcK1QEU (ORCPT ); Mon, 28 Nov 2016 11:04:20 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:599:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1543:1593:1594:1605:1711:1730:1747:1777:1792:1801:2110:2194:2199:2393:2559:2562:2828:2902:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:4605:5007:6691:7807:8527:9108:9121:10004:10400:10848:10967:11026:11232:11473:11657:11658:11914:12043:12294:12296:12438:12555:12663:12740:12760:12986:13439:14659:14721:21080:21324:21451:30012:30029:30041:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: paper62_6c89f7af413a X-Filterd-Recvd-Size: 4530 Message-ID: <1480349032.17012.1.camel@perches.com> Subject: Re: [PATCH] stmmac ethernet: remove cut & paste code From: Joe Perches To: Pavel Machek Cc: peppe.cavallaro@st.com, netdev@vger.kernel.org, kernel list , ezequiel@vanguardiasur.com.ar, sonic.zhang@analog.com, fabrice.gasnier@st.com Date: Mon, 28 Nov 2016 08:03:52 -0800 In-Reply-To: <20161128143539.GB31224@amd> References: <20161124085506.GA25007@amd> <20161124102901.GA27793@amd> <20161124103630.GB27793@amd> <20161124104619.GA30723@amd> <20161124110548.GB30723@amd> <1480017925.19726.13.camel@perches.com> <20161124214401.GA25662@amd> <1480026433.19726.17.camel@perches.com> <20161128115023.GA15034@amd> <1480343068.14294.5.camel@perches.com> <20161128143539.GB31224@amd> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.1-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3308 Lines: 69 On Mon, 2016-11-28 at 15:35 +0100, Pavel Machek wrote: > On Mon 2016-11-28 06:24:28, Joe Perches wrote: > > On Mon, 2016-11-28 at 12:50 +0100, Pavel Machek wrote: > > > On Thu 2016-11-24 14:27:13, Joe Perches wrote: > > > > On Thu, 2016-11-24 at 22:44 +0100, Pavel Machek wrote: > > > > > On Thu 2016-11-24 12:05:25, Joe Perches wrote: > > > > > > On Thu, 2016-11-24 at 12:05 +0100, Pavel Machek wrote: > > > > > > > Remove duplicate code from _tx routines. > > > > > > > > > > > > trivia: > > > > > > > > > > > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > > > > > > > > > > > [] > > > > > > > @@ -1960,6 +1960,38 @@ static void stmmac_tso_allocator(struct stmmac_priv *priv, unsigned int des, > > > > > > > } > > > > > > > } > > > > > > > > > > > > > > +static void stmmac_xmit_common(struct sk_buff *skb, struct net_device *dev, int nfrags, struct dma_desc *desc) > > > > > > > +{ > > > > > > > + struct stmmac_priv *priv = netdev_priv(dev); > > > > > > > + > > > > > > > + if (unlikely(stmmac_tx_avail(priv) <= (MAX_SKB_FRAGS + 1))) { > > > > > > > + if (netif_msg_hw(priv)) > > > > > > > + pr_debug("%s: stop transmitted packets\n", __func__); > > > > > > > > > > > > netif_dbg(priv, hw, dev, "%s: stop transmitted packets\n", > > > > > > __func__); > > > > > > > > > > Not now. Modifying the code while de-duplicating would be bad idea. > > > > > > > > Too many people think overly granular patches are the > > > > best and only way to make changes. > > > > Deduplication and consolidation can happen simultaneously. > > > > > > Can, but should not at this point. Please take a look at the driver in > > > question before commenting on trivial printk style. > > > > I had. > > > > It's perfectly acceptable and already uses netif_ properly. > > > > This consolidation now introduces the _only_ instance where it is > > now improperly using a netif_msg_ then single pr_ > > function sequence that should be consolidated into netif_dbg. > > Every other use of netif_msg_ then either emits multiple > > lines or is used in an if/else. > > Are you looking at right driver? Yes and I think you should make changes against -next and not Linus' where this is: b3e51069627e2 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c (LABBE Corentin 2016-11-16 20:09:41 +0100 755) netif_warn(priv, link, priv->dev, b3e51069627e2 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c (LABBE Corentin 2016-11-16 20:09:41 +0100 756) "Speed (%d) not 10/100\n", b3e51069627e2 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c (LABBE Corentin 2016-11-16 20:09:41 +0100 757) phydev->speed); > I don't see single use of > netif_msg_, but see this at stmmac_main.c:756. Code is actually > pretty consistent using pr_*. > > if (netif_msg_link(priv)) > pr_warn("%s: Speed (%d) not 10/100\n", > dev->name, phydev->speed); > > Anyway, I'm moving code around, if you want to do trivial cleanups, do > them yourself. cheers, Joe