2013-06-18 03:32:26

by Chad Williamson

[permalink] [raw]
Subject: [PATCH 0/4] Staging: silicom: coding style cleanup

More coding style cleanup in bpctl_mod.c, resolving many checkpatch.pl
warnings and errors. I've skipped a number of issues in functions that
are going to need to be split up/rewritten anyway, etc. Tearing out the
new typedefs is next on my todo list...

Chad Williamson (4):
Staging: silicom: remove unnecessary braces in bpctl_mod.c
Staging: silicom: whitespace fixes in bpctl_mod.c
Staging: silicom: move assignments out of if conditions
Staging: silicom: move more assignments out of if conditions

drivers/staging/silicom/bpctl_mod.c | 171 ++++++++++++++++++++----------------
1 file changed, 94 insertions(+), 77 deletions(-)

--
1.8.1.4


2013-06-18 03:32:32

by Chad Williamson

[permalink] [raw]
Subject: [PATCH 1/4] Staging: silicom: remove unnecessary braces in bpctl_mod.c

Remove unnecessary braces in bpctl_mod.c, resolving checkpatch.pl
warnings.

Signed-off-by: Chad Williamson <[email protected]>
---
drivers/staging/silicom/bpctl_mod.c | 58 +++++++++++++++----------------------
1 file changed, 23 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index 4c8fb86..c09dc02 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -720,16 +720,15 @@ static int read_pulse(bpctl_dev_t *pbpctl_dev, unsigned int ctrl_ext,
BP10G_MDIO_DATA_OUT));

}
- if (pbpctl_dev->bp_10g9) {
- ctrl_ext = BP10G_READ_REG(pbpctl_dev, I2CCTL);

- } else if ((pbpctl_dev->bp_fiber5) || (pbpctl_dev->bp_i80)) {
+ if (pbpctl_dev->bp_10g9)
+ ctrl_ext = BP10G_READ_REG(pbpctl_dev, I2CCTL);
+ else if ((pbpctl_dev->bp_fiber5) || (pbpctl_dev->bp_i80))
ctrl_ext = BPCTL_READ_REG(pbpctl_dev, CTRL);
- } else if (pbpctl_dev->bp_540) {
+ else if (pbpctl_dev->bp_540)
ctrl_ext = BP10G_READ_REG(pbpctl_dev, ESDP);
- } else if (pbpctl_dev->bp_10gb)
+ else if (pbpctl_dev->bp_10gb)
ctrl_ext = BP10GB_READ_REG(pbpctl_dev, MISC_REG_SPIO);
-
else if (!pbpctl_dev->bp_10g)
ctrl_ext = BPCTL_READ_REG(pbpctl_dev, CTRL_EXT);
else
@@ -1920,13 +1919,10 @@ int disc_port_on(bpctl_dev_t *pbpctl_dev)
return BP_NOT_CAP;

if (pbpctl_dev_m->bp_caps_ex & DISC_PORT_CAP_EX) {
- if (is_bypass_fn(pbpctl_dev) == 1) {
-
+ if (is_bypass_fn(pbpctl_dev) == 1)
write_data(pbpctl_dev_m, TX_DISA);
- } else {
-
+ else
write_data(pbpctl_dev_m, TX_DISB);
- }

msec_delay_bp(LATCH_DELAY);

@@ -2017,9 +2013,9 @@ int wdt_off(bpctl_dev_t *pbpctl_dev)
int ret = BP_NOT_CAP;

if (pbpctl_dev->bp_caps & WD_CTL_CAP) {
- if (INTEL_IF_SERIES(pbpctl_dev->subdevice)) {
+ if (INTEL_IF_SERIES(pbpctl_dev->subdevice))
bypass_off(pbpctl_dev);
- } else if (pbpctl_dev->bp_ext_ver >= PXG2BPI_VER)
+ else if (pbpctl_dev->bp_ext_ver >= PXG2BPI_VER)
write_data(pbpctl_dev, WDT_OFF);
else
data_pulse(pbpctl_dev, WDT_OFF);
@@ -2404,12 +2400,10 @@ static int set_tx(bpctl_dev_t *pbpctl_dev, int tx_state)
}

}
- if (pbpctl_dev->bp_fiber5) {
+ if (pbpctl_dev->bp_fiber5)
ctrl = BPCTL_READ_REG(pbpctl_dev, CTRL_EXT);
-
- } else if (pbpctl_dev->bp_10gb)
+ else if (pbpctl_dev->bp_10gb)
ctrl = BP10GB_READ_REG(pbpctl_dev, MISC_REG_GPIO);
-
else if (!pbpctl_dev->bp_10g)
ctrl = BPCTL_READ_REG(pbpctl_dev, CTRL);
else
@@ -4054,9 +4048,8 @@ void bypass_caps_init(bpctl_dev_t *pbpctl_dev)
pbpctl_dev->bp_caps |=
(TX_CTL_CAP | TX_STATUS_CAP | TPL_CAP);

