Re: [PATCH 5/5] staging: r8712u: Merging Realtek's latest (v2.6.6). Various fixes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 24, 2011 at 01:02:01AM -0500, Larry Finger wrote:
> On 08/23/2011 12:42 PM, Ali Bahar wrote:
> >
> >On Tue, Aug 23, 2011 at 11:37:21AM -0500, Larry Finger wrote:
> >>On 08/23/2011 12:53 AM, Ali Bahar wrote:

> >>>diff --git a/drivers/staging/rtl8712/rtl8712_efuse.c b/drivers/staging/rtl8712/rtl8712_efuse.c
> >>>index 1dc12b7..8f81d51 100644
> >>>--- a/drivers/staging/rtl8712/rtl8712_efuse.c
> >>>+++ b/drivers/staging/rtl8712/rtl8712_efuse.c
> >>>@@ -302,55 +302,70 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr)
> >>>  		}
> >>>  		offset = GET_EFUSE_OFFSET(value);
> >>>  		word_en = GET_EFUSE_WORD_EN(value);
> >>>-		if (pkt.offset != offset) {
> >>>+		if (pkt.offset == offset) {
> >>>+			for (i = 0; i<   PGPKG_MAX_WORDS; i++) {
> >>>+				if (BIT(i)&   word_en) {
> >>>+					if (BIT(i)&   pkt.word_en) {
> >>
> >>The two if statements above should be collapsed into
> >>
> >>if ((BIT(i)&   word_en)&&  (BIT(i)&   pkt.word_en)) {
> >
> >OK.
> >
> >
> >
> >>That will get rid of one level on indentation. It still gets a lot
> >>on indentation, but probably not worth refactoring.
> >
> >The '&&' does not save any indentation.
> 
> Yes it does. Compare
> 
> 	if (a) {
> 		if (b) {
> 			stuff;
> 		}
> 	}
> 
> with
> 
> 	if (a && b) {
> 		stuff
> 	}
> 

In practice, I tried this many times, but it gained very little. (eg
if 'a' and 'b' are lengthy) It depends on where this block is
positioned. The TAB-only rule limits the gain.

Never the less, I will continue attempting it.

regards,
ali


> Of course, it only works if both if statements do not have an else
> clause, but that is the case here.
> 
> Larry
> 
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux