diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-09-01 07:46:50 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-03 09:53:45 -0400 |
commit | dc8cfa55da8c21e0b3290c29677a9d05c0a3e595 (patch) | |
tree | a4c8bedad12a15d1e7c9fcfc99f873280ca644b4 /drivers/net/sfc/tenxpress.c | |
parent | cc12dac2e512c2b6185ed91899e09e9910630315 (diff) |
sfc: Use explicit bool for boolean variables, parameters and return values
Replace (cond ? 1 : 0) with cond or !!cond as appropriate, and
(cond ? 0 : 1) with !cond.
Remove some redundant boolean temporaries.
Rename one field that looks like a flag but isn't.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/sfc/tenxpress.c')
-rw-r--r-- | drivers/net/sfc/tenxpress.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c index c0146061c326..b92b24bba9e8 100644 --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c | |||
@@ -122,7 +122,7 @@ struct tenxpress_phy_data { | |||
122 | enum tenxpress_state state; | 122 | enum tenxpress_state state; |
123 | enum efx_loopback_mode loopback_mode; | 123 | enum efx_loopback_mode loopback_mode; |
124 | atomic_t bad_crc_count; | 124 | atomic_t bad_crc_count; |
125 | int tx_disabled; | 125 | bool tx_disabled; |
126 | int bad_lp_tries; | 126 | int bad_lp_tries; |
127 | }; | 127 | }; |
128 | 128 | ||
@@ -274,7 +274,7 @@ static int tenxpress_special_reset(struct efx_nic *efx) | |||
274 | return 0; | 274 | return 0; |
275 | } | 275 | } |
276 | 276 | ||
277 | static void tenxpress_set_bad_lp(struct efx_nic *efx, int bad_lp) | 277 | static void tenxpress_set_bad_lp(struct efx_nic *efx, bool bad_lp) |
278 | { | 278 | { |
279 | struct tenxpress_phy_data *pd = efx->phy_data; | 279 | struct tenxpress_phy_data *pd = efx->phy_data; |
280 | int reg; | 280 | int reg; |
@@ -311,15 +311,15 @@ static void tenxpress_set_bad_lp(struct efx_nic *efx, int bad_lp) | |||
311 | * into a non-10GBT port and if so warn the user that they won't get | 311 | * into a non-10GBT port and if so warn the user that they won't get |
312 | * link any time soon as we are 10GBT only, unless caller specified | 312 | * link any time soon as we are 10GBT only, unless caller specified |
313 | * not to do this check (it isn't useful in loopback) */ | 313 | * not to do this check (it isn't useful in loopback) */ |
314 | static int tenxpress_link_ok(struct efx_nic *efx, int check_lp) | 314 | static bool tenxpress_link_ok(struct efx_nic *efx, bool check_lp) |
315 | { | 315 | { |
316 | int ok = mdio_clause45_links_ok(efx, TENXPRESS_REQUIRED_DEVS); | 316 | bool ok = mdio_clause45_links_ok(efx, TENXPRESS_REQUIRED_DEVS); |
317 | 317 | ||
318 | if (ok) { | 318 | if (ok) { |
319 | tenxpress_set_bad_lp(efx, 0); | 319 | tenxpress_set_bad_lp(efx, false); |
320 | } else if (check_lp) { | 320 | } else if (check_lp) { |
321 | /* Are we plugged into the wrong sort of link? */ | 321 | /* Are we plugged into the wrong sort of link? */ |
322 | int bad_lp = 0; | 322 | bool bad_lp = false; |
323 | int phy_id = efx->mii.phy_id; | 323 | int phy_id = efx->mii.phy_id; |
324 | int an_stat = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, | 324 | int an_stat = mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, |
325 | MDIO_AN_STATUS); | 325 | MDIO_AN_STATUS); |
@@ -332,7 +332,7 @@ static int tenxpress_link_ok(struct efx_nic *efx, int check_lp) | |||
332 | * bit has the advantage of not clearing when autoneg | 332 | * bit has the advantage of not clearing when autoneg |
333 | * restarts. */ | 333 | * restarts. */ |
334 | if (!(xphy_stat & (1 << PMA_PMD_XSTAT_FLP_LBN))) { | 334 | if (!(xphy_stat & (1 << PMA_PMD_XSTAT_FLP_LBN))) { |
335 | tenxpress_set_bad_lp(efx, 0); | 335 | tenxpress_set_bad_lp(efx, false); |
336 | return ok; | 336 | return ok; |
337 | } | 337 | } |
338 | 338 | ||
@@ -367,8 +367,8 @@ static void tenxpress_phyxs_loopback(struct efx_nic *efx) | |||
367 | static void tenxpress_phy_reconfigure(struct efx_nic *efx) | 367 | static void tenxpress_phy_reconfigure(struct efx_nic *efx) |
368 | { | 368 | { |
369 | struct tenxpress_phy_data *phy_data = efx->phy_data; | 369 | struct tenxpress_phy_data *phy_data = efx->phy_data; |
370 | int loop_change = LOOPBACK_OUT_OF(phy_data, efx, | 370 | bool loop_change = LOOPBACK_OUT_OF(phy_data, efx, |
371 | TENXPRESS_LOOPBACKS); | 371 | TENXPRESS_LOOPBACKS); |
372 | 372 | ||
373 | if (!tenxpress_state_is(efx, TENXPRESS_STATUS_NORMAL)) | 373 | if (!tenxpress_state_is(efx, TENXPRESS_STATUS_NORMAL)) |
374 | return; | 374 | return; |
@@ -388,7 +388,7 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx) | |||
388 | 388 | ||
389 | phy_data->tx_disabled = efx->tx_disabled; | 389 | phy_data->tx_disabled = efx->tx_disabled; |
390 | phy_data->loopback_mode = efx->loopback_mode; | 390 | phy_data->loopback_mode = efx->loopback_mode; |
391 | efx->link_up = tenxpress_link_ok(efx, 0); | 391 | efx->link_up = tenxpress_link_ok(efx, false); |
392 | efx->link_options = GM_LPA_10000FULL; | 392 | efx->link_options = GM_LPA_10000FULL; |
393 | } | 393 | } |
394 | 394 | ||
@@ -402,10 +402,10 @@ static void tenxpress_phy_clear_interrupt(struct efx_nic *efx) | |||
402 | static int tenxpress_phy_check_hw(struct efx_nic *efx) | 402 | static int tenxpress_phy_check_hw(struct efx_nic *efx) |
403 | { | 403 | { |
404 | struct tenxpress_phy_data *phy_data = efx->phy_data; | 404 | struct tenxpress_phy_data *phy_data = efx->phy_data; |
405 | int phy_up = tenxpress_state_is(efx, TENXPRESS_STATUS_NORMAL); | 405 | bool phy_up = tenxpress_state_is(efx, TENXPRESS_STATUS_NORMAL); |
406 | int link_ok; | 406 | bool link_ok; |
407 | 407 | ||
408 | link_ok = phy_up && tenxpress_link_ok(efx, 1); | 408 | link_ok = phy_up && tenxpress_link_ok(efx, true); |
409 | 409 | ||
410 | if (link_ok != efx->link_up) | 410 | if (link_ok != efx->link_up) |
411 | falcon_xmac_sim_phy_event(efx); | 411 | falcon_xmac_sim_phy_event(efx); |
@@ -444,7 +444,7 @@ static void tenxpress_phy_fini(struct efx_nic *efx) | |||
444 | 444 | ||
445 | /* Set the RX and TX LEDs and Link LED flashing. The other LEDs | 445 | /* Set the RX and TX LEDs and Link LED flashing. The other LEDs |
446 | * (which probably aren't wired anyway) are left in AUTO mode */ | 446 | * (which probably aren't wired anyway) are left in AUTO mode */ |
447 | void tenxpress_phy_blink(struct efx_nic *efx, int blink) | 447 | void tenxpress_phy_blink(struct efx_nic *efx, bool blink) |
448 | { | 448 | { |
449 | int reg; | 449 | int reg; |
450 | 450 | ||