]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
e1000e/ixgb: fix assignment of 0/1 to bool variables.
authorJoe Jin <joe.jin@oracle.com>
Thu, 17 May 2012 03:18:27 +0000 (11:18 +0800)
committerJoe Jin <joe.jin@oracle.com>
Thu, 17 May 2012 03:18:27 +0000 (11:18 +0800)
DaveM said:
   Please, this kind of stuff rots forever and not using bool properly
   drives me crazy.

Joe Perches <joe@perches.com> gave me the spatch script:

@@
bool b;
@@
-b = 0
+b = false
@@
bool b;
@@
-b = 1
+b = true

I merely installed coccinelle, read the documentation and took credit.

(backported from commit 3db1cd5c05f35fb43eb134df6f321de4e63141f2)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
drivers/net/e1000/e1000_main.c
drivers/net/e1000e/netdev.c
drivers/net/ixgb/ixgb_main.c

index fb7f82b94c5d8a8138b2eaf8c2d18320a1132c47..130f1ad2f598a2d28d17546ff8cb76b0d110b944 100644 (file)
@@ -1180,7 +1180,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
                if (global_quad_port_a != 0)
                        adapter->eeprom_wol = 0;
                else
-                       adapter->quad_port_a = 1;
+                       adapter->quad_port_a = true;
                /* Reset for multiple quad port adapters */
                if (++global_quad_port_a == 4)
                        global_quad_port_a = 0;
@@ -1674,7 +1674,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
         * need this to apply a workaround later in the send path. */
        if (hw->mac_type == e1000_82544 &&
            hw->bus_type == e1000_bus_type_pcix)
-               adapter->pcix_82544 = 1;
+               adapter->pcix_82544 = true;
 
        ew32(TCTL, tctl);
 
@@ -1997,7 +1997,7 @@ static void e1000_clean_tx_ring(struct e1000_adapter *adapter,
 
        tx_ring->next_to_use = 0;
        tx_ring->next_to_clean = 0;
-       tx_ring->last_tx_tso = 0;
+       tx_ring->last_tx_tso = false;
 
        writel(0, hw->hw_addr + tx_ring->tdh);
        writel(0, hw->hw_addr + tx_ring->tdt);
@@ -2846,7 +2846,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
                 * DMA'd to the controller */
                if (!skb->data_len && tx_ring->last_tx_tso &&
                    !skb_is_gso(skb)) {
-                       tx_ring->last_tx_tso = 0;
+                       tx_ring->last_tx_tso = false;
                        size -= 4;
                }
 
@@ -3206,7 +3206,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
 
        if (likely(tso)) {
                if (likely(hw->mac_type != e1000_82544))
-                       tx_ring->last_tx_tso = 1;
+                       tx_ring->last_tx_tso = true;
                tx_flags |= E1000_TX_FLAGS_TSO;
        } else if (likely(e1000_tx_csum(adapter, tx_ring, skb)))
                tx_flags |= E1000_TX_FLAGS_CSUM;
index 125abed180f6b41065ddcd980b93e6cab51d4030..d1df57440af9931b51580cb6cc7374d39d0d34f8 100644 (file)
@@ -846,7 +846,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
        u32 length;
        unsigned int i;
        int cleaned_count = 0;
-       bool cleaned = 0;
+       bool cleaned = false;
        unsigned int total_rx_bytes = 0, total_rx_packets = 0;
 
        i = rx_ring->next_to_clean;
@@ -876,7 +876,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
 
                next_buffer = &rx_ring->buffer_info[i];
 
-               cleaned = 1;
+               cleaned = true;
                cleaned_count++;
                dma_unmap_single(&pdev->dev,
                                 buffer_info->dma,
@@ -1136,7 +1136,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
                 * Detect a transmit hang in hardware, this serializes the
                 * check with the clearing of time_stamp and movement of i
                 */
-               adapter->detect_tx_hung = 0;
+               adapter->detect_tx_hung = false;
                if (tx_ring->buffer_info[i].time_stamp &&
                    time_after(jiffies, tx_ring->buffer_info[i].time_stamp
                               + (adapter->tx_timeout_factor * HZ)) &&
@@ -1171,7 +1171,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
        unsigned int i, j;
        u32 length, staterr;
        int cleaned_count = 0;
-       bool cleaned = 0;
+       bool cleaned = false;
        unsigned int total_rx_bytes = 0, total_rx_packets = 0;
 
        i = rx_ring->next_to_clean;
@@ -1197,7 +1197,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
 
                next_buffer = &rx_ring->buffer_info[i];
 
-               cleaned = 1;
+               cleaned = true;
                cleaned_count++;
                dma_unmap_single(&pdev->dev, buffer_info->dma,
                                 adapter->rx_ps_bsize0, DMA_FROM_DEVICE);
@@ -4171,7 +4171,7 @@ static void e1000_print_link_info(struct e1000_adapter *adapter)
 static bool e1000e_has_link(struct e1000_adapter *adapter)
 {
        struct e1000_hw *hw = &adapter->hw;
-       bool link_active = 0;
+       bool link_active = false;
        s32 ret_val = 0;
 
        /*
@@ -4186,7 +4186,7 @@ static bool e1000e_has_link(struct e1000_adapter *adapter)
                        ret_val = hw->mac.ops.check_for_link(hw);
                        link_active = !hw->mac.get_link_status;
                } else {
-                       link_active = 1;
+                       link_active = true;
                }
                break;
        case e1000_media_type_fiber:
@@ -4285,7 +4285,7 @@ static void e1000_watchdog_task(struct work_struct *work)
 
        if (link) {
                if (!netif_carrier_ok(netdev)) {
-                       bool txb2b = 1;
+                       bool txb2b = true;
 
                        /* Cancel scheduled suspend requests. */
                        pm_runtime_resume(netdev->dev.parent);
@@ -4321,11 +4321,11 @@ static void e1000_watchdog_task(struct work_struct *work)
                        adapter->tx_timeout_factor = 1;
                        switch (adapter->link_speed) {
                        case SPEED_10:
-                               txb2b = 0;
+                               txb2b = false;
                                adapter->tx_timeout_factor = 16;
                                break;
                        case SPEED_100:
-                               txb2b = 0;
+                               txb2b = false;
                                adapter->tx_timeout_factor = 10;
                                break;
                        }
@@ -4461,7 +4461,7 @@ link_up:
        e1000e_flush_descriptors(adapter);
 
        /* Force detection of hung controller every watchdog period */
-       adapter->detect_tx_hung = 1;
+       adapter->detect_tx_hung = true;
 
        /*
         * With 82571 controllers, LAA may be overwritten due to controller
@@ -6099,7 +6099,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 
        /* Initialize link parameters. User can change them with ethtool */
        adapter->hw.mac.autoneg = 1;
-       adapter->fc_autoneg = 1;
+       adapter->fc_autoneg = true;
        adapter->hw.fc.requested_mode = e1000_fc_default;
        adapter->hw.fc.current_mode = e1000_fc_default;
        adapter->hw.phy.autoneg_advertised = 0x2f;
index 6a130eb51cfaef41c556f81b5f19bfc26a3f926b..bc633b2ef58c4407d8356f9e2f61618ef56c5af1 100644 (file)
@@ -228,7 +228,7 @@ ixgb_up(struct ixgb_adapter *adapter)
        if (IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_PCIX_MODE) {
                err = pci_enable_msi(adapter->pdev);
                if (!err) {
-                       adapter->have_msi = 1;
+                       adapter->have_msi = true;
                        irq_flags = 0;
                }
                /* proceed to try to request regular interrupt */