Skip to content

Commit

Permalink
net: fix assignment of 0/1 to bool variables.
Browse files Browse the repository at this point in the history
DaveM said:
   Please, this kind of stuff rots forever and not using bool properly
   drives me crazy.

Joe Perches <[email protected]> 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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
rustyrussell authored and davem330 committed Dec 20, 2011
1 parent a8e510f commit 3db1cd5
Show file tree
Hide file tree
Showing 60 changed files with 288 additions and 288 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -6425,13 +6425,13 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget,
bool hwbug = false;

if (tg3_flag(tp, SHORT_DMA_BUG) && len <= 8)
hwbug = 1;
hwbug = true;

if (tg3_4g_overflow_test(map, len))
hwbug = 1;
hwbug = true;

if (tg3_40bit_overflow_test(tp, map, len))
hwbug = 1;
hwbug = true;

if (tp->dma_limit) {
u32 prvidx = *entry;
Expand Down Expand Up @@ -6464,7 +6464,7 @@ static bool tg3_tx_frag_set(struct tg3_napi *tnapi, u32 *entry, u32 *budget,
*budget -= 1;
*entry = NEXT_TX(*entry);
} else {
hwbug = 1;
hwbug = true;
tnapi->tx_buffers[prvidx].fragmented = false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/brocade/bna/bnad.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ void
bnad_cb_ethport_link_status(struct bnad *bnad,
enum bna_link_status link_status)
{
bool link_up = 0;
bool link_up = false;

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

Expand Down Expand Up @@ -3190,7 +3190,7 @@ bnad_pci_init(struct bnad *bnad,
goto disable_device;
if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) &&
!dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
*using_dac = 1;
*using_dac = true;
} else {
err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
if (err) {
Expand All @@ -3199,7 +3199,7 @@ bnad_pci_init(struct bnad *bnad,
if (err)
goto release_regions;
}
*using_dac = 0;
*using_dac = false;
}
pci_set_master(pdev);
return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/dec/tulip/de4x5.c
Original file line number Diff line number Diff line change
Expand Up @@ -5191,7 +5191,7 @@ de4x5_parse_params(struct net_device *dev)
struct de4x5_private *lp = netdev_priv(dev);
char *p, *q, t;

lp->params.fdx = 0;
lp->params.fdx = false;
lp->params.autosense = AUTO;

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

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

if (strstr(p, "autosense") || strstr(p, "AUTOSENSE")) {
if (strstr(p, "TP")) {
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/intel/e1000/e1000_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,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;
Expand Down Expand Up @@ -1679,7 +1679,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);

Expand Down Expand Up @@ -2002,7 +2002,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);
Expand Down Expand Up @@ -2851,7 +2851,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;
}

Expand Down Expand Up @@ -3219,7 +3219,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;
Expand Down
24 changes: 12 additions & 12 deletions drivers/net/ethernet/intel/e1000e/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
u32 length, staterr;
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;
Expand Down Expand Up @@ -888,7 +888,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,
Expand Down Expand Up @@ -1157,7 +1157,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)) &&
Expand Down Expand Up @@ -1192,7 +1192,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;
Expand All @@ -1218,7 +1218,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);
Expand Down Expand Up @@ -4257,7 +4257,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;