- if (TPL_IF_SERIES(pbpctl_dev->subdevice)) {
+ if (TPL_IF_SERIES(pbpctl_dev->subdevice))
pbpctl_dev->bp_caps |= TPL_CAP;
- }

if (INTEL_IF_SERIES(pbpctl_dev->subdevice)) {
pbpctl_dev->bp_caps |=
@@ -4196,9 +4189,9 @@ void bypass_caps_init(bpctl_dev_t *pbpctl_dev)
if (PEG5_IF_SERIES(pbpctl_dev->subdevice))
pbpctl_dev->bp_caps |= (TX_CTL_CAP | TX_STATUS_CAP);

- if (BP10GB_IF_SERIES(pbpctl_dev->subdevice)) {
+ if (BP10GB_IF_SERIES(pbpctl_dev->subdevice))
pbpctl_dev->bp_caps &= ~(TX_CTL_CAP | TX_STATUS_CAP);
- }
+
pbpctl_dev_m = get_master_port_fn(pbpctl_dev);
if (pbpctl_dev_m != NULL) {
int cap_reg = 0;
@@ -4327,10 +4320,9 @@ int set_bypass_wd_auto(bpctl_dev_t *pbpctl_dev, unsigned int param)

int get_bypass_wd_auto(bpctl_dev_t *pbpctl_dev)
{
-
- if (pbpctl_dev->bp_caps & WD_CTL_CAP) {
+ if (pbpctl_dev->bp_caps & WD_CTL_CAP)
return pbpctl_dev->reset_time;
- }
+
return BP_NOT_CAP;
}

@@ -5036,23 +5028,19 @@ static void bp_tpl_timer_fn(unsigned long param)

link2 = get_bypass_link_status(pbpctl_dev_b);
if ((link1) && (tx_status(pbpctl_dev))) {
- if ((!link2) && (tx_status(pbpctl_dev_b))) {
+ if ((!link2) && (tx_status(pbpctl_dev_b)))
set_tx(pbpctl_dev, 0);
- } else if (!tx_status(pbpctl_dev_b)) {
+ else if (!tx_status(pbpctl_dev_b))
set_tx(pbpctl_dev_b, 1);
- }
} else if ((!link1) && (tx_status(pbpctl_dev))) {
- if ((link2) && (tx_status(pbpctl_dev_b))) {
+ if ((link2) && (tx_status(pbpctl_dev_b)))
set_tx(pbpctl_dev_b, 0);
- }
} else if ((link1) && (!tx_status(pbpctl_dev))) {
- if ((link2) && (tx_status(pbpctl_dev_b))) {
+ if ((link2) && (tx_status(pbpctl_dev_b)))
set_tx(pbpctl_dev, 1);
- }
} else if ((!link1) && (!tx_status(pbpctl_dev))) {
- if ((link2) && (tx_status(pbpctl_dev_b))) {
+ if ((link2) && (tx_status(pbpctl_dev_b)))
set_tx(pbpctl_dev, 1);
- }
}

mod_timer(&pbpctl_dev->bp_tpl_timer, jiffies + BP_LINK_MON_DELAY * HZ);
@@ -5111,9 +5099,9 @@ int get_bypass_tpl_auto(bpctl_dev_t *pbpctl_dev)
{
if (!pbpctl_dev)
return -1;
- if (pbpctl_dev->bp_caps & TPL_CAP) {
+ if (pbpctl_dev->bp_caps & TPL_CAP)
return pbpctl_dev->bp_tpl_flag;
- }
+
return BP_NOT_CAP;
}

--
1.8.1.4

2013-06-18 03:32:39

by Chad Williamson

[permalink] [raw]
Subject: [PATCH 3/4] Staging: silicom: move assignments out of if conditions

Remove a bunch of assignments from if-statement conditions in
bpctl_mod.c, resolving checkpatch.pl errors. (This isn't all of
them, but the patch is getting rather long...)

Signed-off-by: Chad Williamson <[email protected]>
---
drivers/staging/silicom/bpctl_mod.c | 54 +++++++++++++++++++++++--------------
1 file changed, 34 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index 893737a..19a9239 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -306,7 +306,8 @@ static void write_pulse(bpctl_dev_t *pbpctl_dev,
ctrl = BP10G_READ_REG(pbpctl_dev, ESDP);

if (pbpctl_dev->bp_10g9) {
- if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_c = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_c)
return;
ctrl = BP10G_READ_REG(pbpctl_dev_c, ESDP);
}
@@ -606,7 +607,8 @@ static int read_pulse(bpctl_dev_t *pbpctl_dev, unsigned int ctrl_ext,
if (pbpctl_dev->bp_540)
ctrl = BP10G_READ_REG(pbpctl_dev, ESDP);
if (pbpctl_dev->bp_10g9) {
- if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_c = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_c)
return -1;
ctrl = BP10G_READ_REG(pbpctl_dev_c, ESDP);
}
@@ -774,7 +776,8 @@ static void write_reg(bpctl_dev_t *pbpctl_dev, unsigned char value,
bpctl_dev_t *pbpctl_dev_c = NULL;
unsigned long flags;
if (pbpctl_dev->bp_10g9) {
- if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_c = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_c)
return;
}
if ((pbpctl_dev->wdt_status == WDT_STATUS_EN) &&
@@ -952,7 +955,8 @@ static int read_reg(bpctl_dev_t *pbpctl_dev, unsigned char addr)
atomic_set(&pbpctl_dev->wdt_busy, 1);
#endif
if (pbpctl_dev->bp_10g9) {
- if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_c = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_c)
return -1;
}

@@ -1223,7 +1227,8 @@ static int wdt_pulse(bpctl_dev_t *pbpctl_dev)
return -1;
#endif
if (pbpctl_dev->bp_10g9) {
- if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_c = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_c)
return -1;
}

@@ -1743,7 +1748,8 @@ static int write_data_int(bpctl_dev_t *pbpctl_dev, unsigned char value)
{
bpctl_dev_t *pbpctl_dev_b = NULL;

- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return -1;
atomic_set(&pbpctl_dev->wdt_busy, 1);
write_data_port_int(pbpctl_dev, value & 0x3);
@@ -1961,7 +1967,8 @@ int tpl_hw_on(bpctl_dev_t *pbpctl_dev)
int ret = 0, ctrl = 0;
bpctl_dev_t *pbpctl_dev_b = NULL;

- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;

if (pbpctl_dev->bp_caps_ex & TPL2_CAP_EX) {
@@ -1988,7 +1995,8 @@ int tpl_hw_off(bpctl_dev_t *pbpctl_dev)
int ret = 0, ctrl = 0;
bpctl_dev_t *pbpctl_dev_b = NULL;

- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;
if (pbpctl_dev->bp_caps_ex & TPL2_CAP_EX) {
cmnd_on(pbpctl_dev);
@@ -3231,8 +3239,10 @@ int bypass_from_last_read(bpctl_dev_t *pbpctl_dev)
uint32_t ctrl_ext = 0;
bpctl_dev_t *pbpctl_dev_b = NULL;

- if ((pbpctl_dev->bp_caps & SW_CTL_CAP)
- && (pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) {
+ if (pbpctl_dev->bp_caps & SW_CTL_CAP) {
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
+ return BP_NOT_CAP;
ctrl_ext = BPCTL_READ_REG(pbpctl_dev_b, CTRL_EXT);
BPCTL_BP_WRITE_REG(pbpctl_dev_b, CTRL_EXT,
(ctrl_ext & ~BPCTLI_CTRL_EXT_SDP7_DIR));
@@ -3248,9 +3258,10 @@ int bypass_status_clear(bpctl_dev_t *pbpctl_dev)
{
bpctl_dev_t *pbpctl_dev_b = NULL;

- if ((pbpctl_dev->bp_caps & SW_CTL_CAP)
- && (pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) {
-
+ if (pbpctl_dev->bp_caps & SW_CTL_CAP) {
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
+ return BP_NOT_CAP;
send_bypass_clear_pulse(pbpctl_dev_b, 1);
return 0;
} else
@@ -3323,7 +3334,8 @@ static int bypass_status(bpctl_dev_t *pbpctl_dev)

bpctl_dev_t *pbpctl_dev_b = NULL;

- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;

if (INTEL_IF_SERIES(pbpctl_dev->subdevice)) {
@@ -3611,7 +3623,8 @@ int tap_status(bpctl_dev_t *pbpctl_dev)
if (pbpctl_dev->bp_caps & TAP_CAP) {
bpctl_dev_t *pbpctl_dev_b = NULL;

- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;

if (pbpctl_dev->bp_ext_ver >= 0x8) {
@@ -3707,7 +3720,8 @@ int disc_off_status(bpctl_dev_t *pbpctl_dev)
u32 ctrl_ext = 0;

if (pbpctl_dev->bp_caps & DISC_CAP) {
- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;
if (DISCF_IF_SERIES(pbpctl_dev->subdevice))
return ((((read_reg(pbpctl_dev, STATUS_DISC_REG_ADDR)) &
@@ -3788,11 +3802,10 @@ static int disc_status(bpctl_dev_t *pbpctl_dev)
{
int ctrl = 0;
if (pbpctl_dev->bp_caps & DISC_CAP) {
-
- if ((ctrl = disc_off_status(pbpctl_dev)) < 0)
+ ctrl = disc_off_status(pbpctl_dev);
+ if (ctrl < 0)
return ctrl;
return ((ctrl == 0) ? 1 : 0);
-
}
return BP_NOT_CAP;
}
@@ -3905,7 +3918,8 @@ int tpl_hw_status(bpctl_dev_t *pbpctl_dev)
{
bpctl_dev_t *pbpctl_dev_b = NULL;

- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return BP_NOT_CAP;

if (TPL_IF_SERIES(pbpctl_dev->subdevice))
--
1.8.1.4

2013-06-18 03:32:36

by Chad Williamson

[permalink] [raw]
Subject: [PATCH 2/4] Staging: silicom: whitespace fixes in bpctl_mod.c

Two trivial whitespace fixes in bpctl_mod.c for the sake of
checkpatch.pl happiness, etc.

Signed-off-by: Chad Williamson <[email protected]>
---
drivers/staging/silicom/bpctl_mod.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index c09dc02..893737a 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -2028,8 +2028,8 @@ int wdt_off(bpctl_dev_t *pbpctl_dev)
/* WDT_ON (0x10)*/

/***Global***/
-static unsigned int
- wdt_val_array[] = { 1000, 1500, 2000, 3000, 4000, 8000, 16000, 32000, 0 };
+static unsigned int wdt_val_array[]
+ = { 1000, 1500, 2000, 3000, 4000, 8000, 16000, 32000, 0 };

int wdt_on(bpctl_dev_t *pbpctl_dev, unsigned int timeout)
{
@@ -6617,7 +6617,7 @@ static void find_fw(bpctl_dev_t *dev)
ioremap(mmio_start, mmio_len);

dev->bp_fw_ver = bypass_fw_ver(dev);
- if (dev-> bp_fw_ver == 0xa8)
+ if (dev->bp_fw_ver == 0xa8)
break;
}
}
--
1.8.1.4

2013-06-18 03:32:43

by Chad Williamson

[permalink] [raw]
Subject: [PATCH 4/4] Staging: silicom: move more assignments out of if conditions

Remove more assignments from if-statement conditions in bpctl_mod.c,
resolving checkpatch.pl errors. Those that remain need more attention
than I'm presently prepared to give them.

Signed-off-by: Chad Williamson <[email protected]>
---
drivers/staging/silicom/bpctl_mod.c | 53 ++++++++++++++++++++++++-------------
1 file changed, 34 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c
index 19a9239..91a6afd 100644
--- a/drivers/staging/silicom/bpctl_mod.c
+++ b/drivers/staging/silicom/bpctl_mod.c
@@ -4222,9 +4222,8 @@ void bypass_caps_init(bpctl_dev_t *pbpctl_dev)

int bypass_off_init(bpctl_dev_t *pbpctl_dev)
{
- int ret = 0;
-
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ int ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (INTEL_IF_SERIES(pbpctl_dev->subdevice))
return dis_bypass_cap(pbpctl_dev);
@@ -4409,7 +4408,8 @@ int set_bypass_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode)

if (!(pbpctl_dev->bp_caps & BP_CAP))
return BP_NOT_CAP;
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (!bypass_mode)
ret = bypass_off(pbpctl_dev);
@@ -4441,7 +4441,8 @@ int set_dis_bypass_fn(bpctl_dev_t *pbpctl_dev, int dis_param)

if (!(pbpctl_dev->bp_caps & BP_DIS_CAP))
return BP_NOT_CAP;
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (dis_param)
ret = dis_bypass_cap(pbpctl_dev);
@@ -4467,7 +4468,8 @@ int set_bypass_pwoff_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode)

if (!(pbpctl_dev->bp_caps & BP_PWOFF_CTL_CAP))
return BP_NOT_CAP;
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (bypass_mode)
ret = bypass_state_pwroff(pbpctl_dev);
@@ -4493,7 +4495,8 @@ int set_bypass_pwup_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode)

if (!(pbpctl_dev->bp_caps & BP_PWUP_CTL_CAP))
return BP_NOT_CAP;
- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (bypass_mode)
ret = bypass_state_pwron(pbpctl_dev);
@@ -4520,7 +4523,8 @@ int set_bypass_wd_fn(bpctl_dev_t *pbpctl_dev, int timeout)
if (!(pbpctl_dev->bp_caps & WD_CTL_CAP))
return BP_NOT_CAP;

- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (!timeout)
ret = wdt_off(pbpctl_dev);
@@ -4589,7 +4593,8 @@ int set_std_nic_fn(bpctl_dev_t *pbpctl_dev, int nic_mode)
if (!(pbpctl_dev->bp_caps & STD_NIC_CAP))
return BP_NOT_CAP;

- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
if (nic_mode)
ret = std_nic_on(pbpctl_dev);
@@ -4655,7 +4660,8 @@ int get_tap_pwup_fn(bpctl_dev_t *pbpctl_dev)
if (!pbpctl_dev)
return -1;

- if ((ret = default_pwron_tap_status(pbpctl_dev)) < 0)
+ ret = default_pwron_tap_status(pbpctl_dev);
+ if (ret < 0)
return ret;
return ((ret == 0) ? 1 : 0);
}
@@ -4830,7 +4836,8 @@ int get_disc_port_pwup_fn(bpctl_dev_t *pbpctl_dev)
if (!pbpctl_dev)
return -1;

- if ((ret = default_pwron_disc_port_status(pbpctl_dev)) < 0)
+ ret = default_pwron_disc_port_status(pbpctl_dev);
+ if (ret < 0)
return ret;
return ((ret == 0) ? 1 : 0);
}
@@ -4857,7 +4864,8 @@ int reset_cont_fn(bpctl_dev_t *pbpctl_dev)
if (!pbpctl_dev)
return -1;

- if ((ret = cmnd_on(pbpctl_dev)) < 0)
+ ret = cmnd_on(pbpctl_dev);
+ if (ret < 0)
return ret;
return reset_cont(pbpctl_dev);
}
@@ -4873,8 +4881,10 @@ int set_tx_fn(bpctl_dev_t *pbpctl_dev, int tx_state)
(pbpctl_dev->bp_caps & SW_CTL_CAP)) {
if ((pbpctl_dev->bp_tpl_flag))
return BP_NOT_CAP;
- } else if ((pbpctl_dev_b = get_master_port_fn(pbpctl_dev))) {
- if ((pbpctl_dev_b->bp_caps & TPL_CAP) &&
+ } else {
+ pbpctl_dev_b = get_master_port_fn(pbpctl_dev);
+ if (pbpctl_dev_b &&
+ (pbpctl_dev_b->bp_caps & TPL_CAP) &&
(pbpctl_dev_b->bp_tpl_flag))
return BP_NOT_CAP;
}
@@ -4990,8 +5000,10 @@ int get_tx_fn(bpctl_dev_t *pbpctl_dev)
(pbpctl_dev->bp_caps & SW_CTL_CAP)) {
if ((pbpctl_dev->bp_tpl_flag))
return BP_NOT_CAP;
- } else if ((pbpctl_dev_b = get_master_port_fn(pbpctl_dev))) {
- if ((pbpctl_dev_b->bp_caps & TPL_CAP) &&
+ } else {
+ pbpctl_dev_b = get_master_port_fn(pbpctl_dev);
+ if (pbpctl_dev_b &&
+ (pbpctl_dev_b->bp_caps & TPL_CAP) &&
(pbpctl_dev_b->bp_tpl_flag))
return BP_NOT_CAP;
}
@@ -5030,7 +5042,8 @@ static void bp_tpl_timer_fn(unsigned long param)
uint32_t link1, link2;
bpctl_dev_t *pbpctl_dev_b = NULL;

- if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (!pbpctl_dev_b)
return;

if (!pbpctl_dev->bp_tpl_flag) {
@@ -5130,7 +5143,8 @@ int set_tpl_fn(bpctl_dev_t *pbpctl_dev, int tpl_mode)

if (pbpctl_dev->bp_caps & TPL_CAP) {
if (tpl_mode) {
- if ((pbpctl_dev_b = get_status_port_fn(pbpctl_dev)))
+ pbpctl_dev_b = get_status_port_fn(pbpctl_dev);
+ if (pbpctl_dev_b)
set_tx(pbpctl_dev_b, 1);
set_tx(pbpctl_dev, 1);
}
@@ -6710,7 +6724,8 @@ static int init_one(bpctl_dev_t *dev, bpmod_info_t *info, struct pci_dev *pdev1)
reset_cont(dev);
}
#ifdef BP_SELF_TEST
- if ((dev->bp_tx_data = kzalloc(BPTEST_DATA_LEN, GFP_KERNEL))) {
+ dev->bp_tx_data = kzalloc(BPTEST_DATA_LEN, GFP_KERNEL);
+ if (dev->bp_tx_data) {
memset(dev->bp_tx_data, 0xff, 6);
memset(dev->bp_tx_data + 6, 0x0, 1);
memset(dev->bp_tx_data + 7, 0xaa, 5);
--
1.8.1.4

2013-06-18 18:40:13

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/4] Staging: silicom: whitespace fixes in bpctl_mod.c

On Mon, Jun 17, 2013 at 10:32:03PM -0500, Chad Williamson wrote:
> Two trivial whitespace fixes in bpctl_mod.c for the sake of
> checkpatch.pl happiness, etc.
>
> Signed-off-by: Chad Williamson <[email protected]>

This one failed to apply :(

2013-06-18 18:42:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 0/4] Staging: silicom: coding style cleanup

On Tue, Jun 18, 2013 at 09:13:00AM -0500, Chad Williamson wrote:
> Chad Williamson (4):
> ? Staging: silicom: remove unnecessary braces in bpctl_mod.c
> ? Staging: silicom: whitespace fixes in bpctl_mod.c
> ? Staging: silicom: move assignments out of if conditions
> ? Staging: silicom: move more assignments out of if conditions
>
> ?drivers/staging/silicom/bpctl_mod.c | 171
> ++++++++++++++++++++----------------
> ?1 file changed, 94 insertions(+), 77 deletions(-)
>
> ?
> Hmm... It seems this patchset collides with Lorenz Haspel and Michael Banken's
> work already well under review, so feel free to disregard it.

Only the 2nd patch wouldn't apply, so feel free to respin that one.

thanks,

greg k-h