Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1736413 > unrolled thread
| Started by | Janani Sankara Babu <jananis37@gmail.com> |
|---|---|
| First post | 2017-09-21 09:00 +0200 |
| Last post | 2017-09-21 12:30 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] staging:rtl8188eu Remove unnecessary {} braces in Janani Sankara Babu <jananis37@gmail.com> - 2017-09-21 09:00 +0200
Re: [PATCH] staging:rtl8188eu Remove unnecessary {} braces in Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-21 09:20 +0200
Re: [PATCH] staging:rtl8188eu Remove unnecessary {} braces in Joe Perches <joe@perches.com> - 2017-09-21 12:30 +0200
| From | Janani Sankara Babu <jananis37@gmail.com> |
|---|---|
| Date | 2017-09-21 09:00 +0200 |
| Subject | [PATCH] staging:rtl8188eu Remove unnecessary {} braces in |
| Message-ID | <us3CN-5Ky-7@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2017-09-21 09:20 +0200 |
| Message-ID | <us3Wa-69n-7@gated-at.bofh.it> |
| In reply to | #1736413 |
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
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-09-21 12:30 +0200 |
| Message-ID | <us6U2-83f-19@gated-at.bofh.it> |
| In reply to | #1736416 |
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...]
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web