From mboxrd@z Thu Jan 1 00:00:00 1970 From: chenweilong Subject: Re: [PATCH 2/2] llc: fix checkpatch errors with space Date: Fri, 20 Dec 2013 12:52:36 +0800 Message-ID: <52B3CD14.9050609@huawei.com> References: <1387509300-11940-1-git-send-email-chenweilong@huawei.com> <1387509300-11940-2-git-send-email-chenweilong@huawei.com> <1387511305.2353.34.camel@joe-AO722> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Cc: , , To: Joe Perches Return-path: Received: from szxga02-in.huawei.com ([119.145.14.65]:47290 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752434Ab3LTEwy (ORCPT ); Thu, 19 Dec 2013 23:52:54 -0500 In-Reply-To: <1387511305.2353.34.camel@joe-AO722> Sender: netdev-owner@vger.kernel.org List-ID: On 2013/12/20 11:48, Joe Perches wrote: > On Fri, 2013-12-20 at 11:15 +0800, Chen Weilong wrote: >> From: Weilong Chen > [] >> diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c >> index 1a3c7e0..abf28eb 100644 >> --- a/net/llc/llc_proc.c >> +++ b/net/llc/llc_proc.c >> @@ -142,7 +142,7 @@ static int llc_seq_socket_show(struct seq_file *seq, void *v) >> if (llc->dev) >> llc_ui_format_mac(seq, llc->dev->dev_addr); >> else { >> - u8 addr[6] = {0,0,0,0,0,0}; >> + u8 addr[6] = {0, 0, 0, 0, 0, 0}; >> llc_ui_format_mac(seq, addr); > > No need to constantly reinitialize addr and the > static function llc_ui_format_mac is pretty useless. > > Perhaps this instead? > > Consolidate multiple seq_printfs to a single call. > Remove unnecessary llc_ui_format_mac and use %pM directly. > > --- > net/llc/llc_proc.c | 22 ++++++---------------- > 1 file changed, 6 insertions(+), 16 deletions(-) > > diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c > index 1a3c7e0..f264038 100644 > --- a/net/llc/llc_proc.c > +++ b/net/llc/llc_proc.c > @@ -26,11 +26,6 @@ > #include > #include > > -static void llc_ui_format_mac(struct seq_file *seq, u8 *addr) > -{ > - seq_printf(seq, "%pM", addr); > -} > - > static struct sock *llc_get_sk_idx(loff_t pos) > { > struct llc_sap *sap; > @@ -125,6 +120,7 @@ static void llc_seq_stop(struct seq_file *seq, void *v) > > static int llc_seq_socket_show(struct seq_file *seq, void *v) > { > + static const u8 null_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0}; > struct sock* sk; > struct llc_sock *llc; > > @@ -137,17 +133,11 @@ static int llc_seq_socket_show(struct seq_file *seq, void *v) > llc = llc_sk(sk); > > /* FIXME: check if the address is multicast */ > - seq_printf(seq, "%2X %2X ", sk->sk_type, 0); > - > - if (llc->dev) > - llc_ui_format_mac(seq, llc->dev->dev_addr); > - else { > - u8 addr[6] = {0,0,0,0,0,0}; > - llc_ui_format_mac(seq, addr); > - } > - seq_printf(seq, "@%02X ", llc->sap->laddr.lsap); > - llc_ui_format_mac(seq, llc->daddr.mac); > - seq_printf(seq, "@%02X %8d %8d %2d %3u %4d\n", llc->daddr.lsap, > + seq_printf(seq, "%2X %2X %pM@%02X %pM@%02X %8d %8d %2d %3u %4d\n", > + sk->sk_type, 0, > + llc->dev ? llc->dev->dev_addr : null_addr, > + llc->sap->laddr.lsap, > + llc->daddr.mac, llc->daddr.lsap, > sk_wmem_alloc_get(sk), > sk_rmem_alloc_get(sk) - llc->copied_seq, > sk->sk_state, > > > > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > > That's very good. Thanks!