All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging:rtl8188eu Remove unnecessary {} braces in
@ 2017-09-21  6:48 Janani Sankara Babu
  2017-09-21  7:15 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Janani Sankara Babu @ 2017-09-21  6:48 UTC (permalink / raw)
  To: gregkh
  Cc: insafonov, palaviv, mihaela.muraru21, goudapatilk, devel,
	linux-kernel, Janani Sankara Babu

This patch is created to solve coding style issues by removing curly braces
from single statement code blocks

Signed-off-by: Janani Sankara Babu <jananis37@gmail.com>
---
 drivers/staging/rtl8188eu/hal/phy.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c
index 3039bbe..00552cb 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -728,9 +728,9 @@ static void patha_fill_iqk(struct adapter *adapt, bool iqkok, s32 result[][8],
 	u32 oldval_0, x, tx0_a, reg;
 	s32 y, tx0_c;
 
-	if (final_candidate == 0xFF) {
+	if (final_candidate == 0xFF)
 		return;
-	} else if (iqkok) {
+	else if (iqkok) {
 		oldval_0 = (phy_query_bb_reg(adapt, rOFDM0_XATxIQImbalance, bMaskDWord) >> 22) & 0x3FF;
 
 		x = result[final_candidate][0];
@@ -774,9 +774,9 @@ static void pathb_fill_iqk(struct adapter *adapt, bool iqkok, s32 result[][8],
 	u32 oldval_1, x, tx1_a, reg;
 	s32 y, tx1_c;
 
-	if (final_candidate == 0xFF) {
+	if (final_candidate == 0xFF)
 		return;
-	} else if (iqkok) {
+	else if (iqkok) {
 		oldval_1 = (phy_query_bb_reg(adapt, rOFDM0_XBTxIQImbalance, bMaskDWord) >> 22) & 0x3FF;
 
 		x = result[final_candidate][4];
@@ -820,9 +820,8 @@ static void save_adda_registers(struct adapter *adapt, u32 *addareg,
 {
 	u32 i;
 
-	for (i = 0; i < register_num; i++) {
+	for (i = 0; i < register_num; i++)
 		backup[i] = phy_query_bb_reg(adapt, addareg[i], bMaskDWord);
-	}
 }
 
 static void save_mac_registers(struct adapter *adapt, u32 *mac_reg,
@@ -830,9 +829,8 @@ static void save_mac_registers(struct adapter *adapt, u32 *mac_reg,
 {
 	u32 i;
 
-	for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) {
+	for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++)
 		backup[i] = usb_read8(adapt, mac_reg[i]);
-	}
 	backup[i] = usb_read32(adapt, mac_reg[i]);
 }
 
@@ -850,9 +848,8 @@ static void reload_mac_registers(struct adapter *adapt,
 {
 	u32 i;
 
-	for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++) {
+	for (i = 0; i < (IQK_MAC_REG_NUM - 1); i++)
 		usb_write8(adapt, mac_reg[i], (u8)backup[i]);
-	}
 	usb_write32(adapt, mac_reg[i], backup[i]);
 }
 
@@ -880,9 +877,8 @@ static void mac_setting_calibration(struct adapter *adapt, u32 *mac_reg, u32 *ba
 
 	usb_write8(adapt, mac_reg[i], 0x3F);
 
-	for (i = 1; i < (IQK_MAC_REG_NUM - 1); i++) {
+	for (i = 1; i < (IQK_MAC_REG_NUM - 1); i++)
 		usb_write8(adapt, mac_reg[i], (u8)(backup[i]&(~BIT(3))));
-	}
 	usb_write8(adapt, mac_reg[i], (u8)(backup[i]&(~BIT(5))));
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging:rtl8188eu Remove unnecessary {} braces in
  2017-09-21  6:48 [PATCH] staging:rtl8188eu Remove unnecessary {} braces in Janani Sankara Babu
@ 2017-09-21  7:15 ` Dan Carpenter
  2017-09-21 10:24   ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2017-09-21  7:15 UTC (permalink / raw)
  To: Janani Sankara Babu
  Cc: gregkh, devel, insafonov, mihaela.muraru21, goudapatilk,
	linux-kernel, palaviv

On Thu, Sep 21, 2017 at 12:18:04PM +0530, Janani Sankara Babu wrote:
> --- a/drivers/staging/rtl8188eu/hal/phy.c
> +++ b/drivers/staging/rtl8188eu/hal/phy.c
> @@ -728,9 +728,9 @@ static void patha_fill_iqk(struct adapter *adapt, bool iqkok, s32 result[][8],
>  	u32 oldval_0, x, tx0_a, reg;
>  	s32 y, tx0_c;
>  
> -	if (final_candidate == 0xFF) {
> +	if (final_candidate == 0xFF)
>  		return;
> -	} else if (iqkok) {
> +	else if (iqkok) {

No.  These ones stay.  Your change would introduce a new checkpatch.pl
warning if you ran it against the patched file.  The rule here is that
if one side of the if else has curly braces then both sides get them.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging:rtl8188eu Remove unnecessary {} braces in
  2017-09-21  7:15 ` Dan Carpenter
@ 2017-09-21 10:24   ` Joe Perches
  0 siblings, 0 replies; 3+ messages in thread
From: Joe Perches @ 2017-09-21 10:24 UTC (permalink / raw)
  To: Dan Carpenter, Janani Sankara Babu
  Cc: gregkh, devel, insafonov, mihaela.muraru21, goudapatilk,
	linux-kernel, palaviv

On Thu, 2017-09-21 at 10:15 +0300, Dan Carpenter wrote:
> On Thu, Sep 21, 2017 at 12:18:04PM +0530, Janani Sankara Babu wrote:
> > --- a/drivers/staging/rtl8188eu/hal/phy.c
> > +++ b/drivers/staging/rtl8188eu/hal/phy.c
> > @@ -728,9 +728,9 @@ static void patha_fill_iqk(struct adapter *adapt, bool iqkok, s32 result[][8],
> >  	u32 oldval_0, x, tx0_a, reg;
> >  	s32 y, tx0_c;
> >  
> > -	if (final_candidate == 0xFF) {
> > +	if (final_candidate == 0xFF)
> >  		return;
> > -	} else if (iqkok) {
> > +	else if (iqkok) {
> 
> No.  These ones stay.  Your change would introduce a new checkpatch.pl
> warning if you ran it against the patched file.  The rule here is that
> if one side of the if else has curly braces then both sides get them.

And the else could be removed

	if (final_candidate == 0xff)
		return;

	if (iqkok) {
		[etc...]

and the code should probably be

	if (final_candidate == 0xff)
		return;

	if (!iqkok)
		return;

	[unindented etc...]

or combine the first 2 tests

	if (final_candidate == 0xff || !iqkok)
		return;

	[unindented etc...]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-21 10:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-21  6:48 [PATCH] staging:rtl8188eu Remove unnecessary {} braces in Janani Sankara Babu
2017-09-21  7:15 ` Dan Carpenter
2017-09-21 10:24   ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.