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/efx.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/efx.c')
-rw-r--r-- | drivers/net/sfc/efx.c | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index d3b76bd58094..7eb11d32debf 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -51,7 +51,7 @@ static struct workqueue_struct *refill_workqueue; | |||
51 | * This sets the default for new devices. It can be controlled later | 51 | * This sets the default for new devices. It can be controlled later |
52 | * using ethtool. | 52 | * using ethtool. |
53 | */ | 53 | */ |
54 | static int lro = 1; | 54 | static int lro = true; |
55 | module_param(lro, int, 0644); | 55 | module_param(lro, int, 0644); |
56 | MODULE_PARM_DESC(lro, "Large receive offload acceleration"); | 56 | MODULE_PARM_DESC(lro, "Large receive offload acceleration"); |
57 | 57 | ||
@@ -64,7 +64,7 @@ MODULE_PARM_DESC(lro, "Large receive offload acceleration"); | |||
64 | * This is forced to 0 for MSI interrupt mode as the interrupt vector | 64 | * This is forced to 0 for MSI interrupt mode as the interrupt vector |
65 | * is not written | 65 | * is not written |
66 | */ | 66 | */ |
67 | static unsigned int separate_tx_and_rx_channels = 1; | 67 | static unsigned int separate_tx_and_rx_channels = true; |
68 | 68 | ||
69 | /* This is the weight assigned to each of the (per-channel) virtual | 69 | /* This is the weight assigned to each of the (per-channel) virtual |
70 | * NAPI devices. | 70 | * NAPI devices. |
@@ -80,7 +80,7 @@ unsigned int efx_monitor_interval = 1 * HZ; | |||
80 | /* This controls whether or not the hardware monitor will trigger a | 80 | /* This controls whether or not the hardware monitor will trigger a |
81 | * reset when it detects an error condition. | 81 | * reset when it detects an error condition. |
82 | */ | 82 | */ |
83 | static unsigned int monitor_reset = 1; | 83 | static unsigned int monitor_reset = true; |
84 | 84 | ||
85 | /* This controls whether or not the driver will initialise devices | 85 | /* This controls whether or not the driver will initialise devices |
86 | * with invalid MAC addresses stored in the EEPROM or flash. If true, | 86 | * with invalid MAC addresses stored in the EEPROM or flash. If true, |
@@ -202,7 +202,7 @@ static inline void efx_channel_processed(struct efx_channel *channel) | |||
202 | /* The interrupt handler for this channel may set work_pending | 202 | /* The interrupt handler for this channel may set work_pending |
203 | * as soon as we acknowledge the events we've seen. Make sure | 203 | * as soon as we acknowledge the events we've seen. Make sure |
204 | * it's cleared before then. */ | 204 | * it's cleared before then. */ |
205 | channel->work_pending = 0; | 205 | channel->work_pending = false; |
206 | smp_wmb(); | 206 | smp_wmb(); |
207 | 207 | ||
208 | falcon_eventq_read_ack(channel); | 208 | falcon_eventq_read_ack(channel); |
@@ -431,8 +431,8 @@ static void efx_start_channel(struct efx_channel *channel) | |||
431 | /* The interrupt handler for this channel may set work_pending | 431 | /* The interrupt handler for this channel may set work_pending |
432 | * as soon as we enable it. Make sure it's cleared before | 432 | * as soon as we enable it. Make sure it's cleared before |
433 | * then. Similarly, make sure it sees the enabled flag set. */ | 433 | * then. Similarly, make sure it sees the enabled flag set. */ |
434 | channel->work_pending = 0; | 434 | channel->work_pending = false; |
435 | channel->enabled = 1; | 435 | channel->enabled = true; |
436 | smp_wmb(); | 436 | smp_wmb(); |
437 | 437 | ||
438 | napi_enable(&channel->napi_str); | 438 | napi_enable(&channel->napi_str); |
@@ -455,7 +455,7 @@ static void efx_stop_channel(struct efx_channel *channel) | |||
455 | 455 | ||
456 | EFX_LOG(channel->efx, "stop chan %d\n", channel->channel); | 456 | EFX_LOG(channel->efx, "stop chan %d\n", channel->channel); |
457 | 457 | ||
458 | channel->enabled = 0; | 458 | channel->enabled = false; |
459 | napi_disable(&channel->napi_str); | 459 | napi_disable(&channel->napi_str); |
460 | 460 | ||
461 | /* Ensure that any worker threads have exited or will be no-ops */ | 461 | /* Ensure that any worker threads have exited or will be no-ops */ |
@@ -525,8 +525,6 @@ void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue, int delay) | |||
525 | */ | 525 | */ |
526 | static void efx_link_status_changed(struct efx_nic *efx) | 526 | static void efx_link_status_changed(struct efx_nic *efx) |
527 | { | 527 | { |
528 | int carrier_ok; | ||
529 | |||
530 | /* SFC Bug 5356: A net_dev notifier is registered, so we must ensure | 528 | /* SFC Bug 5356: A net_dev notifier is registered, so we must ensure |
531 | * that no events are triggered between unregister_netdev() and the | 529 | * that no events are triggered between unregister_netdev() and the |
532 | * driver unloading. A more general condition is that NETDEV_CHANGE | 530 | * driver unloading. A more general condition is that NETDEV_CHANGE |
@@ -534,8 +532,7 @@ static void efx_link_status_changed(struct efx_nic *efx) | |||
534 | if (!netif_running(efx->net_dev)) | 532 | if (!netif_running(efx->net_dev)) |
535 | return; | 533 | return; |
536 | 534 | ||
537 | carrier_ok = netif_carrier_ok(efx->net_dev) ? 1 : 0; | 535 | if (efx->link_up != netif_carrier_ok(efx->net_dev)) { |
538 | if (efx->link_up != carrier_ok) { | ||
539 | efx->n_link_state_changes++; | 536 | efx->n_link_state_changes++; |
540 | 537 | ||
541 | if (efx->link_up) | 538 | if (efx->link_up) |
@@ -660,7 +657,7 @@ static int efx_init_port(struct efx_nic *efx) | |||
660 | if (rc) | 657 | if (rc) |
661 | return rc; | 658 | return rc; |
662 | 659 | ||
663 | efx->port_initialized = 1; | 660 | efx->port_initialized = true; |
664 | 661 | ||
665 | /* Reconfigure port to program MAC registers */ | 662 | /* Reconfigure port to program MAC registers */ |
666 | falcon_reconfigure_xmac(efx); | 663 | falcon_reconfigure_xmac(efx); |
@@ -677,7 +674,7 @@ static void efx_start_port(struct efx_nic *efx) | |||
677 | BUG_ON(efx->port_enabled); | 674 | BUG_ON(efx->port_enabled); |
678 | 675 | ||
679 | mutex_lock(&efx->mac_lock); | 676 | mutex_lock(&efx->mac_lock); |
680 | efx->port_enabled = 1; | 677 | efx->port_enabled = true; |
681 | __efx_reconfigure_port(efx); | 678 | __efx_reconfigure_port(efx); |
682 | mutex_unlock(&efx->mac_lock); | 679 | mutex_unlock(&efx->mac_lock); |
683 | } | 680 | } |
@@ -691,7 +688,7 @@ static void efx_stop_port(struct efx_nic *efx) | |||
691 | EFX_LOG(efx, "stop port\n"); | 688 | EFX_LOG(efx, "stop port\n"); |
692 | 689 | ||
693 | mutex_lock(&efx->mac_lock); | 690 | mutex_lock(&efx->mac_lock); |
694 | efx->port_enabled = 0; | 691 | efx->port_enabled = false; |
695 | mutex_unlock(&efx->mac_lock); | 692 | mutex_unlock(&efx->mac_lock); |
696 | 693 | ||
697 | /* Serialise against efx_set_multicast_list() */ | 694 | /* Serialise against efx_set_multicast_list() */ |
@@ -709,9 +706,9 @@ static void efx_fini_port(struct efx_nic *efx) | |||
709 | return; | 706 | return; |
710 | 707 | ||
711 | falcon_fini_xmac(efx); | 708 | falcon_fini_xmac(efx); |
712 | efx->port_initialized = 0; | 709 | efx->port_initialized = false; |
713 | 710 | ||
714 | efx->link_up = 0; | 711 | efx->link_up = false; |
715 | efx_link_status_changed(efx); | 712 | efx_link_status_changed(efx); |
716 | } | 713 | } |
717 | 714 | ||
@@ -866,7 +863,7 @@ static void efx_probe_interrupts(struct efx_nic *efx) | |||
866 | 863 | ||
867 | if (rc == 0) { | 864 | if (rc == 0) { |
868 | for (i = 0; i < efx->rss_queues; i++) { | 865 | for (i = 0; i < efx->rss_queues; i++) { |
869 | efx->channel[i].has_interrupt = 1; | 866 | efx->channel[i].has_interrupt = true; |
870 | efx->channel[i].irq = xentries[i].vector; | 867 | efx->channel[i].irq = xentries[i].vector; |
871 | } | 868 | } |
872 | } else { | 869 | } else { |
@@ -882,7 +879,7 @@ static void efx_probe_interrupts(struct efx_nic *efx) | |||
882 | rc = pci_enable_msi(efx->pci_dev); | 879 | rc = pci_enable_msi(efx->pci_dev); |
883 | if (rc == 0) { | 880 | if (rc == 0) { |
884 | efx->channel[0].irq = efx->pci_dev->irq; | 881 | efx->channel[0].irq = efx->pci_dev->irq; |
885 | efx->channel[0].has_interrupt = 1; | 882 | efx->channel[0].has_interrupt = true; |
886 | } else { | 883 | } else { |
887 | EFX_ERR(efx, "could not enable MSI\n"); | 884 | EFX_ERR(efx, "could not enable MSI\n"); |
888 | efx->interrupt_mode = EFX_INT_MODE_LEGACY; | 885 | efx->interrupt_mode = EFX_INT_MODE_LEGACY; |
@@ -894,7 +891,7 @@ static void efx_probe_interrupts(struct efx_nic *efx) | |||
894 | efx->rss_queues = 1; | 891 | efx->rss_queues = 1; |
895 | /* Every channel is interruptible */ | 892 | /* Every channel is interruptible */ |
896 | for (i = 0; i < EFX_MAX_CHANNELS; i++) | 893 | for (i = 0; i < EFX_MAX_CHANNELS; i++) |
897 | efx->channel[i].has_interrupt = 1; | 894 | efx->channel[i].has_interrupt = true; |
898 | efx->legacy_irq = efx->pci_dev->irq; | 895 | efx->legacy_irq = efx->pci_dev->irq; |
899 | } | 896 | } |
900 | } | 897 | } |
@@ -935,7 +932,7 @@ static void efx_select_used(struct efx_nic *efx) | |||
935 | rx_queue = &efx->rx_queue[i]; | 932 | rx_queue = &efx->rx_queue[i]; |
936 | 933 | ||
937 | if (i < efx->rss_queues) { | 934 | if (i < efx->rss_queues) { |
938 | rx_queue->used = 1; | 935 | rx_queue->used = true; |
939 | /* If we allow multiple RX queues per channel | 936 | /* If we allow multiple RX queues per channel |
940 | * we need to decide that here | 937 | * we need to decide that here |
941 | */ | 938 | */ |
@@ -1462,13 +1459,13 @@ static void efx_set_multicast_list(struct net_device *net_dev) | |||
1462 | struct efx_nic *efx = netdev_priv(net_dev); | 1459 | struct efx_nic *efx = netdev_priv(net_dev); |
1463 | struct dev_mc_list *mc_list = net_dev->mc_list; | 1460 | struct dev_mc_list *mc_list = net_dev->mc_list; |
1464 | union efx_multicast_hash *mc_hash = &efx->multicast_hash; | 1461 | union efx_multicast_hash *mc_hash = &efx->multicast_hash; |
1465 | int promiscuous; | 1462 | bool promiscuous; |
1466 | u32 crc; | 1463 | u32 crc; |
1467 | int bit; | 1464 | int bit; |
1468 | int i; | 1465 | int i; |
1469 | 1466 | ||
1470 | /* Set per-MAC promiscuity flag and reconfigure MAC if necessary */ | 1467 | /* Set per-MAC promiscuity flag and reconfigure MAC if necessary */ |
1471 | promiscuous = (net_dev->flags & IFF_PROMISC) ? 1 : 0; | 1468 | promiscuous = !!(net_dev->flags & IFF_PROMISC); |
1472 | if (efx->promiscuous != promiscuous) { | 1469 | if (efx->promiscuous != promiscuous) { |
1473 | efx->promiscuous = promiscuous; | 1470 | efx->promiscuous = promiscuous; |
1474 | /* Close the window between efx_stop_port() and efx_flush_all() | 1471 | /* Close the window between efx_stop_port() and efx_flush_all() |
@@ -1801,7 +1798,7 @@ int efx_port_dummy_op_int(struct efx_nic *efx) | |||
1801 | return 0; | 1798 | return 0; |
1802 | } | 1799 | } |
1803 | void efx_port_dummy_op_void(struct efx_nic *efx) {} | 1800 | void efx_port_dummy_op_void(struct efx_nic *efx) {} |
1804 | void efx_port_dummy_op_blink(struct efx_nic *efx, int blink) {} | 1801 | void efx_port_dummy_op_blink(struct efx_nic *efx, bool blink) {} |
1805 | 1802 | ||
1806 | static struct efx_phy_operations efx_dummy_phy_operations = { | 1803 | static struct efx_phy_operations efx_dummy_phy_operations = { |
1807 | .init = efx_port_dummy_op_int, | 1804 | .init = efx_port_dummy_op_int, |
@@ -1855,7 +1852,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type, | |||
1855 | efx->board_info = efx_dummy_board_info; | 1852 | efx->board_info = efx_dummy_board_info; |
1856 | 1853 | ||
1857 | efx->net_dev = net_dev; | 1854 | efx->net_dev = net_dev; |
1858 | efx->rx_checksum_enabled = 1; | 1855 | efx->rx_checksum_enabled = true; |
1859 | spin_lock_init(&efx->netif_stop_lock); | 1856 | spin_lock_init(&efx->netif_stop_lock); |
1860 | spin_lock_init(&efx->stats_lock); | 1857 | spin_lock_init(&efx->stats_lock); |
1861 | mutex_init(&efx->mac_lock); | 1858 | mutex_init(&efx->mac_lock); |
@@ -1869,7 +1866,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type, | |||
1869 | channel->efx = efx; | 1866 | channel->efx = efx; |
1870 | channel->channel = i; | 1867 | channel->channel = i; |
1871 | channel->evqnum = i; | 1868 | channel->evqnum = i; |
1872 | channel->work_pending = 0; | 1869 | channel->work_pending = false; |
1873 | } | 1870 | } |
1874 | for (i = 0; i < EFX_TX_QUEUE_COUNT; i++) { | 1871 | for (i = 0; i < EFX_TX_QUEUE_COUNT; i++) { |
1875 | tx_queue = &efx->tx_queue[i]; | 1872 | tx_queue = &efx->tx_queue[i]; |