/*
Expand All @@ -4272,7 +4272,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:
Expand Down Expand Up @@ -4371,7 +4371,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);
Expand Down Expand Up @@ -4404,11 +4404,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;
}
Expand Down Expand Up @@ -4544,7 +4544,7 @@ static void e1000_watchdog_task(struct work_struct *work)
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
Expand Down Expand Up @@ -6208,7 +6208,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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/ixgb/ixgb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2599,7 +2599,7 @@ s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval)
s32 ixgbe_blink_led_start_generic(struct ixgbe_hw *hw, u32 index)
{
ixgbe_link_speed speed = 0;
bool link_up = 0;
bool link_up = false;
u32 autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
u32 led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4023,7 +4023,7 @@ void ixgbe_down(struct ixgbe_adapter *adapter)

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

/* ping all the active vfs to let them know we are going down */
ixgbe_ping_all_vfs(adapter);
Expand Down
12 changes: 6 additions & 6 deletions drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ s32 ixgbe_read_i2c_byte_generic(struct ixgbe_hw *hw, u8 byte_offset,
u32 max_retry = 10;
u32 retry = 0;
u16 swfw_mask = 0;
bool nack = 1;
bool nack = true;
*data = 0;

if (IXGBE_READ_REG(hw, IXGBE_STATUS) & IXGBE_STATUS_LAN_ID_1)
Expand Down Expand Up @@ -1421,7 +1421,7 @@ static void ixgbe_i2c_stop(struct ixgbe_hw *hw)
static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data)
{
s32 i;
bool bit = 0;
bool bit = false;

for (i = 7; i >= 0; i--) {
ixgbe_clock_in_i2c_bit(hw, &bit);
Expand All @@ -1443,7 +1443,7 @@ static s32 ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data)
s32 status = 0;
s32 i;
u32 i2cctl;
bool bit = 0;
bool bit = false;

for (i = 7; i >= 0; i--) {
bit = (data >> i) & 0x1;
Expand Down Expand Up @@ -1473,7 +1473,7 @@ static s32 ixgbe_get_i2c_ack(struct ixgbe_hw *hw)
u32 i = 0;
u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
u32 timeout = 10;
bool ack = 1;
bool ack = true;

ixgbe_raise_i2c_clk(hw, &i2cctl);

Expand Down Expand Up @@ -1646,9 +1646,9 @@ static bool ixgbe_get_i2c_data(u32 *i2cctl)
bool data;

if (*i2cctl & IXGBE_I2C_DATA_IN)
data = 1;
data = true;
else
data = 0;
data = false;

return data;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/sfc/falcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ static void falcon_stats_complete(struct efx_nic *efx)
if (!nic_data->stats_pending)
return;

nic_data->stats_pending = 0;
nic_data->stats_pending = false;
if (*nic_data->stats_dma_done == FALCON_STATS_DONE) {
rmb(); /* read the done flag before the stats */
efx->mac_op->update_stats(efx);
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/sfc/mtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ static int siena_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len)
rc = efx_mcdi_nvram_update_start(efx, part->mcdi.nvram_type);
if (rc)
goto out;
part->mcdi.updating = 1;
part->mcdi.updating = true;
}

/* The MCDI interface can in fact do multiple erase blocks at once;
Expand Down Expand Up @@ -528,7 +528,7 @@ static int siena_mtd_write(struct mtd_info *mtd, loff_t start,
rc = efx_mcdi_nvram_update_start(efx, part->mcdi.nvram_type);
if (rc)
goto out;
part->mcdi.updating = 1;
part->mcdi.updating = true;
}

while (offset < end) {
Expand All @@ -553,7 +553,7 @@ static int siena_mtd_sync(struct mtd_info *mtd)
int rc = 0;

if (part->mcdi.updating) {
part->mcdi.updating = 0;
part->mcdi.updating = false;
rc = efx_mcdi_nvram_update_finish(efx, part->mcdi.nvram_type);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/sfc/siena.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static int siena_probe_nvconfig(struct efx_nic *efx)
static int siena_probe_nic(struct efx_nic *efx)
{
struct siena_nic_data *nic_data;
bool already_attached = 0;
bool already_attached = false;
efx_oword_t reg;
int rc;

Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/tile/tilepro.c
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ static void tile_net_stop_aux(struct net_device *dev)
sizeof(dummy), NETIO_IPP_STOP_SHIM_OFF) < 0)
panic("Failed to stop LIPP/LEPP!\n");

priv->partly_opened = 0;
priv->partly_opened = false;
}


Expand Down Expand Up @@ -1507,7 +1507,7 @@ static int tile_net_open(struct net_device *dev)
priv->network_cpus_count, priv->network_cpus_credits);
#endif

priv->partly_opened = 1;
priv->partly_opened = true;

} else {
/* FIXME: Is this possible? */
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/xilinx/xilinx_emaclite.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ static void xemaclite_rx_handler(struct net_device *dev)
*/
static irqreturn_t xemaclite_interrupt(int irq, void *dev_id)
{
bool tx_complete = 0;
bool tx_complete = false;
struct net_device *dev = dev_id;
struct net_local *lp = netdev_priv(dev);
void __iomem *base_addr = lp->base_addr;
Expand All @@ -683,7 +683,7 @@ static irqreturn_t xemaclite_interrupt(int irq, void *dev_id)
tx_status &= ~XEL_TSR_XMIT_ACTIVE_MASK;
out_be32(base_addr + XEL_TSR_OFFSET, tx_status);

tx_complete = 1;
tx_complete = true;
}

/* Check if the Transmission for the second buffer is completed */
Expand All @@ -695,7 +695,7 @@ static irqreturn_t xemaclite_interrupt(int irq, void *dev_id)
out_be32(base_addr + XEL_BUFFER_OFFSET + XEL_TSR_OFFSET,
tx_status);

tx_complete = 1;
tx_complete = true;
}

/* If there was a Tx interrupt, call the Tx Handler */
Expand Down
Loading

0 comments on commit 3db1cd5

Please sign in to comment.