diff options
author | Chad Williamson <chad@dahc.us> | 2013-06-17 23:32:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-18 14:40:26 -0400 |
commit | 3f3c1fc9adf65cb31565e08803cd20b7016e8f76 (patch) | |
tree | 8f1e79be003245f626137150c4013a877b9109b0 | |
parent | ea675ee5b8e2f9eb3d30df48f73b871df1aac3ac (diff) |
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 <chad@dahc.us>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/silicom/bpctl_mod.c | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c index 9c10cdd74fa4..c42f362572bd 100644 --- a/drivers/staging/silicom/bpctl_mod.c +++ b/drivers/staging/silicom/bpctl_mod.c | |||
@@ -307,7 +307,8 @@ static void write_pulse(bpctl_dev_t *pbpctl_dev, | |||
307 | ctrl = BP10G_READ_REG(pbpctl_dev, ESDP); | 307 | ctrl = BP10G_READ_REG(pbpctl_dev, ESDP); |
308 | 308 | ||
309 | if (pbpctl_dev->bp_10g9) { | 309 | if (pbpctl_dev->bp_10g9) { |
310 | if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev))) | 310 | pbpctl_dev_c = get_status_port_fn(pbpctl_dev); |
311 | if (!pbpctl_dev_c) | ||
311 | return; | 312 | return; |
312 | ctrl = BP10G_READ_REG(pbpctl_dev_c, ESDP); | 313 | ctrl = BP10G_READ_REG(pbpctl_dev_c, ESDP); |
313 | } | 314 | } |
@@ -607,7 +608,8 @@ static int read_pulse(bpctl_dev_t *pbpctl_dev, unsigned int ctrl_ext, | |||
607 | if (pbpctl_dev->bp_540) | 608 | if (pbpctl_dev->bp_540) |
608 | ctrl = BP10G_READ_REG(pbpctl_dev, ESDP); | 609 | ctrl = BP10G_READ_REG(pbpctl_dev, ESDP); |
609 | if (pbpctl_dev->bp_10g9) { | 610 | if (pbpctl_dev->bp_10g9) { |
610 | if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev))) | 611 | pbpctl_dev_c = get_status_port_fn(pbpctl_dev); |
612 | if (!pbpctl_dev_c) | ||
611 | return -1; | 613 | return -1; |
612 | ctrl = BP10G_READ_REG(pbpctl_dev_c, ESDP); | 614 | ctrl = BP10G_READ_REG(pbpctl_dev_c, ESDP); |
613 | } | 615 | } |
@@ -775,7 +777,8 @@ static void write_reg(bpctl_dev_t *pbpctl_dev, unsigned char value, | |||
775 | bpctl_dev_t *pbpctl_dev_c = NULL; | 777 | bpctl_dev_t *pbpctl_dev_c = NULL; |
776 | unsigned long flags; | 778 | unsigned long flags; |
777 | if (pbpctl_dev->bp_10g9) { | 779 | if (pbpctl_dev->bp_10g9) { |
778 | if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev))) | 780 | pbpctl_dev_c = get_status_port_fn(pbpctl_dev); |
781 | if (!pbpctl_dev_c) | ||
779 | return; | 782 | return; |
780 | } | 783 | } |
781 | if ((pbpctl_dev->wdt_status == WDT_STATUS_EN) && | 784 | if ((pbpctl_dev->wdt_status == WDT_STATUS_EN) && |
@@ -953,7 +956,8 @@ static int read_reg(bpctl_dev_t *pbpctl_dev, unsigned char addr) | |||
953 | atomic_set(&pbpctl_dev->wdt_busy, 1); | 956 | atomic_set(&pbpctl_dev->wdt_busy, 1); |
954 | #endif | 957 | #endif |
955 | if (pbpctl_dev->bp_10g9) { | 958 | if (pbpctl_dev->bp_10g9) { |
956 | if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev))) | 959 | pbpctl_dev_c = get_status_port_fn(pbpctl_dev); |
960 | if (!pbpctl_dev_c) | ||
957 | return -1; | 961 | return -1; |
958 | } | 962 | } |
959 | 963 | ||
@@ -1224,7 +1228,8 @@ static int wdt_pulse(bpctl_dev_t *pbpctl_dev) | |||
1224 | return -1; | 1228 | return -1; |
1225 | #endif | 1229 | #endif |
1226 | if (pbpctl_dev->bp_10g9) { | 1230 | if (pbpctl_dev->bp_10g9) { |
1227 | if (!(pbpctl_dev_c = get_status_port_fn(pbpctl_dev))) | 1231 | pbpctl_dev_c = get_status_port_fn(pbpctl_dev); |
1232 | if (!pbpctl_dev_c) | ||
1228 | return -1; | 1233 | return -1; |
1229 | } | 1234 | } |
1230 | 1235 | ||
@@ -1744,7 +1749,8 @@ static int write_data_int(bpctl_dev_t *pbpctl_dev, unsigned char value) | |||
1744 | { | 1749 | { |
1745 | bpctl_dev_t *pbpctl_dev_b = NULL; | 1750 | bpctl_dev_t *pbpctl_dev_b = NULL; |
1746 | 1751 | ||
1747 | if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) | 1752 | pbpctl_dev_b = get_status_port_fn(pbpctl_dev); |
1753 | if (!pbpctl_dev_b) | ||
1748 | return -1; | 1754 | return -1; |
1749 | atomic_set(&pbpctl_dev->wdt_busy, 1); | 1755 | atomic_set(&pbpctl_dev->wdt_busy, 1); |
1750 | write_data_port_int(pbpctl_dev, value & 0x3); | 1756 | write_data_port_int(pbpctl_dev, value & 0x3); |
@@ -1962,7 +1968,8 @@ int tpl_hw_on(bpctl_dev_t *pbpctl_dev) | |||
1962 | int ret = 0, ctrl = 0; | 1968 | int ret = 0, ctrl = 0; |
1963 | bpctl_dev_t *pbpctl_dev_b = NULL; | 1969 | bpctl_dev_t *pbpctl_dev_b = NULL; |
1964 | 1970 | ||
1965 | if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) | 1971 | pbpctl_dev_b = get_status_port_fn(pbpctl_dev); |
1972 | if (!pbpctl_dev_b) | ||
1966 | return BP_NOT_CAP; | 1973 | return BP_NOT_CAP; |
1967 | 1974 | ||
1968 | if (pbpctl_dev->bp_caps_ex & TPL2_CAP_EX) { | 1975 | if (pbpctl_dev->bp_caps_ex & TPL2_CAP_EX) { |
@@ -1989,7 +1996,8 @@ int tpl_hw_off(bpctl_dev_t *pbpctl_dev) | |||
1989 | int ret = 0, ctrl = 0; | 1996 | int ret = 0, ctrl = 0; |
1990 | bpctl_dev_t *pbpctl_dev_b = NULL; | 1997 | bpctl_dev_t *pbpctl_dev_b = NULL; |
1991 | 1998 | ||
1992 | if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) | 1999 | pbpctl_dev_b = get_status_port_fn(pbpctl_dev); |
2000 | if (!pbpctl_dev_b) | ||
1993 | return BP_NOT_CAP; | 2001 | return BP_NOT_CAP; |
1994 | if (pbpctl_dev->bp_caps_ex & TPL2_CAP_EX) { | 2002 | if (pbpctl_dev->bp_caps_ex & TPL2_CAP_EX) { |
1995 | cmnd_on(pbpctl_dev); | 2003 | cmnd_on(pbpctl_dev); |
@@ -3234,8 +3242,10 @@ int bypass_from_last_read(bpctl_dev_t *pbpctl_dev) | |||
3234 | uint32_t ctrl_ext = 0; | 3242 | uint32_t ctrl_ext = 0; |
3235 | bpctl_dev_t *pbpctl_dev_b = NULL; | 3243 | bpctl_dev_t *pbpctl_dev_b = NULL; |
3236 | 3244 | ||
3237 | if ((pbpctl_dev->bp_caps & SW_CTL_CAP) | 3245 | if (pbpctl_dev->bp_caps & SW_CTL_CAP) { |
3238 | && (pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) { | 3246 | pbpctl_dev_b = get_status_port_fn(pbpctl_dev); |
3247 | if (!pbpctl_dev_b) | ||
3248 | return BP_NOT_CAP; | ||
3239 | ctrl_ext = BPCTL_READ_REG(pbpctl_dev_b, CTRL_EXT); | 3249 | ctrl_ext = BPCTL_READ_REG(pbpctl_dev_b, CTRL_EXT); |
3240 | BPCTL_BP_WRITE_REG(pbpctl_dev_b, CTRL_EXT, | 3250 | BPCTL_BP_WRITE_REG(pbpctl_dev_b, CTRL_EXT, |
3241 | (ctrl_ext & ~BPCTLI_CTRL_EXT_SDP7_DIR)); | 3251 | (ctrl_ext & ~BPCTLI_CTRL_EXT_SDP7_DIR)); |
@@ -3251,9 +3261,10 @@ int bypass_status_clear(bpctl_dev_t *pbpctl_dev) | |||
3251 | { | 3261 | { |
3252 | bpctl_dev_t *pbpctl_dev_b = NULL; | 3262 | bpctl_dev_t *pbpctl_dev_b = NULL; |
3253 | 3263 | ||
3254 | if ((pbpctl_dev->bp_caps & SW_CTL_CAP) | 3264 | if (pbpctl_dev->bp_caps & SW_CTL_CAP) { |
3255 | && (pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) { | 3265 | pbpctl_dev_b = get_status_port_fn(pbpctl_dev); |
3256 | 3266 | if (!pbpctl_dev_b) | |
3267 | return BP_NOT_CAP; | ||
3257 | send_bypass_clear_pulse(pbpctl_dev_b, 1); | 3268 | send_bypass_clear_pulse(pbpctl_dev_b, 1); |
3258 | return 0; | 3269 | return 0; |
3259 | } else | 3270 | } else |
@@ -3326,7 +3337,8 @@ static int bypass_status(bpctl_dev_t *pbpctl_dev) | |||
3326 | 3337 | ||
3327 | bpctl_dev_t *pbpctl_dev_b = NULL; | 3338 | bpctl_dev_t *pbpctl_dev_b = NULL; |
3328 | 3339 | ||
3329 | if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) | 3340 | pbpctl_dev_b = get_status_port_fn(pbpctl_dev); |
3341 | if (!pbpctl_dev_b) | ||
3330 | return BP_NOT_CAP; | 3342 | return BP_NOT_CAP; |
3331 | 3343 | ||
3332 | if (INTEL_IF_SERIES(pbpctl_dev->subdevice)) { | 3344 | if (INTEL_IF_SERIES(pbpctl_dev->subdevice)) { |
@@ -3614,7 +3626,8 @@ int tap_status(bpctl_dev_t *pbpctl_dev) | |||
3614 | if (pbpctl_dev->bp_caps & TAP_CAP) { | 3626 | if (pbpctl_dev->bp_caps & TAP_CAP) { |
3615 | bpctl_dev_t *pbpctl_dev_b = NULL; | 3627 | bpctl_dev_t *pbpctl_dev_b = NULL; |
3616 | 3628 | ||
3617 | if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) | 3629 | pbpctl_dev_b = get_status_port_fn(pbpctl_dev); |
3630 | if (!pbpctl_dev_b) | ||
3618 | return BP_NOT_CAP; | 3631 | return BP_NOT_CAP; |
3619 | 3632 | ||
3620 | if (pbpctl_dev->bp_ext_ver >= 0x8) { | 3633 | if (pbpctl_dev->bp_ext_ver >= 0x8) { |
@@ -3710,7 +3723,8 @@ int disc_off_status(bpctl_dev_t *pbpctl_dev) | |||
3710 | u32 ctrl_ext = 0; | 3723 | u32 ctrl_ext = 0; |
3711 | 3724 | ||
3712 | if (pbpctl_dev->bp_caps & DISC_CAP) { | 3725 | if (pbpctl_dev->bp_caps & DISC_CAP) { |
3713 | if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) | 3726 | pbpctl_dev_b = get_status_port_fn(pbpctl_dev); |
3727 | if (!pbpctl_dev_b) | ||
3714 | return BP_NOT_CAP; | 3728 | return BP_NOT_CAP; |
3715 | if (DISCF_IF_SERIES(pbpctl_dev->subdevice)) | 3729 | if (DISCF_IF_SERIES(pbpctl_dev->subdevice)) |
3716 | return ((((read_reg(pbpctl_dev, STATUS_DISC_REG_ADDR)) & | 3730 | return ((((read_reg(pbpctl_dev, STATUS_DISC_REG_ADDR)) & |
@@ -3791,11 +3805,10 @@ static int disc_status(bpctl_dev_t *pbpctl_dev) | |||
3791 | { | 3805 | { |
3792 | int ctrl = 0; | 3806 | int ctrl = 0; |
3793 | if (pbpctl_dev->bp_caps & DISC_CAP) { | 3807 | if (pbpctl_dev->bp_caps & DISC_CAP) { |
3794 | 3808 | ctrl = disc_off_status(pbpctl_dev); | |
3795 | if ((ctrl = disc_off_status(pbpctl_dev)) < 0) | 3809 | if (ctrl < 0) |
3796 | return ctrl; | 3810 | return ctrl; |
3797 | return ((ctrl == 0) ? 1 : 0); | 3811 | return ((ctrl == 0) ? 1 : 0); |
3798 | |||
3799 | } | 3812 | } |
3800 | return BP_NOT_CAP; | 3813 | return BP_NOT_CAP; |
3801 | } | 3814 | } |
@@ -3908,7 +3921,8 @@ int tpl_hw_status(bpctl_dev_t *pbpctl_dev) | |||
3908 | { | 3921 | { |
3909 | bpctl_dev_t *pbpctl_dev_b = NULL; | 3922 | bpctl_dev_t *pbpctl_dev_b = NULL; |
3910 | 3923 | ||
3911 | if (!(pbpctl_dev_b = get_status_port_fn(pbpctl_dev))) | 3924 | pbpctl_dev_b = get_status_port_fn(pbpctl_dev); |
3925 | if (!pbpctl_dev_b) | ||
3912 | return BP_NOT_CAP; | 3926 | return BP_NOT_CAP; |
3913 | 3927 | ||
3914 | if (TPL_IF_SERIES(pbpctl_dev->subdevice)) | 3928 | if (TPL_IF_SERIES(pbpctl_dev->subdevice)) |