Skip to content

Commit 3db1cd5

Browse files
rustyrusselldavem330
authored andcommitted
net: fix assignment of 0/1 to bool variables.
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. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a8e510f commit 3db1cd5

60 files changed

Lines changed: 288 additions & 288 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/net/ethernet/broadcom/tg3.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6425,13 +6425,13 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget,
64256425
bool hwbug = false;
64266426

64276427
if (tg3_flag(tp, SHORT_DMA_BUG) && len <= 8)
6428-
hwbug = 1;
6428+
hwbug = true;
64296429

64306430
if (tg3_4g_overflow_test(map, len))
6431-
hwbug = 1;
6431+
hwbug = true;
64326432

64336433
if (tg3_40bit_overflow_test(tp, map, len))
6434-
hwbug = 1;
6434+
hwbug = true;
64356435

64366436
if (tp->dma_limit) {
64376437
u32 prvidx = *entry;
@@ -6464,7 +6464,7 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget,
64646464
*budget -= 1;
64656465
*entry = NEXT_TX(*entry);
64666466
} else {
6467-
hwbug = 1;
6467+
hwbug = true;
64686468
tnapi->tx_buffers[prvidx].fragmented = false;
64696469
}
64706470
}

‎drivers/net/ethernet/brocade/bna/bnad.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ void
723723
bnad_cb_ethport_link_status(struct bnad *bnad,
724724
enum bna_link_status link_status)
725725
{
726-
bool link_up = 0;
726+
bool link_up = false;
727727

728728
link_up = (link_status == BNA_LINK_UP) || (link_status == BNA_CEE_UP);
729729

@@ -3190,7 +3190,7 @@ bnad_pci_init(struct bnad *bnad,
31903190
goto disable_device;
31913191
if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) &&
31923192
!dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
3193-
*using_dac = 1;
3193+
*using_dac = true;
31943194
} else {
31953195
err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
31963196
if (err) {
@@ -3199,7 +3199,7 @@ bnad_pci_init(struct bnad *bnad,
31993199
if (err)
32003200
goto release_regions;
32013201
}
3202-
*using_dac = 0;
3202+
*using_dac = false;
32033203
}
32043204
pci_set_master(pdev);
32053205
return 0;

‎drivers/net/ethernet/dec/tulip/de4x5.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5191,7 +5191,7 @@ de4x5_parse_params(struct net_device *dev)
51915191
struct de4x5_private *lp = netdev_priv(dev);
51925192
char *p, *q, t;
51935193

5194-
lp->params.fdx = 0;
5194+
lp->params.fdx = false;
51955195
lp->params.autosense = AUTO;
51965196

51975197
if (args == NULL) return;
@@ -5201,7 +5201,7 @@ de4x5_parse_params(struct net_device *dev)
52015201
t = *q;
52025202
*q = '\0';
52035203

5204-
if (strstr(p, "fdx") || strstr(p, "FDX")) lp->params.fdx = 1;
5204+
if (strstr(p, "fdx") || strstr(p, "FDX")) lp->params.fdx = true;
52055205

52065206
if (strstr(p, "autosense") || strstr(p, "AUTOSENSE")) {
52075207
if (strstr(p, "TP")) {

‎drivers/net/ethernet/intel/e1000/e1000_main.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
11851185
if (global_quad_port_a != 0)
11861186
adapter->eeprom_wol = 0;
11871187
else
1188-
adapter->quad_port_a = 1;
1188+
adapter->quad_port_a = true;
11891189
/* Reset for multiple quad port adapters */
11901190
if (++global_quad_port_a == 4)
11911191
global_quad_port_a = 0;
@@ -1679,7 +1679,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
16791679
* need this to apply a workaround later in the send path. */
16801680
if (hw->mac_type == e1000_82544 &&
16811681
hw->bus_type == e1000_bus_type_pcix)
1682-
adapter->pcix_82544 = 1;
1682+
adapter->pcix_82544 = true;
16831683

16841684
ew32(TCTL, tctl);
16851685

@@ -2002,7 +2002,7 @@ static void e1000_clean_tx_ring(struct e1000_adapter *adapter,
20022002

20032003
tx_ring->next_to_use = 0;
20042004
tx_ring->next_to_clean = 0;
2005-
tx_ring->last_tx_tso = 0;
2005+
tx_ring->last_tx_tso = false;
20062006

20072007
writel(0, hw->hw_addr + tx_ring->tdh);
20082008
writel(0, hw->hw_addr + tx_ring->tdt);
@@ -2851,7 +2851,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
28512851
* DMA'd to the controller */
28522852
if (!skb->data_len && tx_ring->last_tx_tso &&
28532853
!skb_is_gso(skb)) {
2854-
tx_ring->last_tx_tso = 0;
2854+
tx_ring->last_tx_tso = false;
28552855
size -= 4;
28562856
}
28572857

@@ -3219,7 +3219,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb,
32193219

32203220
if (likely(tso)) {
32213221
if (likely(hw->mac_type != e1000_82544))
3222-
tx_ring->last_tx_tso = 1;
3222+
tx_ring->last_tx_tso = true;
32233223
tx_flags |= E1000_TX_FLAGS_TSO;
32243224
} else if (likely(e1000_tx_csum(adapter, tx_ring, skb)))
32253225
tx_flags |= E1000_TX_FLAGS_CSUM;

‎drivers/net/ethernet/intel/e1000e/netdev.c‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
859859
u32 length, staterr;
860860
unsigned int i;
861861
int cleaned_count = 0;
862-
bool cleaned = 0;
862+
bool cleaned = false;
863863
unsigned int total_rx_bytes = 0, total_rx_packets = 0;
864864

865865
i = rx_ring->next_to_clean;
@@ -888,7 +888,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
888888

889889
next_buffer = &rx_ring->buffer_info[i];
890890

891-
cleaned = 1;
891+
cleaned = true;
892892
cleaned_count++;
893893
dma_unmap_single(&pdev->dev,
894894
buffer_info->dma,
@@ -1157,7 +1157,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
11571157
* Detect a transmit hang in hardware, this serializes the
11581158
* check with the clearing of time_stamp and movement of i
11591159
*/
1160-
adapter->detect_tx_hung = 0;
1160+
adapter->detect_tx_hung = false;
11611161
if (tx_ring->buffer_info[i].time_stamp &&
11621162
time_after(jiffies, tx_ring->buffer_info[i].time_stamp
11631163
+ (adapter->tx_timeout_factor * HZ)) &&
@@ -1192,7 +1192,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
11921192
unsigned int i, j;
11931193
u32 length, staterr;
11941194
int cleaned_count = 0;
1195-
bool cleaned = 0;
1195+
bool cleaned = false;
11961196
unsigned int total_rx_bytes = 0, total_rx_packets = 0;
11971197

11981198
i = rx_ring->next_to_clean;
@@ -1218,7 +1218,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
12181218

12191219
next_buffer = &rx_ring->buffer_info[i];
12201220

1221-
cleaned = 1;
1221+
cleaned = true;
12221222
cleaned_count++;
12231223
dma_unmap_single(&pdev->dev, buffer_info->dma,
12241224
adapter->rx_ps_bsize0, DMA_FROM_DEVICE);
@@ -4257,7 +4257,7 @@ static void e1000_print_link_info(struct e1000_adapter *adapter)
42574257
static bool e1000e_has_link(struct e1000_adapter *adapter)
42584258
{
42594259
struct e1000_hw *hw = &adapter->hw;
4260-
bool link_active = 0;
4260+
bool link_active = false;
42614261
s32 ret_val = 0;
42624262

42634263
/*
@@ -4272,7 +4272,7 @@ static bool e1000e_has_link(struct e1000_adapter *adapter)
42724272
ret_val = hw->mac.ops.check_for_link(hw);
42734273
link_active = !hw->mac.get_link_status;
42744274
} else {
4275-
link_active = 1;
4275+
link_active = true;
42764276
}
42774277
break;
42784278
case e1000_media_type_fiber:
@@ -4371,7 +4371,7 @@ static void e1000_watchdog_task(struct work_struct *work)
43714371

43724372
if (link) {
43734373
if (!netif_carrier_ok(netdev)) {
4374-
bool txb2b = 1;
4374+
bool txb2b = true;
43754375

43764376
/* Cancel scheduled suspend requests. */
43774377
pm_runtime_resume(netdev->dev.parent);
@@ -4404,11 +4404,11 @@ static void e1000_watchdog_task(struct work_struct *work)
44044404
adapter->tx_timeout_factor = 1;
44054405
switch (adapter->link_speed) {
44064406
case SPEED_10:
4407-
txb2b = 0;
4407+
txb2b = false;
44084408
adapter->tx_timeout_factor = 16;
44094409
break;
44104410
case SPEED_100:
4411-
txb2b = 0;
4411+
txb2b = false;
44124412
adapter->tx_timeout_factor = 10;
44134413
break;
44144414
}
@@ -4544,7 +4544,7 @@ static void e1000_watchdog_task(struct work_struct *work)
45444544
e1000e_flush_descriptors(adapter);
45454545

45464546
/* Force detection of hung controller every watchdog period */
4547-
adapter->detect_tx_hung = 1;
4547+
adapter->detect_tx_hung = true;
45484548

45494549
/*
45504550
* With 82571 controllers, LAA may be overwritten due to controller
@@ -6208,7 +6208,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
62086208

62096209
/* Initialize link parameters. User can change them with ethtool */
62106210
adapter->hw.mac.autoneg = 1;
6211-
adapter->fc_autoneg = 1;
6211+
adapter->fc_autoneg = true;
62126212
adapter->hw.fc.requested_mode = e1000_fc_default;
62136213
adapter->hw.fc.current_mode = e1000_fc_default;
62146214
adapter->hw.phy.autoneg_advertised = 0x2f;

‎drivers/net/ethernet/intel/ixgb/ixgb_main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ ixgb_up(struct ixgb_adapter *adapter)
228228
if (IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_PCIX_MODE) {
229229
err = pci_enable_msi(adapter->pdev);
230230
if (!err) {
231-
adapter->have_msi = 1;
231+
adapter->have_msi = true;
232232
irq_flags = 0;
233233
}
234234
/* proceed to try to request regular interrupt */

‎drivers/net/ethernet/intel/ixgbe/ixgbe_common.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,7 @@ s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval)
25992599
s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
26002600
{
26012601
ixgbe_link_speed speed = 0;
2602-
bool link_up = 0;
2602+
bool link_up = false;
26032603
u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
26042604
u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
26052605

‎drivers/net/ethernet/intel/ixgbe/ixgbe_main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4023,7 +4023,7 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
40234023

40244024
/* Mark all the VFs as inactive */
40254025
for (i = 0 ; i < adapter->num_vfs; i++)
4026-
adapter->vfinfo[i].clear_to_send = 0;
4026+
adapter->vfinfo[i].clear_to_send = false;
40274027

40284028
/* ping all the active vfs to let them know we are going down */
40294029
ixgbe_ping_all_vfs(adapter);

‎drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,
12141214
u32 max_retry = 10;
12151215
u32 retry = 0;
12161216
u16 swfw_mask = 0;
1217-
bool nack = 1;
1217+
bool nack = true;
12181218
*data = 0;
12191219

12201220
if (IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)
@@ -1421,7 +1421,7 @@ static void ixgbe_i2c_stop(struct ixgbe_hw *hw)
14211421
static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data)
14221422
{
14231423
s32 i;
1424-
bool bit = 0;
1424+
bool bit = false;
14251425

14261426
for (i = 7; i >= 0; i--) {
14271427
ixgbe_clock_in_i2c_bit(hw, &bit);
@@ -1443,7 +1443,7 @@ static s32 ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data)
14431443
s32 status = 0;
14441444
s32 i;
14451445
u32 i2cctl;
1446-
bool bit = 0;
1446+
bool bit = false;
14471447

14481448
for (i = 7; i >= 0; i--) {
14491449
bit = (data >> i) & 0x1;
@@ -1473,7 +1473,7 @@ static s32 ixgbe_get_i2c_ack(struct ixgbe_hw *hw)
14731473
u32 i = 0;
14741474
u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
14751475
u32 timeout = 10;
1476-
bool ack = 1;
1476+
bool ack = true;
14771477

14781478
ixgbe_raise_i2c_clk(hw, &i2cctl);
14791479

@@ -1646,9 +1646,9 @@ static bool ixgbe_get_i2c_data(u32 *i2cctl)
16461646
bool data;
16471647

16481648
if (*i2cctl & IXGBE_I2C_DATA_IN)
1649-
data = 1;
1649+
data = true;
16501650
else
1651-
data = 0;
1651+
data = false;
16521652

16531653
return data;
16541654
}

‎drivers/net/ethernet/sfc/falcon.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static void falcon_stats_complete(struct efx_nic *efx)
610610
if (!nic_data->stats_pending)
611611
return;
612612

613-
nic_data->stats_pending = 0;
613+
nic_data->stats_pending = false;
614614
if (*nic_data->stats_dma_done == FALCON_STATS_DONE) {
615615
rmb(); /* read the done flag before the stats */
616616
efx->mac_op->update_stats(efx);

0 commit comments

Comments
 (0)