Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754781AbdHZBFh (ORCPT ); Fri, 25 Aug 2017 21:05:37 -0400 Received: from smtprelay0007.hostedemail.com ([216.40.44.7]:46470 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754700AbdHZBFf (ORCPT ); Fri, 25 Aug 2017 21:05:35 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:69:355:379:541:599:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1543:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2693:2828:3138:3139:3140:3141:3142:3355:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:4605:5007:6119:7903:7974:8603:9108:10004:10400:10848:11026:11232:11657:11658:11914:12043:12296:12438:12555:12740:12760:12895:13161:13229:13439:13618:14180:14659:14721:21080:21325:21451:21627:30012:30054:30070:30083:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: line61_58c1103cfe00 X-Filterd-Recvd-Size: 4644 Message-ID: <1503709036.12569.36.camel@perches.com> Subject: Re: [PATCH] staging:rtl8712:xmit_linux.c: Avoid CamelCase From: Joe Perches To: Harsha Sharma Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Fri, 25 Aug 2017 17:57:16 -0700 In-Reply-To: References: <1503683502-20391-1-git-send-email-harshasharmaiitr@gmail.com> <1503687793.12569.30.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 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: 3612 Lines: 95 On Sat, 2017-08-26 at 01:21 +0530, Harsha Sharma wrote: > Hello, > > Sorry, this was my first contribution in linux-kernel. I will take care > about this from next time. > Do I need to send these patches once again one by one? No, just pick the "best" one of what you sent without any of the "style" modifications like the 80 column adjustments and see what happens. Read the code outside of staging for awhile to get a feel for what style seems appropriate before you send style-only patches. For instance, this proposed change: diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c > index 0b39676..57fc65f 100644 > --- a/drivers/staging/unisys/visornic/visornic_main.c > +++ b/drivers/staging/unisys/visornic/visornic_main.c > @@ -253,10 +253,9 @@ static int visor_copy_fragsinfo_from_skb(struct sk_buff *skb, > for (frag = 0; frag < numfrags; frag++) { > count = add_physinfo_entries(page_to_pfn( > skb_frag_page(&skb_shinfo(skb)->frags[frag])), > - skb_shinfo(skb)->frags[frag]. > - page_offset, > - skb_shinfo(skb)->frags[frag]. > - size, count, frags_max, frags); > + skb_shinfo(skb)->frags[frag].page_offset, > + skb_shinfo(skb)->frags[frag].size, > + count, frags_max, frags); > /* add_physinfo_entries only returns > * zero if the frags array is out of room > * That should never happen because we while it's nice that you put the multi-line dereferences together, it's not nice that you change the indentation. Sometimes it's simply better to exceed 80 columns. But here, it'd probably be nicer to use temporaries. Something like: --- drivers/staging/unisys/visornic/visornic_main.c | 26 +++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 2891622eef18..aafd849dc1e8 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -195,7 +195,7 @@ visor_copy_fragsinfo_from_skb(struct sk_buff *skb, unsigned int firstfraglen, unsigned int frags_max, struct phys_info frags[]) { - unsigned int count = 0, frag, size, offset = 0, numfrags; + unsigned int count = 0, size, offset = 0, numfrags; unsigned int total_count; numfrags = skb_shinfo(skb)->nr_frags; @@ -234,21 +234,23 @@ visor_copy_fragsinfo_from_skb(struct sk_buff *skb, unsigned int firstfraglen, count++; } if (numfrags) { + int i; + if ((count + numfrags) > frags_max) return -EINVAL; - for (frag = 0; frag < numfrags; frag++) { - count = add_physinfo_entries(page_to_pfn( - skb_frag_page(&skb_shinfo(skb)->frags[frag])), - skb_shinfo(skb)->frags[frag]. - page_offset, - skb_shinfo(skb)->frags[frag]. - size, count, frags_max, frags); - /* add_physinfo_entries only returns - * zero if the frags array is out of room - * That should never happen because we - * fail above, if count+numfrags > frags_max. + for (i = 0; i < numfrags; i++) { + skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; + unsigned long pfn = page_to_pfn(skb_frag_page(frag)); + + /* add_physinfo_entries only returns zero if the + * frags array is out of room. + * That should never happen because we fail above, + * if count+numfrags > frags_max. */ + count = add_physinfo_entries(pfn, frag->page_offset, + frag->size, count, + frags_max, frags); if (!count) return -EINVAL; }