Commit d0941b1e authored by Chad Williamson's avatar Chad Williamson Committed by Greg Kroah-Hartman

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: default avatarChad Williamson <chad@dahc.us>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3f3c1fc9
...@@ -4225,9 +4225,8 @@ void bypass_caps_init(bpctl_dev_t *pbpctl_dev) ...@@ -4225,9 +4225,8 @@ void bypass_caps_init(bpctl_dev_t *pbpctl_dev)
int bypass_off_init(bpctl_dev_t *pbpctl_dev) int bypass_off_init(bpctl_dev_t *pbpctl_dev)
{ {
int ret = 0; int ret = cmnd_on(pbpctl_dev);
if (ret < 0)
if ((ret = cmnd_on(pbpctl_dev)) < 0)
return ret; return ret;
if (INTEL_IF_SERIES(pbpctl_dev->subdevice)) if (INTEL_IF_SERIES(pbpctl_dev->subdevice))
return dis_bypass_cap(pbpctl_dev); return dis_bypass_cap(pbpctl_dev);
...@@ -4412,7 +4411,8 @@ int set_bypass_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode) ...@@ -4412,7 +4411,8 @@ int set_bypass_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode)
if (!(pbpctl_dev->bp_caps & BP_CAP)) if (!(pbpctl_dev->bp_caps & BP_CAP))
return BP_NOT_CAP; return BP_NOT_CAP;
if ((ret = cmnd_on(pbpctl_dev)) < 0) ret = cmnd_on(pbpctl_dev);
if (ret < 0)
return ret; return ret;
if (!bypass_mode) if (!bypass_mode)
ret = bypass_off(pbpctl_dev); ret = bypass_off(pbpctl_dev);
...@@ -4444,7 +4444,8 @@ int set_dis_bypass_fn(bpctl_dev_t *pbpctl_dev, int dis_param) ...@@ -4444,7 +4444,8 @@ int set_dis_bypass_fn(bpctl_dev_t *pbpctl_dev, int dis_param)
if (!(pbpctl_dev->bp_caps & BP_DIS_CAP)) if (!(pbpctl_dev->bp_caps & BP_DIS_CAP))
return BP_NOT_CAP; return BP_NOT_CAP;
if ((ret = cmnd_on(pbpctl_dev)) < 0) ret = cmnd_on(pbpctl_dev);
if (ret < 0)
return ret; return ret;
if (dis_param) if (dis_param)
ret = dis_bypass_cap(pbpctl_dev); ret = dis_bypass_cap(pbpctl_dev);
...@@ -4470,7 +4471,8 @@ int set_bypass_pwoff_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode) ...@@ -4470,7 +4471,8 @@ int set_bypass_pwoff_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode)
if (!(pbpctl_dev->bp_caps & BP_PWOFF_CTL_CAP)) if (!(pbpctl_dev->bp_caps & BP_PWOFF_CTL_CAP))
return BP_NOT_CAP; return BP_NOT_CAP;
if ((ret = cmnd_on(pbpctl_dev)) < 0) ret = cmnd_on(pbpctl_dev);
if (ret < 0)
return ret; return ret;
if (bypass_mode) if (bypass_mode)
ret = bypass_state_pwroff(pbpctl_dev); ret = bypass_state_pwroff(pbpctl_dev);
...@@ -4496,7 +4498,8 @@ int set_bypass_pwup_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode) ...@@ -4496,7 +4498,8 @@ int set_bypass_pwup_fn(bpctl_dev_t *pbpctl_dev, int bypass_mode)
if (!(pbpctl_dev->bp_caps & BP_PWUP_CTL_CAP)) if (!(pbpctl_dev->bp_caps & BP_PWUP_CTL_CAP))
return BP_NOT_CAP; return BP_NOT_CAP;
if ((ret = cmnd_on(pbpctl_dev)) < 0) ret = cmnd_on(pbpctl_dev);
if (ret < 0)
return ret; return ret;
if (bypass_mode) if (bypass_mode)
ret = bypass_state_pwron(pbpctl_dev); ret = bypass_state_pwron(pbpctl_dev);
...@@ -4523,7 +4526,8 @@ int set_bypass_wd_fn(bpctl_dev_t *pbpctl_dev, int timeout) ...@@ -4523,7 +4526,8 @@ int set_bypass_wd_fn(bpctl_dev_t *pbpctl_dev, int timeout)
if (!(pbpctl_dev->bp_caps & WD_CTL_CAP)) if (!(pbpctl_dev->bp_caps & WD_CTL_CAP))
return BP_NOT_CAP; return BP_NOT_CAP;
if ((ret = cmnd_on(pbpctl_dev)) < 0) ret = cmnd_on(pbpctl_dev);
if (ret < 0)
return ret; return ret;
if (!timeout) if (!timeout)
ret = wdt_off(pbpctl_dev); ret = wdt_off(pbpctl_dev);
...@@ -4592,7 +4596,8 @@ int set_std_nic_fn(bpctl_dev_t *pbpctl_dev, int nic_mode) ...@@ -4592,7 +4596,8 @@ int set_std_nic_fn(bpctl_dev_t *pbpctl_dev, int nic_mode)
if (!(pbpctl_dev->bp_caps & STD_NIC_CAP)) if (!(pbpctl_dev->bp_caps & STD_NIC_CAP))
return BP_NOT_CAP; return BP_NOT_CAP;
if ((ret = cmnd_on(pbpctl_dev)) < 0) ret = cmnd_on(pbpctl_dev);
if (ret < 0)
return ret; return ret;
if (nic_mode) if (nic_mode)
ret = std_nic_on(pbpctl_dev); ret = std_nic_on(pbpctl_dev);
...@@ -4658,7 +4663,8 @@ int get_tap_pwup_fn(bpctl_dev_t *pbpctl_dev) ...@@ -4658,7 +4663,8 @@ int get_tap_pwup_fn(bpctl_dev_t *pbpctl_dev)
if (!pbpctl_dev) if (!pbpctl_dev)
return -1; 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;
return ((ret == 0) ? 1 : 0); return ((ret == 0) ? 1 : 0);
} }
...@@ -4833,7 +4839,8 @@ int get_disc_port_pwup_fn(bpctl_dev_t *pbpctl_dev) ...@@ -4833,7 +4839,8 @@ int get_disc_port_pwup_fn(bpctl_dev_t *pbpctl_dev)
if (!pbpctl_dev) if (!pbpctl_dev)
return -1; 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;
return ((ret == 0) ? 1 : 0); return ((ret == 0) ? 1 : 0);
} }
...@@ -4860,7 +4867,8 @@ int reset_cont_fn(bpctl_dev_t *pbpctl_dev) ...@@ -4860,7 +4867,8 @@ int reset_cont_fn(bpctl_dev_t *pbpctl_dev)
if (!pbpctl_dev) if (!pbpctl_dev)
return -1; return -1;
if ((ret = cmnd_on(pbpctl_dev)) < 0) ret = cmnd_on(pbpctl_dev);
if (ret < 0)
return ret; return ret;
return reset_cont(pbpctl_dev); return reset_cont(pbpctl_dev);
} }
...@@ -4876,8 +4884,10 @@ int set_tx_fn(bpctl_dev_t *pbpctl_dev, int tx_state) ...@@ -4876,8 +4884,10 @@ int set_tx_fn(bpctl_dev_t *pbpctl_dev, int tx_state)
(pbpctl_dev->bp_caps & SW_CTL_CAP)) { (pbpctl_dev->bp_caps & SW_CTL_CAP)) {
if ((pbpctl_dev->bp_tpl_flag)) if ((pbpctl_dev->bp_tpl_flag))
return BP_NOT_CAP; return BP_NOT_CAP;
} else if ((pbpctl_dev_b = get_master_port_fn(pbpctl_dev))) { } else {
if ((pbpctl_dev_b->bp_caps & TPL_CAP) && 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)) (pbpctl_dev_b->bp_tpl_flag))
return BP_NOT_CAP; return BP_NOT_CAP;
} }
...@@ -4993,8 +5003,10 @@ int get_tx_fn(bpctl_dev_t *pbpctl_dev) ...@@ -4993,8 +5003,10 @@ int get_tx_fn(bpctl_dev_t *pbpctl_dev)
(pbpctl_dev->bp_caps & SW_CTL_CAP)) { (pbpctl_dev->bp_caps & SW_CTL_CAP)) {
if ((pbpctl_dev->bp_tpl_flag)) if ((pbpctl_dev->bp_tpl_flag))
return BP_NOT_CAP; return BP_NOT_CAP;
} else if ((pbpctl_dev_b = get_master_port_fn(pbpctl_dev))) { } else {
if ((pbpctl_dev_b->bp_caps & TPL_CAP) && 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)) (pbpctl_dev_b->bp_tpl_flag))
return BP_NOT_CAP; return BP_NOT_CAP;
} }
...@@ -5033,7 +5045,8 @@ static void bp_tpl_timer_fn(unsigned long param) ...@@ -5033,7 +5045,8 @@ static void bp_tpl_timer_fn(unsigned long param)
uint32_t link1, link2; uint32_t link1, link2;
bpctl_dev_t *pbpctl_dev_b = NULL; 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; return;
if (!pbpctl_dev->bp_tpl_flag) { if (!pbpctl_dev->bp_tpl_flag) {
...@@ -5133,7 +5146,8 @@ int set_tpl_fn(bpctl_dev_t *pbpctl_dev, int tpl_mode) ...@@ -5133,7 +5146,8 @@ int set_tpl_fn(bpctl_dev_t *pbpctl_dev, int tpl_mode)
if (pbpctl_dev->bp_caps & TPL_CAP) { if (pbpctl_dev->bp_caps & TPL_CAP) {
if (tpl_mode) { 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_b, 1);
set_tx(pbpctl_dev, 1); set_tx(pbpctl_dev, 1);
} }
...@@ -6714,7 +6728,8 @@ static int init_one(bpctl_dev_t *dev, bpmod_info_t *info, struct pci_dev *pdev1) ...@@ -6714,7 +6728,8 @@ static int init_one(bpctl_dev_t *dev, bpmod_info_t *info, struct pci_dev *pdev1)
reset_cont(dev); reset_cont(dev);
} }
#ifdef BP_SELF_TEST #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, 0xff, 6);
memset(dev->bp_tx_data + 6, 0x0, 1); memset(dev->bp_tx_data + 6, 0x0, 1);
memset(dev->bp_tx_data + 7, 0xaa, 5); memset(dev->bp_tx_data + 7, 0xaa, 5);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment