2008-03-06 17:41:58

by Julia Lawall

[permalink] [raw]
Subject: [PATCH] drivers/net: convert & to &&

From: Julia Lawall <[email protected]>

The use of & to obtain a conjunction that evaluates both of its arguments
seems unnecessarily tricky.

The semantic match that found this code is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@ expression E1, E2; @@
* !E1 & !E2
// </smpl>

Signed-off-by: Julia Lawall <[email protected]>

---
drivers/net/e1000/e1000_main.c | 16 ++++++++++------
drivers/net/ixgb/ixgb_main.c | 11 ++++++-----
2 files changed, 16 insertions(+), 11 deletions(-)

diff -u -p a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
--- a/drivers/net/e1000/e1000_main.c 2008-02-20 22:09:26.000000000 +0100
+++ b/drivers/net/e1000/e1000_main.c 2008-03-06 17:30:20.000000000 +0100
@@ -3872,10 +3872,12 @@ e1000_intr_msi(int irq, void *data)
adapter->total_tx_packets = 0;
adapter->total_rx_packets = 0;

- for (i = 0; i < E1000_MAX_INTR; i++)
- if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) &
- !e1000_clean_tx_irq(adapter, adapter->tx_ring)))
+ for (i = 0; i < E1000_MAX_INTR; i++) {
+ boolean_t c1 = adapter->clean_rx(adapter, adapter->rx_ring);
+ boolean_t c2 = e1000_clean_tx_irq(adapter, adapter->tx_ring);
+ if (unlikely(!c1 && !c2))
break;
+ }

if (likely(adapter->itr_setting & 3))
e1000_set_itr(adapter);
@@ -3974,10 +3976,12 @@ e1000_intr(int irq, void *data)
adapter->total_tx_packets = 0;
adapter->total_rx_packets = 0;

- for (i = 0; i < E1000_MAX_INTR; i++)
- if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) &
- !e1000_clean_tx_irq(adapter, adapter->tx_ring)))
+ for (i = 0; i < E1000_MAX_INTR; i++) {
+ boolean_t c1 = adapter->clean_rx(adapter, adapter->rx_ring);
+ boolean_t c2 = e1000_clean_tx_irq(adapter, adapter->tx_ring);
+ if (unlikely(!c1 && !c2))
break;
+ }

if (likely(adapter->itr_setting & 3))
e1000_set_itr(adapter);
diff -u -p a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
--- a/drivers/net/ixgb/ixgb_main.c 2008-02-02 16:08:56.000000000 +0100
+++ b/drivers/net/ixgb/ixgb_main.c 2008-03-06 17:33:02.000000000 +0100
@@ -1769,14 +1769,15 @@ ixgb_intr(int irq, void *data)
__netif_rx_schedule(netdev, &adapter->napi);
}
#else
- /* yes, that is actually a & and it is meant to make sure that
- * every pass through this for loop checks both receive and
+ /* every pass through this for loop checks both receive and
* transmit queues for completed descriptors, intended to
* avoid starvation issues and assist tx/rx fairness. */
- for(i = 0; i < IXGB_MAX_INTR; i++)
- if(!ixgb_clean_rx_irq(adapter) &
- !ixgb_clean_tx_irq(adapter))
+ for (i = 0; i < IXGB_MAX_INTR; i++) {
+ boolean_t c1 = ixgb_clean_rx_irq(adapter);
+ boolean_t c2 = ixgb_clean_tx_irq(adapter);
+ if (!c1 && !c2)
break;
+ }
#endif
return IRQ_HANDLED;
}


2008-03-06 18:00:54

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH] drivers/net: convert & to &&

On Thu, 2008-03-06 at 18:41 +0100, Julia Lawall wrote:
> diff -u -p a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
> --- a/drivers/net/e1000/e1000_main.c 2008-02-20 22:09:26.000000000 +0100
> +++ b/drivers/net/e1000/e1000_main.c 2008-03-06 17:30:20.000000000 +0100
> @@ -3872,10 +3872,12 @@ e1000_intr_msi(int irq, void *data)
> adapter->total_tx_packets = 0;
> adapter->total_rx_packets = 0;
>
> - for (i = 0; i < E1000_MAX_INTR; i++)
> - if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) &
> - !e1000_clean_tx_irq(adapter, adapter->tx_ring)))
> + for (i = 0; i < E1000_MAX_INTR; i++) {
> + boolean_t c1 = adapter->clean_rx(adapter, adapter->rx_ring);
> + boolean_t c2 = e1000_clean_tx_irq(adapter, adapter->tx_ring);
> + if (unlikely(!c1 && !c2))
> break;
> + }

Perhaps also a s/boolean_t/bool/g kernel wide?

$ grep -wrl boolean_t *

drivers/net/e1000/e1000.h
drivers/net/e1000/e1000_ethtool.c
drivers/net/e1000/e1000_hw.c
drivers/net/e1000/e1000_hw.h
drivers/net/e1000/e1000_main.c
drivers/net/e1000/e1000_osdep.h
drivers/net/ixgb/ixgb.h
drivers/net/ixgb/ixgb_ee.c
drivers/net/ixgb/ixgb_ee.h
drivers/net/ixgb/ixgb_ethtool.c
drivers/net/ixgb/ixgb_hw.c
drivers/net/ixgb/ixgb_hw.h
drivers/net/ixgb/ixgb_main.c
drivers/net/ixgb/ixgb_osdep.h
fs/xfs/quota/xfs_dquot.c
fs/xfs/quota/xfs_qm.c
fs/xfs/quota/xfs_qm.h
fs/xfs/quota/xfs_qm_syscalls.c
fs/xfs/quota/xfs_trans_dquot.c
fs/xfs/xfs_ialloc.c
fs/xfs/xfs_ialloc.h
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode.h
fs/xfs/xfs_log.c
fs/xfs/xfs_vfsops.c
fs/xfs/xfs_utils.c
fs/xfs/xfs_types.h
fs/xfs/xfs_vnodeops.c

2008-03-06 18:09:12

by Kok, Auke

[permalink] [raw]
Subject: Re: [E1000-devel] [PATCH] drivers/net: convert & to &&

Joe Perches wrote:
> On Thu, 2008-03-06 at 18:41 +0100, Julia Lawall wrote:
>> diff -u -p a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
>> --- a/drivers/net/e1000/e1000_main.c 2008-02-20 22:09:26.000000000 +0100
>> +++ b/drivers/net/e1000/e1000_main.c 2008-03-06 17:30:20.000000000 +0100
>> @@ -3872,10 +3872,12 @@ e1000_intr_msi(int irq, void *data)
>> adapter->total_tx_packets = 0;
>> adapter->total_rx_packets = 0;
>>
>> - for (i = 0; i < E1000_MAX_INTR; i++)
>> - if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) &
>> - !e1000_clean_tx_irq(adapter, adapter->tx_ring)))
>> + for (i = 0; i < E1000_MAX_INTR; i++) {
>> + boolean_t c1 = adapter->clean_rx(adapter, adapter->rx_ring);
>> + boolean_t c2 = e1000_clean_tx_irq(adapter, adapter->tx_ring);
>> + if (unlikely(!c1 && !c2))
>> break;
>> + }
>
> Perhaps also a s/boolean_t/bool/g kernel wide?

send me a patch for e1000 and for ixgb and I'll happily apply those :)

(which, BTW also could use the uint32_t -> u32 (etc) changes... while you're at it)

Auke


>
> $ grep -wrl boolean_t *
>
> drivers/net/e1000/e1000.h
> drivers/net/e1000/e1000_ethtool.c
> drivers/net/e1000/e1000_hw.c
> drivers/net/e1000/e1000_hw.h
> drivers/net/e1000/e1000_main.c
> drivers/net/e1000/e1000_osdep.h
> drivers/net/ixgb/ixgb.h
> drivers/net/ixgb/ixgb_ee.c
> drivers/net/ixgb/ixgb_ee.h
> drivers/net/ixgb/ixgb_ethtool.c
> drivers/net/ixgb/ixgb_hw.c
> drivers/net/ixgb/ixgb_hw.h
> drivers/net/ixgb/ixgb_main.c
> drivers/net/ixgb/ixgb_osdep.h
> fs/xfs/quota/xfs_dquot.c
> fs/xfs/quota/xfs_qm.c
> fs/xfs/quota/xfs_qm.h
> fs/xfs/quota/xfs_qm_syscalls.c
> fs/xfs/quota/xfs_trans_dquot.c
> fs/xfs/xfs_ialloc.c
> fs/xfs/xfs_ialloc.h
> fs/xfs/xfs_inode.c
> fs/xfs/xfs_inode.h
> fs/xfs/xfs_log.c
> fs/xfs/xfs_vfsops.c
> fs/xfs/xfs_utils.c
> fs/xfs/xfs_types.h
> fs/xfs/xfs_vnodeops.c
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> E1000-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/e1000-devel

2008-03-07 01:24:16

by Joe Perches

[permalink] [raw]
Subject: [PATCH] drivers/net/e1000 - Convert boolean_t to bool

On Thu, 2008-03-06 at 10:07 -0800, Kok, Auke wrote:
> send me a patch for e1000 and for ixgb and I'll happily apply those :)

boolean_t to bool
TRUE to true
FALSE to false
comment typo ahread to ahead

Signed-off-by: Joe Perches <[email protected]>

drivers/net/e1000/e1000.h | 26 ++--
drivers/net/e1000/e1000_ethtool.c | 17 ++--
drivers/net/e1000/e1000_hw.c | 222 ++++++++++++++++++-------------------
drivers/net/e1000/e1000_hw.h | 62 +++++-----
drivers/net/e1000/e1000_main.c | 90 ++++++++--------
drivers/net/e1000/e1000_osdep.h | 7 -
6 files changed, 208 insertions(+), 216 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 3b84028..d73a6c1 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -188,7 +188,7 @@ struct e1000_tx_ring {
spinlock_t tx_lock;
uint16_t tdh;
uint16_t tdt;
- boolean_t last_tx_tso;
+ bool last_tx_tso;
};

struct e1000_rx_ring {
@@ -283,17 +283,17 @@ struct e1000_adapter {
uint32_t tx_fifo_size;
uint8_t tx_timeout_factor;
atomic_t tx_fifo_stall;
- boolean_t pcix_82544;
- boolean_t detect_tx_hung;
+ bool pcix_82544;
+ bool detect_tx_hung;

/* RX */
#ifdef CONFIG_E1000_NAPI
- boolean_t (*clean_rx) (struct e1000_adapter *adapter,
- struct e1000_rx_ring *rx_ring,
- int *work_done, int work_to_do);
+ bool (*clean_rx) (struct e1000_adapter *adapter,
+ struct e1000_rx_ring *rx_ring,
+ int *work_done, int work_to_do);
#else
- boolean_t (*clean_rx) (struct e1000_adapter *adapter,
- struct e1000_rx_ring *rx_ring);
+ bool (*clean_rx) (struct e1000_adapter *adapter,
+ struct e1000_rx_ring *rx_ring);
#endif
void (*alloc_rx_buf) (struct e1000_adapter *adapter,
struct e1000_rx_ring *rx_ring,
@@ -312,7 +312,7 @@ struct e1000_adapter {
uint32_t alloc_rx_buff_failed;
uint32_t rx_int_delay;
uint32_t rx_abs_int_delay;
- boolean_t rx_csum;
+ bool rx_csum;
unsigned int rx_ps_pages;
uint32_t gorcl;
uint64_t gorcl_old;
@@ -335,12 +335,12 @@ struct e1000_adapter {
struct e1000_rx_ring test_rx_ring;

int msg_enable;
- boolean_t have_msi;
+ bool have_msi;

/* to not mess up cache alignment, always add to the bottom */
- boolean_t tso_force;
- boolean_t smart_power_down; /* phy smart power down */
- boolean_t quad_port_a;
+ bool tso_force;
+ bool smart_power_down; /* phy smart power down */
+ bool quad_port_a;
unsigned long flags;
uint32_t eeprom_wol;
};
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 85e66f4..979d14f 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -353,7 +353,7 @@ e1000_set_tso(struct net_device *netdev, uint32_t data)
netdev->features &= ~NETIF_F_TSO6;

DPRINTK(PROBE, INFO, "TSO is %s\n", data ? "Enabled" : "Disabled");
- adapter->tso_force = TRUE;
+ adapter->tso_force = true;
return 0;
}

@@ -922,7 +922,8 @@ static int
e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
{
struct net_device *netdev = adapter->netdev;
- uint32_t mask, i=0, shared_int = TRUE;
+ uint32_t mask, i=0;
+ bool shared_int = true;
uint32_t irq = adapter->pdev->irq;

*data = 0;
@@ -931,7 +932,7 @@ e1000_intr_test(struct e1000_adapter *adapter, uint64_t *data)
/* Hook up test interrupt handler just for this test */
if (!request_irq(irq, &e1000_test_intr, IRQF_PROBE_SHARED, netdev->name,
netdev))
- shared_int = FALSE;
+ shared_int = false;
else if (request_irq(irq, &e1000_test_intr, IRQF_SHARED,
netdev->name, netdev)) {
*data = 1;
@@ -1295,7 +1296,7 @@ e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
uint32_t ctrl_reg = 0;
uint32_t stat_reg = 0;

- adapter->hw.autoneg = FALSE;
+ adapter->hw.autoneg = false;

if (adapter->hw.phy_type == e1000_phy_m88) {
/* Auto-MDI/MDIX Off */
@@ -1473,7 +1474,7 @@ e1000_loopback_cleanup(struct e1000_adapter *adapter)
case e1000_82545_rev_3:
case e1000_82546_rev_3:
default:
- hw->autoneg = TRUE;
+ hw->autoneg = true;
if (hw->phy_type == e1000_phy_gg82563)
e1000_write_phy_reg(hw,
GG82563_PHY_KMRN_MODE_CTRL,
@@ -1607,13 +1608,13 @@ e1000_link_test(struct e1000_adapter *adapter, uint64_t *data)
*data = 0;
if (adapter->hw.media_type == e1000_media_type_internal_serdes) {
int i = 0;
- adapter->hw.serdes_link_down = TRUE;
+ adapter->hw.serdes_link_down = true;

/* On some blade server designs, link establishment
* could take as long as 2-3 minutes */
do {
e1000_check_for_link(&adapter->hw);
- if (adapter->hw.serdes_link_down == FALSE)
+ if (!adapter->hw.serdes_link_down)
return *data;
msleep(20);
} while (i++ < 3750);
@@ -1649,7 +1650,7 @@ e1000_diag_test(struct net_device *netdev,
struct ethtool_test *eth_test, uint64_t *data)
{
struct e1000_adapter *adapter = netdev_priv(netdev);
- boolean_t if_running = netif_running(netdev);
+ bool if_running = netif_running(netdev);

set_bit(__E1000_TESTING, &adapter->flags);
if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 7c6888c..4a6447d 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -46,7 +46,7 @@ static int32_t e1000_check_polarity(struct e1000_hw *hw, e1000_rev_polarity *pol
static void e1000_clear_hw_cntrs(struct e1000_hw *hw);
static void e1000_clear_vfta(struct e1000_hw *hw);
static int32_t e1000_commit_shadow_ram(struct e1000_hw *hw);
-static int32_t e1000_config_dsp_after_link_change(struct e1000_hw *hw, boolean_t link_up);
+static int32_t e1000_config_dsp_after_link_change(struct e1000_hw *hw, bool link_up);
static int32_t e1000_config_fc_after_link_up(struct e1000_hw *hw);
static int32_t e1000_detect_gig_phy(struct e1000_hw *hw);
static int32_t e1000_erase_ich8_4k_segment(struct e1000_hw *hw, uint32_t bank);
@@ -62,7 +62,7 @@ static int32_t e1000_init_lcd_from_nvm_config_region(struct e1000_hw *hw, uint32
static int32_t e1000_init_lcd_from_nvm(struct e1000_hw *hw);
static void e1000_init_rx_addrs(struct e1000_hw *hw);
static void e1000_initialize_hardware_bits(struct e1000_hw *hw);
-static boolean_t e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw);
+static bool e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw);
static int32_t e1000_kumeran_lock_loss_workaround(struct e1000_hw *hw);
static int32_t e1000_mng_enable_host_if(struct e1000_hw *hw);
static int32_t e1000_mng_host_if_write(struct e1000_hw *hw, uint8_t *buffer, uint16_t length, uint16_t offset, uint8_t *sum);
@@ -84,8 +84,8 @@ static int32_t e1000_write_ich8_data(struct e1000_hw *hw, uint32_t index, uint32
static int32_t e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words, uint16_t *data);
static int32_t e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words, uint16_t *data);
static void e1000_release_software_flag(struct e1000_hw *hw);
-static int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active);
-static int32_t e1000_set_d0_lplu_state(struct e1000_hw *hw, boolean_t active);
+static int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active);
+static int32_t e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active);
static int32_t e1000_set_pci_ex_no_snoop(struct e1000_hw *hw, uint32_t no_snoop);
static void e1000_set_pci_express_master_disable(struct e1000_hw *hw);
static int32_t e1000_wait_autoneg(struct e1000_hw *hw);
@@ -425,22 +425,22 @@ e1000_set_mac_type(struct e1000_hw *hw)

switch (hw->mac_type) {
case e1000_ich8lan:
- hw->swfwhw_semaphore_present = TRUE;
- hw->asf_firmware_present = TRUE;
+ hw->swfwhw_semaphore_present = true;
+ hw->asf_firmware_present = true;
break;
case e1000_80003es2lan:
- hw->swfw_sync_present = TRUE;
+ hw->swfw_sync_present = true;
/* fall through */
case e1000_82571:
case e1000_82572:
case e1000_82573:
- hw->eeprom_semaphore_present = TRUE;
+ hw->eeprom_semaphore_present = true;
/* fall through */
case e1000_82541:
case e1000_82547:
case e1000_82541_rev_2:
case e1000_82547_rev_2:
- hw->asf_firmware_present = TRUE;
+ hw->asf_firmware_present = true;
break;
default:
break;
@@ -450,20 +450,20 @@ e1000_set_mac_type(struct e1000_hw *hw)
* FD mode
*/
if (hw->mac_type == e1000_82543)
- hw->bad_tx_carr_stats_fd = TRUE;
+ hw->bad_tx_carr_stats_fd = true;

/* capable of receiving management packets to the host */
if (hw->mac_type >= e1000_82571)
- hw->has_manc2h = TRUE;
+ hw->has_manc2h = true;

/* In rare occasions, ESB2 systems would end up started without
* the RX unit being turned on.
*/
if (hw->mac_type == e1000_80003es2lan)
- hw->rx_needs_kicking = TRUE;
+ hw->rx_needs_kicking = true;

if (hw->mac_type > e1000_82544)
- hw->has_smbus = TRUE;
+ hw->has_smbus = true;

return E1000_SUCCESS;
}
@@ -482,7 +482,7 @@ e1000_set_media_type(struct e1000_hw *hw)

if (hw->mac_type != e1000_82543) {
/* tbi_compatibility is only valid on 82543 */
- hw->tbi_compatibility_en = FALSE;
+ hw->tbi_compatibility_en = false;
}

switch (hw->device_id) {
@@ -513,7 +513,7 @@ e1000_set_media_type(struct e1000_hw *hw)
if (status & E1000_STATUS_TBIMODE) {
hw->media_type = e1000_media_type_fiber;
/* tbi_compatibility not valid on fiber */
- hw->tbi_compatibility_en = FALSE;
+ hw->tbi_compatibility_en = false;
} else {
hw->media_type = e1000_media_type_copper;
}
@@ -569,7 +569,7 @@ e1000_reset_hw(struct e1000_hw *hw)
E1000_WRITE_FLUSH(hw);

/* The tbi_compatibility_on Flag must be cleared when Rctl is cleared. */
- hw->tbi_compatibility_on = FALSE;
+ hw->tbi_compatibility_on = false;

/* Delay to allow any outstanding PCI transactions to complete before
* resetting the device
@@ -682,7 +682,7 @@ e1000_reset_hw(struct e1000_hw *hw)
msleep(20);
break;
case e1000_82573:
- if (e1000_is_onboard_nvm_eeprom(hw) == FALSE) {
+ if (!e1000_is_onboard_nvm_eeprom(hw)) {
udelay(10);
ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
ctrl_ext |= E1000_CTRL_EXT_EE_RST;
@@ -1428,7 +1428,7 @@ e1000_copper_link_preconfig(struct e1000_hw *hw)
if (hw->mac_type <= e1000_82543 ||
hw->mac_type == e1000_82541 || hw->mac_type == e1000_82547 ||
hw->mac_type == e1000_82541_rev_2 || hw->mac_type == e1000_82547_rev_2)
- hw->phy_reset_disable = FALSE;
+ hw->phy_reset_disable = false;

return E1000_SUCCESS;
}
@@ -1470,7 +1470,7 @@ e1000_copper_link_igp_setup(struct e1000_hw *hw)
/* The NVM settings will configure LPLU in D3 for IGP2 and IGP3 PHYs */
if (hw->phy_type == e1000_phy_igp) {
/* disable lplu d3 during driver init */
- ret_val = e1000_set_d3_lplu_state(hw, FALSE);
+ ret_val = e1000_set_d3_lplu_state(hw, false);
if (ret_val) {
DEBUGOUT("Error Disabling LPLU D3\n");
return ret_val;
@@ -1478,7 +1478,7 @@ e1000_copper_link_igp_setup(struct e1000_hw *hw)
}

/* disable lplu d0 during driver init */
- ret_val = e1000_set_d0_lplu_state(hw, FALSE);
+ ret_val = e1000_set_d0_lplu_state(hw, false);
if (ret_val) {
DEBUGOUT("Error Disabling LPLU D0\n");
return ret_val;
@@ -1691,7 +1691,7 @@ e1000_copper_link_ggp_setup(struct e1000_hw *hw)
* firmware will have already initialized them. We only initialize
* them if the HW is not in IAMT mode.
*/
- if (e1000_check_mng_mode(hw) == FALSE) {
+ if (!e1000_check_mng_mode(hw)) {
/* Enable Electrical Idle on the PHY */
phy_data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE;
ret_val = e1000_write_phy_reg(hw, GG82563_PHY_PWR_MGMT_CTRL,
@@ -1892,7 +1892,7 @@ e1000_copper_link_autoneg(struct e1000_hw *hw)
}
}

- hw->get_link_status = TRUE;
+ hw->get_link_status = true;

return E1000_SUCCESS;
}
@@ -1932,7 +1932,7 @@ e1000_copper_link_postconfig(struct e1000_hw *hw)

/* Config DSP to improve Giga link quality */
if (hw->phy_type == e1000_phy_igp) {
- ret_val = e1000_config_dsp_after_link_change(hw, TRUE);
+ ret_val = e1000_config_dsp_after_link_change(hw, true);
if (ret_val) {
DEBUGOUT("Error Configuring DSP after link up\n");
return ret_val;
@@ -2923,7 +2923,7 @@ e1000_check_for_link(struct e1000_hw *hw)
if (hw->media_type == e1000_media_type_fiber) {
signal = (hw->mac_type > e1000_82544) ? E1000_CTRL_SWDPIN1 : 0;
if (status & E1000_STATUS_LU)
- hw->get_link_status = FALSE;
+ hw->get_link_status = false;
}
}

@@ -2947,7 +2947,7 @@ e1000_check_for_link(struct e1000_hw *hw)
return ret_val;

if (phy_data & MII_SR_LINK_STATUS) {
- hw->get_link_status = FALSE;
+ hw->get_link_status = false;
/* Check if there was DownShift, must be checked immediately after
* link-up */
e1000_check_downshift(hw);
@@ -2973,7 +2973,7 @@ e1000_check_for_link(struct e1000_hw *hw)

} else {
/* No link detected */
- e1000_config_dsp_after_link_change(hw, FALSE);
+ e1000_config_dsp_after_link_change(hw, false);
return 0;
}

@@ -2983,7 +2983,7 @@ e1000_check_for_link(struct e1000_hw *hw)
if (!hw->autoneg) return -E1000_ERR_CONFIG;

/* optimize the dsp settings for the igp phy */
- e1000_config_dsp_after_link_change(hw, TRUE);
+ e1000_config_dsp_after_link_change(hw, true);

/* We have a M88E1000 PHY and Auto-Neg is enabled. If we
* have Si on board that is 82544 or newer, Auto
@@ -3036,7 +3036,7 @@ e1000_check_for_link(struct e1000_hw *hw)
rctl = E1000_READ_REG(hw, RCTL);
rctl &= ~E1000_RCTL_SBP;
E1000_WRITE_REG(hw, RCTL, rctl);
- hw->tbi_compatibility_on = FALSE;
+ hw->tbi_compatibility_on = false;
}
} else {
/* If TBI compatibility is was previously off, turn it on. For
@@ -3045,7 +3045,7 @@ e1000_check_for_link(struct e1000_hw *hw)
* will look like CRC errors to to the hardware.
*/
if (!hw->tbi_compatibility_on) {
- hw->tbi_compatibility_on = TRUE;
+ hw->tbi_compatibility_on = true;
rctl = E1000_READ_REG(hw, RCTL);
rctl |= E1000_RCTL_SBP;
E1000_WRITE_REG(hw, RCTL, rctl);
@@ -3098,7 +3098,7 @@ e1000_check_for_link(struct e1000_hw *hw)
E1000_WRITE_REG(hw, TXCW, hw->txcw);
E1000_WRITE_REG(hw, CTRL, (ctrl & ~E1000_CTRL_SLU));

- hw->serdes_link_down = FALSE;
+ hw->serdes_link_down = false;
}
/* If we force link for non-auto-negotiation switch, check link status
* based on MAC synchronization for internal serdes media type.
@@ -3109,11 +3109,11 @@ e1000_check_for_link(struct e1000_hw *hw)
udelay(10);
if (E1000_RXCW_SYNCH & E1000_READ_REG(hw, RXCW)) {
if (!(rxcw & E1000_RXCW_IV)) {
- hw->serdes_link_down = FALSE;
+ hw->serdes_link_down = false;
DEBUGOUT("SERDES: Link is up.\n");
}
} else {
- hw->serdes_link_down = TRUE;
+ hw->serdes_link_down = true;
DEBUGOUT("SERDES: Link is down.\n");
}
}
@@ -4044,7 +4044,7 @@ e1000_detect_gig_phy(struct e1000_hw *hw)
{
int32_t phy_init_status, ret_val;
uint16_t phy_id_high, phy_id_low;
- boolean_t match = FALSE;
+ bool match = false;

DEBUGFUNC("e1000_detect_gig_phy");

@@ -4086,35 +4086,35 @@ e1000_detect_gig_phy(struct e1000_hw *hw)

switch (hw->mac_type) {
case e1000_82543:
- if (hw->phy_id == M88E1000_E_PHY_ID) match = TRUE;
+ if (hw->phy_id == M88E1000_E_PHY_ID) match = true;
break;
case e1000_82544:
- if (hw->phy_id == M88E1000_I_PHY_ID) match = TRUE;
+ if (hw->phy_id == M88E1000_I_PHY_ID) match = true;
break;
case e1000_82540:
case e1000_82545:
case e1000_82545_rev_3:
case e1000_82546:
case e1000_82546_rev_3:
- if (hw->phy_id == M88E1011_I_PHY_ID) match = TRUE;
+ if (hw->phy_id == M88E1011_I_PHY_ID) match = true;
break;
case e1000_82541:
case e1000_82541_rev_2:
case e1000_82547:
case e1000_82547_rev_2:
- if (hw->phy_id == IGP01E1000_I_PHY_ID) match = TRUE;
+ if (hw->phy_id == IGP01E1000_I_PHY_ID) match = true;
break;
case e1000_82573:
- if (hw->phy_id == M88E1111_I_PHY_ID) match = TRUE;
+ if (hw->phy_id == M88E1111_I_PHY_ID) match = true;
break;
case e1000_80003es2lan:
- if (hw->phy_id == GG82563_E_PHY_ID) match = TRUE;
+ if (hw->phy_id == GG82563_E_PHY_ID) match = true;
break;
case e1000_ich8lan:
- if (hw->phy_id == IGP03E1000_E_PHY_ID) match = TRUE;
- if (hw->phy_id == IFE_E_PHY_ID) match = TRUE;
- if (hw->phy_id == IFE_PLUS_E_PHY_ID) match = TRUE;
- if (hw->phy_id == IFE_C_E_PHY_ID) match = TRUE;
+ if (hw->phy_id == IGP03E1000_E_PHY_ID) match = true;
+ if (hw->phy_id == IFE_E_PHY_ID) match = true;
+ if (hw->phy_id == IFE_PLUS_E_PHY_ID) match = true;
+ if (hw->phy_id == IFE_C_E_PHY_ID) match = true;
break;
default:
DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type);
@@ -4455,8 +4455,8 @@ e1000_init_eeprom_params(struct e1000_hw *hw)
eeprom->opcode_bits = 3;
eeprom->address_bits = 6;
eeprom->delay_usec = 50;
- eeprom->use_eerd = FALSE;
- eeprom->use_eewr = FALSE;
+ eeprom->use_eerd = false;
+ eeprom->use_eewr = false;
break;
case e1000_82540:
case e1000_82545:
@@ -4473,8 +4473,8 @@ e1000_init_eeprom_params(struct e1000_hw *hw)
eeprom->word_size = 64;
eeprom->address_bits = 6;
}
- eeprom->use_eerd = FALSE;
- eeprom->use_eewr = FALSE;
+ eeprom->use_eerd = false;
+ eeprom->use_eewr = false;
break;
case e1000_82541:
case e1000_82541_rev_2:
@@ -4503,8 +4503,8 @@ e1000_init_eeprom_params(struct e1000_hw *hw)
eeprom->address_bits = 6;
}
}
- eeprom->use_eerd = FALSE;
- eeprom->use_eewr = FALSE;
+ eeprom->use_eerd = false;
+ eeprom->use_eewr = false;
break;
case e1000_82571:
case e1000_82572:
@@ -4518,8 +4518,8 @@ e1000_init_eeprom_params(struct e1000_hw *hw)
eeprom->page_size = 8;
eeprom->address_bits = 8;
}
- eeprom->use_eerd = FALSE;
- eeprom->use_eewr = FALSE;
+ eeprom->use_eerd = false;
+ eeprom->use_eewr = false;
break;
case e1000_82573:
eeprom->type = e1000_eeprom_spi;
@@ -4532,9 +4532,9 @@ e1000_init_eeprom_params(struct e1000_hw *hw)
eeprom->page_size = 8;
eeprom->address_bits = 8;
}
- eeprom->use_eerd = TRUE;
- eeprom->use_eewr = TRUE;
- if (e1000_is_onboard_nvm_eeprom(hw) == FALSE) {
+ eeprom->use_eerd = true;
+ eeprom->use_eewr = true;
+ if (!e1000_is_onboard_nvm_eeprom(hw)) {
eeprom->type = e1000_eeprom_flash;
eeprom->word_size = 2048;

@@ -4555,8 +4555,8 @@ e1000_init_eeprom_params(struct e1000_hw *hw)
eeprom->page_size = 8;
eeprom->address_bits = 8;
}
- eeprom->use_eerd = TRUE;
- eeprom->use_eewr = FALSE;
+ eeprom->use_eerd = true;
+ eeprom->use_eewr = false;
break;
case e1000_ich8lan:
{
@@ -4564,15 +4564,15 @@ e1000_init_eeprom_params(struct e1000_hw *hw)
uint32_t flash_size = E1000_READ_ICH_FLASH_REG(hw, ICH_FLASH_GFPREG);

eeprom->type = e1000_eeprom_ich8;
- eeprom->use_eerd = FALSE;
- eeprom->use_eewr = FALSE;
+ eeprom->use_eerd = false;
+ eeprom->use_eewr = false;
eeprom->word_size = E1000_SHADOW_RAM_WORDS;

/* Zero the shadow RAM structure. But don't load it from NVM
* so as to save time for driver init */
if (hw->eeprom_shadow_ram != NULL) {
for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) {
- hw->eeprom_shadow_ram[i].modified = FALSE;
+ hw->eeprom_shadow_ram[i].modified = false;
hw->eeprom_shadow_ram[i].eeprom_word = 0xFFFF;
}
}
@@ -4994,15 +4994,14 @@ e1000_read_eeprom(struct e1000_hw *hw,
* directly. In this case, we need to acquire the EEPROM so that
* FW or other port software does not interrupt.
*/
- if (e1000_is_onboard_nvm_eeprom(hw) == TRUE &&
- hw->eeprom.use_eerd == FALSE) {
+ if (e1000_is_onboard_nvm_eeprom(hw) && !hw->eeprom.use_eerd) {
/* Prepare the EEPROM for bit-bang reading */
if (e1000_acquire_eeprom(hw) != E1000_SUCCESS)
return -E1000_ERR_EEPROM;
}

/* Eerd register EEPROM access requires no eeprom aquire/release */
- if (eeprom->use_eerd == TRUE)
+ if (eeprom->use_eerd)
return e1000_read_eeprom_eerd(hw, offset, words, data);

/* ICH EEPROM access is done via the ICH flash controller */
@@ -5171,7 +5170,7 @@ e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd)
*
* hw - Struct containing variables accessed by shared code
****************************************************************************/
-static boolean_t
+static bool
e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw)
{
uint32_t eecd = 0;
@@ -5179,7 +5178,7 @@ e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw)
DEBUGFUNC("e1000_is_onboard_nvm_eeprom");

if (hw->mac_type == e1000_ich8lan)
- return FALSE;
+ return false;

if (hw->mac_type == e1000_82573) {
eecd = E1000_READ_REG(hw, EECD);
@@ -5189,10 +5188,10 @@ e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw)

/* If both bits are set, device is Flash type */
if (eecd == 0x03) {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}

/******************************************************************************
@@ -5212,8 +5211,7 @@ e1000_validate_eeprom_checksum(struct e1000_hw *hw)

DEBUGFUNC("e1000_validate_eeprom_checksum");

- if ((hw->mac_type == e1000_82573) &&
- (e1000_is_onboard_nvm_eeprom(hw) == FALSE)) {
+ if ((hw->mac_type == e1000_82573) && !e1000_is_onboard_nvm_eeprom(hw)) {
/* Check bit 4 of word 10h. If it is 0, firmware is done updating
* 10h-12h. Checksum may need to be fixed. */
e1000_read_eeprom(hw, 0x10, 1, &eeprom_data);
@@ -5339,7 +5337,7 @@ e1000_write_eeprom(struct e1000_hw *hw,
}

/* 82573 writes only through eewr */
- if (eeprom->use_eewr == TRUE)
+ if (eeprom->use_eewr)
return e1000_write_eeprom_eewr(hw, offset, words, data);

if (eeprom->type == e1000_eeprom_ich8)
@@ -5536,7 +5534,7 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)
uint32_t new_bank_offset = 0;
uint8_t low_byte = 0;
uint8_t high_byte = 0;
- boolean_t sector_write_failed = FALSE;
+ bool sector_write_failed = false;

if (hw->mac_type == e1000_82573) {
/* The flop register will be used to determine if flash type is STM */
@@ -5588,21 +5586,21 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)
e1000_erase_ich8_4k_segment(hw, 0);
}

- sector_write_failed = FALSE;
+ sector_write_failed = false;
/* Loop for every byte in the shadow RAM,
* which is in units of words. */
for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) {
/* Determine whether to write the value stored
* in the other NVM bank or a modified value stored
* in the shadow RAM */
- if (hw->eeprom_shadow_ram[i].modified == TRUE) {
+ if (hw->eeprom_shadow_ram[i].modified) {
low_byte = (uint8_t)hw->eeprom_shadow_ram[i].eeprom_word;
udelay(100);
error = e1000_verify_write_ich8_byte(hw,
(i << 1) + new_bank_offset, low_byte);

if (error != E1000_SUCCESS)
- sector_write_failed = TRUE;
+ sector_write_failed = true;
else {
high_byte =
(uint8_t)(hw->eeprom_shadow_ram[i].eeprom_word >> 8);
@@ -5616,7 +5614,7 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)
(i << 1) + new_bank_offset, low_byte);

if (error != E1000_SUCCESS)
- sector_write_failed = TRUE;
+ sector_write_failed = true;
else {
e1000_read_ich8_byte(hw, (i << 1) + old_bank_offset + 1,
&high_byte);
@@ -5624,10 +5622,10 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)
}
}

- /* If the write of the low byte was successful, go ahread and
+ /* If the write of the low byte was successful, go ahead and
* write the high byte while checking to make sure that if it
* is the signature byte, then it is handled properly */
- if (sector_write_failed == FALSE) {
+ if (!sector_write_failed) {
/* If the word is 0x13, then make sure the signature bits
* (15:14) are 11b until the commit has completed.
* This will allow us to write 10b which indicates the
@@ -5640,7 +5638,7 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)
error = e1000_verify_write_ich8_byte(hw,
(i << 1) + new_bank_offset + 1, high_byte);
if (error != E1000_SUCCESS)
- sector_write_failed = TRUE;
+ sector_write_failed = true;

} else {
/* If the write failed then break from the loop and
@@ -5651,7 +5649,7 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)

/* Don't bother writing the segment valid bits if sector
* programming failed. */
- if (sector_write_failed == FALSE) {
+ if (!sector_write_failed) {
/* Finally validate the new segment by setting bit 15:14
* to 10b in word 0x13 , this can be done without an
* erase as well since these bits are 11 to start with
@@ -5673,7 +5671,7 @@ e1000_commit_shadow_ram(struct e1000_hw *hw)

/* Clear the now not used entry in the cache */
for (i = 0; i < E1000_SHADOW_RAM_WORDS; i++) {
- hw->eeprom_shadow_ram[i].modified = FALSE;
+ hw->eeprom_shadow_ram[i].modified = false;
hw->eeprom_shadow_ram[i].eeprom_word = 0xFFFF;
}
}
@@ -5750,7 +5748,7 @@ e1000_init_rx_addrs(struct e1000_hw *hw)
/* Reserve a spot for the Locally Administered Address to work around
* an 82571 issue in which a reset on one port will reload the MAC on
* the other port. */
- if ((hw->mac_type == e1000_82571) && (hw->laa_is_present == TRUE))
+ if ((hw->mac_type == e1000_82571) && (hw->laa_is_present))
rar_num -= 1;
if (hw->mac_type == e1000_ich8lan)
rar_num = E1000_RAR_ENTRIES_ICH8LAN;
@@ -5922,7 +5920,7 @@ e1000_rar_set(struct e1000_hw *hw,
case e1000_82571:
case e1000_82572:
case e1000_80003es2lan:
- if (hw->leave_av_bit_off == TRUE)
+ if (hw->leave_av_bit_off)
break;
default:
/* Indicate to hardware the Address is Valid. */
@@ -6425,7 +6423,7 @@ e1000_clear_hw_cntrs(struct e1000_hw *hw)
* hw - Struct containing variables accessed by shared code
*
* Call this after e1000_init_hw. You may override the IFS defaults by setting
- * hw->ifs_params_forced to TRUE. However, you must initialize hw->
+ * hw->ifs_params_forced to true. However, you must initialize hw->
* current_ifs_val, ifs_min_val, ifs_max_val, ifs_step_size, and ifs_ratio
* before calling this function.
*****************************************************************************/
@@ -6442,7 +6440,7 @@ e1000_reset_adaptive(struct e1000_hw *hw)
hw->ifs_step_size = IFS_STEP;
hw->ifs_ratio = IFS_RATIO;
}
- hw->in_ifs_mode = FALSE;
+ hw->in_ifs_mode = false;
E1000_WRITE_REG(hw, AIT, 0);
} else {
DEBUGOUT("Not in Adaptive IFS mode!\n");
@@ -6465,7 +6463,7 @@ e1000_update_adaptive(struct e1000_hw *hw)
if (hw->adaptive_ifs) {
if ((hw->collision_delta * hw->ifs_ratio) > hw->tx_packet_delta) {
if (hw->tx_packet_delta > MIN_NUM_XMITS) {
- hw->in_ifs_mode = TRUE;
+ hw->in_ifs_mode = true;
if (hw->current_ifs_val < hw->ifs_max_val) {
if (hw->current_ifs_val == 0)
hw->current_ifs_val = hw->ifs_min_val;
@@ -6477,7 +6475,7 @@ e1000_update_adaptive(struct e1000_hw *hw)
} else {
if (hw->in_ifs_mode && (hw->tx_packet_delta <= MIN_NUM_XMITS)) {
hw->current_ifs_val = 0;
- hw->in_ifs_mode = FALSE;
+ hw->in_ifs_mode = false;
E1000_WRITE_REG(hw, AIT, 0);
}
}
@@ -6968,7 +6966,7 @@ e1000_check_downshift(struct e1000_hw *hw)
M88E1000_PSSR_DOWNSHIFT_SHIFT;
} else if (hw->phy_type == e1000_phy_ife) {
/* e1000_phy_ife supports 10/100 speed only */
- hw->speed_downgraded = FALSE;
+ hw->speed_downgraded = false;
}

return E1000_SUCCESS;
@@ -6988,7 +6986,7 @@ e1000_check_downshift(struct e1000_hw *hw)

static int32_t
e1000_config_dsp_after_link_change(struct e1000_hw *hw,
- boolean_t link_up)
+ bool link_up)
{
int32_t ret_val;
uint16_t phy_data, phy_saved_data, speed, duplex, i;
@@ -7198,7 +7196,7 @@ e1000_set_phy_mode(struct e1000_hw *hw)
if (ret_val)
return ret_val;

- hw->phy_reset_disable = FALSE;
+ hw->phy_reset_disable = false;
}
}

@@ -7221,7 +7219,7 @@ e1000_set_phy_mode(struct e1000_hw *hw)

static int32_t
e1000_set_d3_lplu_state(struct e1000_hw *hw,
- boolean_t active)
+ bool active)
{
uint32_t phy_ctrl = 0;
int32_t ret_val;
@@ -7351,7 +7349,7 @@ e1000_set_d3_lplu_state(struct e1000_hw *hw,

static int32_t
e1000_set_d0_lplu_state(struct e1000_hw *hw,
- boolean_t active)
+ bool active)
{
uint32_t phy_ctrl = 0;
int32_t ret_val;
@@ -7689,9 +7687,9 @@ e1000_mng_write_commit(struct e1000_hw * hw)
/*****************************************************************************
* This function checks the mode of the firmware.
*
- * returns - TRUE when the mode is IAMT or FALSE.
+ * returns - true when the mode is IAMT or false.
****************************************************************************/
-boolean_t
+bool
e1000_check_mng_mode(struct e1000_hw *hw)
{
uint32_t fwsm;
@@ -7701,12 +7699,12 @@ e1000_check_mng_mode(struct e1000_hw *hw)
if (hw->mac_type == e1000_ich8lan) {
if ((fwsm & E1000_FWSM_MODE_MASK) ==
(E1000_MNG_ICH_IAMT_MODE << E1000_FWSM_MODE_SHIFT))
- return TRUE;
+ return true;
} else if ((fwsm & E1000_FWSM_MODE_MASK) ==
(E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT))
- return TRUE;
+ return true;

- return FALSE;
+ return false;
}


@@ -7763,15 +7761,15 @@ e1000_calculate_mng_checksum(char *buffer, uint32_t length)
/*****************************************************************************
* This function checks whether tx pkt filtering needs to be enabled or not.
*
- * returns - TRUE for packet filtering or FALSE.
+ * returns - true for packet filtering or false.
****************************************************************************/
-boolean_t
+bool
e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
{
/* called in init as well as watchdog timer functions */

int32_t ret_val, checksum;
- boolean_t tx_filter = FALSE;
+ bool tx_filter = false;
struct e1000_host_mng_dhcp_cookie *hdr = &(hw->mng_cookie);
uint8_t *buffer = (uint8_t *) &(hw->mng_cookie);

@@ -7787,11 +7785,11 @@ e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
E1000_MNG_DHCP_COOKIE_LENGTH)) {
if (hdr->status &
E1000_MNG_DHCP_COOKIE_STATUS_PARSING_SUPPORT)
- tx_filter = TRUE;
+ tx_filter = true;
} else
- tx_filter = TRUE;
+ tx_filter = true;
} else
- tx_filter = TRUE;
+ tx_filter = true;
}
}

@@ -7804,7 +7802,7 @@ e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
*
* hw - Struct containing variables accessed by shared code
*
- * returns: - TRUE/FALSE
+ * returns: - true/false
*
*****************************************************************************/
uint32_t
@@ -7818,19 +7816,19 @@ e1000_enable_mng_pass_thru(struct e1000_hw *hw)

if (!(manc & E1000_MANC_RCV_TCO_EN) ||
!(manc & E1000_MANC_EN_MAC_ADDR_FILTER))
- return FALSE;
- if (e1000_arc_subsystem_valid(hw) == TRUE) {
+ return false;
+ if (e1000_arc_subsystem_valid(hw)) {
fwsm = E1000_READ_REG(hw, FWSM);
factps = E1000_READ_REG(hw, FACTPS);

if ((((fwsm & E1000_FWSM_MODE_MASK) >> E1000_FWSM_MODE_SHIFT) ==
e1000_mng_mode_pt) && !(factps & E1000_FACTPS_MNGCG))
- return TRUE;
+ return true;
} else
if ((manc & E1000_MANC_SMBUS_EN) && !(manc & E1000_MANC_ASF_EN))
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}

static int32_t
@@ -8264,14 +8262,14 @@ e1000_arc_subsystem_valid(struct e1000_hw *hw)
case e1000_80003es2lan:
fwsm = E1000_READ_REG(hw, FWSM);
if ((fwsm & E1000_FWSM_MODE_MASK) != 0)
- return TRUE;
+ return true;
break;
case e1000_ich8lan:
- return TRUE;
+ return true;
default:
break;
}
- return FALSE;
+ return false;
}


@@ -8417,7 +8415,7 @@ e1000_read_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words,

for (i = 0; i < words; i++) {
if (hw->eeprom_shadow_ram != NULL &&
- hw->eeprom_shadow_ram[offset+i].modified == TRUE) {
+ hw->eeprom_shadow_ram[offset+i].modified) {
data[i] = hw->eeprom_shadow_ram[offset+i].eeprom_word;
} else {
/* The NVM part needs a byte offset, hence * 2 */
@@ -8466,7 +8464,7 @@ e1000_write_eeprom_ich8(struct e1000_hw *hw, uint16_t offset, uint16_t words,
if (hw->eeprom_shadow_ram != NULL) {
for (i = 0; i < words; i++) {
if ((offset + i) < E1000_SHADOW_RAM_WORDS) {
- hw->eeprom_shadow_ram[offset+i].modified = TRUE;
+ hw->eeprom_shadow_ram[offset+i].modified = true;
hw->eeprom_shadow_ram[offset+i].eeprom_word = data[i];
} else {
error = -E1000_ERR_EEPROM;
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index a6c3c34..572a7b6 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -100,8 +100,8 @@ typedef enum {
} e1000_fc_type;

struct e1000_shadow_ram {
- uint16_t eeprom_word;
- boolean_t modified;
+ uint16_t eeprom_word;
+ bool modified;
};

/* PCI bus types */
@@ -274,8 +274,8 @@ struct e1000_eeprom_info {
uint16_t address_bits;
uint16_t delay_usec;
uint16_t page_size;
- boolean_t use_eerd;
- boolean_t use_eewr;
+ bool use_eerd;
+ bool use_eewr;
};

/* Flex ASF Information */
@@ -391,8 +391,8 @@ struct e1000_host_mng_dhcp_cookie{

int32_t e1000_mng_write_dhcp_info(struct e1000_hw *hw, uint8_t *buffer,
uint16_t length);
-boolean_t e1000_check_mng_mode(struct e1000_hw *hw);
-boolean_t e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);
+bool e1000_check_mng_mode(struct e1000_hw *hw);
+bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);
int32_t e1000_read_eeprom(struct e1000_hw *hw, uint16_t reg, uint16_t words, uint16_t *data);
int32_t e1000_validate_eeprom_checksum(struct e1000_hw *hw);
int32_t e1000_update_eeprom_checksum(struct e1000_hw *hw);
@@ -1420,7 +1420,7 @@ struct e1000_hw {
uint32_t ledctl_default;
uint32_t ledctl_mode1;
uint32_t ledctl_mode2;
- boolean_t tx_pkt_filtering;
+ bool tx_pkt_filtering;
struct e1000_host_mng_dhcp_cookie mng_cookie;
uint16_t phy_spd_default;
uint16_t autoneg_advertised;
@@ -1445,30 +1445,30 @@ struct e1000_hw {
uint8_t dma_fairness;
uint8_t mac_addr[NODE_ADDRESS_SIZE];
uint8_t perm_mac_addr[NODE_ADDRESS_SIZE];
- boolean_t disable_polarity_correction;
- boolean_t speed_downgraded;
+ bool disable_polarity_correction;
+ bool speed_downgraded;
e1000_smart_speed smart_speed;
e1000_dsp_config dsp_config_state;
- boolean_t get_link_status;
- boolean_t serdes_link_down;
- boolean_t tbi_compatibility_en;
- boolean_t tbi_compatibility_on;
- boolean_t laa_is_present;
- boolean_t phy_reset_disable;
- boolean_t initialize_hw_bits_disable;
- boolean_t fc_send_xon;
- boolean_t fc_strict_ieee;
- boolean_t report_tx_early;
- boolean_t adaptive_ifs;
- boolean_t ifs_params_forced;
- boolean_t in_ifs_mode;
- boolean_t mng_reg_access_disabled;
- boolean_t leave_av_bit_off;
- boolean_t kmrn_lock_loss_workaround_disabled;
- boolean_t bad_tx_carr_stats_fd;
- boolean_t has_manc2h;
- boolean_t rx_needs_kicking;
- boolean_t has_smbus;
+ bool get_link_status;
+ bool serdes_link_down;
+ bool tbi_compatibility_en;
+ bool tbi_compatibility_on;
+ bool laa_is_present;
+ bool phy_reset_disable;
+ bool initialize_hw_bits_disable;
+ bool fc_send_xon;
+ bool fc_strict_ieee;
+ bool report_tx_early;
+ bool adaptive_ifs;
+ bool ifs_params_forced;
+ bool in_ifs_mode;
+ bool mng_reg_access_disabled;
+ bool leave_av_bit_off;
+ bool kmrn_lock_loss_workaround_disabled;
+ bool bad_tx_carr_stats_fd;
+ bool has_manc2h;
+ bool rx_needs_kicking;
+ bool has_smbus;
};


@@ -2518,11 +2518,11 @@ struct e1000_host_command_info {
* Typical use:
* ...
* if (TBI_ACCEPT) {
- * accept_frame = TRUE;
+ * accept_frame = true;
* e1000_tbi_adjust_stats(adapter, MacAddress);
* frame_length--;
* } else {
- * accept_frame = FALSE;
+ * accept_frame = false;
* }
* ...
*/
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 0991648..37c4655 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -169,21 +169,21 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu);
static int e1000_set_mac(struct net_device *netdev, void *p);
static irqreturn_t e1000_intr(int irq, void *data);
static irqreturn_t e1000_intr_msi(int irq, void *data);
-static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter,
- struct e1000_tx_ring *tx_ring);
+static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
+ struct e1000_tx_ring *tx_ring);
#ifdef CONFIG_E1000_NAPI
static int e1000_clean(struct napi_struct *napi, int budget);
-static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter,
- struct e1000_rx_ring *rx_ring,
- int *work_done, int work_to_do);
-static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
- struct e1000_rx_ring *rx_ring,
- int *work_done, int work_to_do);
+static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
+ struct e1000_rx_ring *rx_ring,
+ int *work_done, int work_to_do);
+static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
+ struct e1000_rx_ring *rx_ring,
+ int *work_done, int work_to_do);
#else
-static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter,
- struct e1000_rx_ring *rx_ring);
-static boolean_t e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
- struct e1000_rx_ring *rx_ring);
+static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
+ struct e1000_rx_ring *rx_ring);
+static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
+ struct e1000_rx_ring *rx_ring);
#endif
static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
struct e1000_rx_ring *rx_ring,
@@ -584,7 +584,7 @@ void e1000_power_up_phy(struct e1000_adapter *adapter)
static void e1000_power_down_phy(struct e1000_adapter *adapter)
{
/* Power down the PHY so no link is implied when interface is down *
- * The PHY cannot be powered down if any of the following is TRUE *
+ * The PHY cannot be powered down if any of the following is true *
* (a) WoL is enabled
* (b) AMT is active
* (c) SoL/IDER session is active */
@@ -673,7 +673,7 @@ e1000_reset(struct e1000_adapter *adapter)
{
uint32_t pba = 0, tx_space, min_tx_space, min_rx_space;
uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF;
- boolean_t legacy_pba_adjust = FALSE;
+ bool legacy_pba_adjust = false;

/* Repartition Pba for greater than 9k mtu
* To take effect CTRL.RST is required.
@@ -687,7 +687,7 @@ e1000_reset(struct e1000_adapter *adapter)
case e1000_82540:
case e1000_82541:
case e1000_82541_rev_2:
- legacy_pba_adjust = TRUE;
+ legacy_pba_adjust = true;
pba = E1000_PBA_48K;
break;
case e1000_82545:
@@ -698,7 +698,7 @@ e1000_reset(struct e1000_adapter *adapter)
break;
case e1000_82547:
case e1000_82547_rev_2:
- legacy_pba_adjust = TRUE;
+ legacy_pba_adjust = true;
pba = E1000_PBA_30K;
break;
case e1000_82571:
@@ -716,7 +716,7 @@ e1000_reset(struct e1000_adapter *adapter)
break;
}

- if (legacy_pba_adjust == TRUE) {
+ if (legacy_pba_adjust) {
if (adapter->netdev->mtu > E1000_RXBUFFER_8192)
pba -= 8; /* allocate more FIFO for Tx */

@@ -1366,15 +1366,15 @@ e1000_sw_init(struct e1000_adapter *adapter)

e1000_set_media_type(hw);

- hw->wait_autoneg_complete = FALSE;
- hw->tbi_compatibility_en = TRUE;
- hw->adaptive_ifs = TRUE;
+ hw->wait_autoneg_complete = false;
+ hw->tbi_compatibility_en = true;
+ hw->adaptive_ifs = true;

/* Copper options */

if (hw->media_type == e1000_media_type_copper) {
hw->mdix = AUTO_ALL_MODES;
- hw->disable_polarity_correction = FALSE;
+ hw->disable_polarity_correction = false;
hw->master_slave = E1000_MASTER_SLAVE;
}

@@ -1576,7 +1576,7 @@ e1000_close(struct net_device *netdev)
* @start: address of beginning of memory
* @len: length of memory
**/
-static boolean_t
+static bool
e1000_check_64k_bound(struct e1000_adapter *adapter,
void *start, unsigned long len)
{
@@ -1587,10 +1587,10 @@ e1000_check_64k_bound(struct e1000_adapter *adapter,
* write location to cross 64k boundary due to errata 23 */
if (adapter->hw.mac_type == e1000_82545 ||
adapter->hw.mac_type == e1000_82546) {
- return ((begin ^ (end - 1)) >> 16) != 0 ? FALSE : TRUE;
+ return ((begin ^ (end - 1)) >> 16) != 0 ? false : true;
}

- return TRUE;
+ return true;
}

/**
@@ -2133,7 +2133,7 @@ e1000_configure_rx(struct e1000_adapter *adapter)
/* Enable 82543 Receive Checksum Offload for TCP and UDP */
if (hw->mac_type >= e1000_82543) {
rxcsum = E1000_READ_REG(hw, RXCSUM);
- if (adapter->rx_csum == TRUE) {
+ if (adapter->rx_csum) {
rxcsum |= E1000_RXCSUM_TUOFL;

/* Enable 82571 IPv4 payload checksum for UDP fragments
@@ -2669,7 +2669,7 @@ e1000_watchdog(unsigned long data)
if (link) {
if (!netif_carrier_ok(netdev)) {
uint32_t ctrl;
- boolean_t txb2b = 1;
+ bool txb2b = true;
e1000_get_speed_and_duplex(&adapter->hw,
&adapter->link_speed,
&adapter->link_duplex);
@@ -2691,12 +2691,12 @@ e1000_watchdog(unsigned long data)
adapter->tx_timeout_factor = 1;
switch (adapter->link_speed) {
case SPEED_10:
- txb2b = 0;
+ txb2b = false;
netdev->tx_queue_len = 10;
adapter->tx_timeout_factor = 8;
break;
case SPEED_100:
- txb2b = 0;
+ txb2b = false;
netdev->tx_queue_len = 100;
/* maybe add some timeout factor ? */
break;
@@ -2704,7 +2704,7 @@ e1000_watchdog(unsigned long data)

if ((adapter->hw.mac_type == e1000_82571 ||
adapter->hw.mac_type == e1000_82572) &&
- txb2b == 0) {
+ !txb2b) {
uint32_t tarc0;
tarc0 = E1000_READ_REG(&adapter->hw, TARC0);
tarc0 &= ~(1 << 21);
@@ -2802,7 +2802,7 @@ e1000_watchdog(unsigned long data)
E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_RXDMT0);

/* Force detection of hung controller every watchdog period */
- adapter->detect_tx_hung = TRUE;
+ adapter->detect_tx_hung = true;

/* With 82571 controllers, LAA may be overwritten due to controller
* reset from the other port. Set the appropriate LAA in RAR[0] */
@@ -3025,12 +3025,12 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
if (++i == tx_ring->count) i = 0;
tx_ring->next_to_use = i;

- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}

-static boolean_t
+static bool
e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
struct sk_buff *skb)
{
@@ -3060,10 +3060,10 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
if (unlikely(++i == tx_ring->count)) i = 0;
tx_ring->next_to_use = i;

- return TRUE;
+ return true;
}

- return FALSE;
+ return false;
}

#define E1000_MAX_TXD_PWR 12
@@ -4038,7 +4038,7 @@ e1000_clean(struct napi_struct *napi, int budget)
* @adapter: board private structure
**/

-static boolean_t
+static bool
e1000_clean_tx_irq(struct e1000_adapter *adapter,
struct e1000_tx_ring *tx_ring)
{
@@ -4049,7 +4049,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
#ifdef CONFIG_E1000_NAPI
unsigned int count = 0;
#endif
- boolean_t cleaned = FALSE;
+ bool cleaned = false;
unsigned int total_tx_bytes=0, total_tx_packets=0;

i = tx_ring->next_to_clean;
@@ -4057,7 +4057,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
eop_desc = E1000_TX_DESC(*tx_ring, eop);

while (eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) {
- for (cleaned = FALSE; !cleaned; ) {
+ for (cleaned = false; !cleaned; ) {
tx_desc = E1000_TX_DESC(*tx_ring, i);
buffer_info = &tx_ring->buffer_info[i];
cleaned = (i == eop);
@@ -4105,7 +4105,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter,
if (adapter->detect_tx_hung) {
/* Detect a transmit hang in hardware, this serializes the
* check with the clearing of time_stamp and movement of i */
- adapter->detect_tx_hung = FALSE;
+ adapter->detect_tx_hung = false;
if (tx_ring->buffer_info[eop].dma &&
time_after(jiffies, tx_ring->buffer_info[eop].time_stamp +
(adapter->tx_timeout_factor * HZ))
@@ -4200,7 +4200,7 @@ e1000_rx_checksum(struct e1000_adapter *adapter,
* @adapter: board private structure
**/

-static boolean_t
+static bool
#ifdef CONFIG_E1000_NAPI
e1000_clean_rx_irq(struct e1000_adapter *adapter,
struct e1000_rx_ring *rx_ring,
@@ -4219,7 +4219,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
uint8_t last_byte;
unsigned int i;
int cleaned_count = 0;
- boolean_t cleaned = FALSE;
+ bool cleaned = false;
unsigned int total_rx_bytes=0, total_rx_packets=0;

i = rx_ring->next_to_clean;
@@ -4247,7 +4247,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,

next_buffer = &rx_ring->buffer_info[i];

- cleaned = TRUE;
+ cleaned = true;
cleaned_count++;
pci_unmap_single(pdev,
buffer_info->dma,
@@ -4373,7 +4373,7 @@ next_desc:
* @adapter: board private structure
**/

-static boolean_t
+static bool
#ifdef CONFIG_E1000_NAPI
e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
struct e1000_rx_ring *rx_ring,
@@ -4393,7 +4393,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
unsigned int i, j;
uint32_t length, staterr;
int cleaned_count = 0;
- boolean_t cleaned = FALSE;
+ bool cleaned = false;
unsigned int total_rx_bytes=0, total_rx_packets=0;

i = rx_ring->next_to_clean;
@@ -4420,7 +4420,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,

next_buffer = &rx_ring->buffer_info[i];

- cleaned = TRUE;
+ cleaned = true;
cleaned_count++;
pci_unmap_single(pdev, buffer_info->dma,
buffer_info->length,
diff --git a/drivers/net/e1000/e1000_osdep.h b/drivers/net/e1000/e1000_osdep.h
index 10af742..365626d 100644
--- a/drivers/net/e1000/e1000_osdep.h
+++ b/drivers/net/e1000/e1000_osdep.h
@@ -41,13 +41,6 @@
#include <linux/interrupt.h>
#include <linux/sched.h>

-typedef enum {
-#undef FALSE
- FALSE = 0,
-#undef TRUE
- TRUE = 1
-} boolean_t;
-
#ifdef DBG
#define DEBUGOUT(S) printk(KERN_DEBUG S "\n")
#define DEBUGOUT1(S, A...) printk(KERN_DEBUG S "\n", A)

2008-03-07 01:25:53

by Joe Perches

[permalink] [raw]
Subject: [PATCH] drivers/net/ixgb - convert boolean_t to bool

> send me a patch for e1000 and for ixgb and I'll happily apply those :)

boolean_t to bool
TRUE to true
FALSE to false

Signed-off-by: Joe Perches <[email protected]>

drivers/net/ixgb/ixgb.h | 8 +++---
drivers/net/ixgb/ixgb_ee.c | 50 +++++++++++++++++-----------------
drivers/net/ixgb/ixgb_ee.h | 2 +-
drivers/net/ixgb/ixgb_ethtool.c | 10 +++---
drivers/net/ixgb/ixgb_hw.c | 56 +++++++++++++++++++-------------------
drivers/net/ixgb/ixgb_hw.h | 18 ++++++------
drivers/net/ixgb/ixgb_main.c | 44 +++++++++++++++---------------
drivers/net/ixgb/ixgb_osdep.h | 7 -----
8 files changed, 94 insertions(+), 101 deletions(-)

diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index 3d2e721..2066161 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -173,15 +173,15 @@ struct ixgb_adapter {
uint64_t hw_csum_tx_error;
uint32_t tx_int_delay;
uint32_t tx_timeout_count;
- boolean_t tx_int_delay_enable;
- boolean_t detect_tx_hung;
+ bool tx_int_delay_enable;
+ bool detect_tx_hung;

/* RX */
struct ixgb_desc_ring rx_ring;
uint64_t hw_csum_rx_error;
uint64_t hw_csum_rx_good;
uint32_t rx_int_delay;
- boolean_t rx_csum;
+ bool rx_csum;

/* OS defined structs */
struct napi_struct napi;
@@ -194,7 +194,7 @@ struct ixgb_adapter {
u16 msg_enable;
struct ixgb_hw_stats stats;
uint32_t alloc_rx_buff_failed;
- boolean_t have_msi;
+ bool have_msi;
};

/* Exported from other modules */
diff --git a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c
index e8eb0fd..1c57ded 100644
--- a/drivers/net/ixgb/ixgb_ee.c
+++ b/drivers/net/ixgb/ixgb_ee.c
@@ -36,7 +36,7 @@ static void ixgb_shift_out_bits(struct ixgb_hw *hw,
uint16_t count);
static void ixgb_standby_eeprom(struct ixgb_hw *hw);

-static boolean_t ixgb_wait_eeprom_command(struct ixgb_hw *hw);
+static bool ixgb_wait_eeprom_command(struct ixgb_hw *hw);

static void ixgb_cleanup_eeprom(struct ixgb_hw *hw);

@@ -279,10 +279,10 @@ ixgb_cleanup_eeprom(struct ixgb_hw *hw)
* The command is done when the EEPROM's data out pin goes high.
*
* Returns:
- * TRUE: EEPROM data pin is high before timeout.
- * FALSE: Time expired.
+ * true: EEPROM data pin is high before timeout.
+ * false: Time expired.
*****************************************************************************/
-static boolean_t
+static bool
ixgb_wait_eeprom_command(struct ixgb_hw *hw)
{
uint32_t eecd_reg;
@@ -301,12 +301,12 @@ ixgb_wait_eeprom_command(struct ixgb_hw *hw)
eecd_reg = IXGB_READ_REG(hw, EECD);

if(eecd_reg & IXGB_EECD_DO)
- return (TRUE);
+ return (true);

udelay(50);
}
ASSERT(0);
- return (FALSE);
+ return (false);
}

/******************************************************************************
@@ -319,10 +319,10 @@ ixgb_wait_eeprom_command(struct ixgb_hw *hw)
* valid.
*
* Returns:
- * TRUE: Checksum is valid
- * FALSE: Checksum is not valid.
+ * true: Checksum is valid
+ * false: Checksum is not valid.
*****************************************************************************/
-boolean_t
+bool
ixgb_validate_eeprom_checksum(struct ixgb_hw *hw)
{
uint16_t checksum = 0;
@@ -332,9 +332,9 @@ ixgb_validate_eeprom_checksum(struct ixgb_hw *hw)
checksum += ixgb_read_eeprom(hw, i);

if(checksum == (uint16_t) EEPROM_SUM)
- return (TRUE);
+ return (true);
else
- return (FALSE);
+ return (false);
}

/******************************************************************************
@@ -457,10 +457,10 @@ ixgb_read_eeprom(struct ixgb_hw *hw,
* hw - Struct containing variables accessed by shared code
*
* Returns:
- * TRUE: if eeprom read is successful
- * FALSE: otherwise.
+ * true: if eeprom read is successful
+ * false: otherwise.
*****************************************************************************/
-boolean_t
+bool
ixgb_get_eeprom_data(struct ixgb_hw *hw)
{
uint16_t i;
@@ -484,16 +484,16 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)
/* clear the init_ctrl_reg_1 to signify that the cache is
* invalidated */
ee_map->init_ctrl_reg_1 = cpu_to_le16(EEPROM_ICW1_SIGNATURE_CLEAR);
- return (FALSE);
+ return (false);
}

if ((ee_map->init_ctrl_reg_1 & cpu_to_le16(EEPROM_ICW1_SIGNATURE_MASK))
!= cpu_to_le16(EEPROM_ICW1_SIGNATURE_VALID)) {
DEBUGOUT("ixgb_ee: Signature invalid.\n");
- return(FALSE);
+ return(false);
}

- return(TRUE);
+ return(true);
}

/******************************************************************************
@@ -503,17 +503,17 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)
* hw - Struct containing variables accessed by shared code
*
* Returns:
- * TRUE: eeprom signature was good and the eeprom read was successful
- * FALSE: otherwise.
+ * true: eeprom signature was good and the eeprom read was successful
+ * false: otherwise.
******************************************************************************/
-static boolean_t
+static bool
ixgb_check_and_get_eeprom_data (struct ixgb_hw* hw)
{
struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;

if ((ee_map->init_ctrl_reg_1 & cpu_to_le16(EEPROM_ICW1_SIGNATURE_MASK))
== cpu_to_le16(EEPROM_ICW1_SIGNATURE_VALID)) {
- return (TRUE);
+ return (true);
} else {
return ixgb_get_eeprom_data(hw);
}
@@ -533,7 +533,7 @@ ixgb_get_eeprom_word(struct ixgb_hw *hw, uint16_t index)
{

if ((index < IXGB_EEPROM_SIZE) &&
- (ixgb_check_and_get_eeprom_data(hw) == TRUE)) {
+ (ixgb_check_and_get_eeprom_data(hw) == true)) {
return(hw->eeprom[index]);
}

@@ -557,7 +557,7 @@ ixgb_get_ee_mac_addr(struct ixgb_hw *hw,

DEBUGFUNC("ixgb_get_ee_mac_addr");

- if (ixgb_check_and_get_eeprom_data(hw) == TRUE) {
+ if (ixgb_check_and_get_eeprom_data(hw) == true) {
for (i = 0; i < IXGB_ETH_LENGTH_OF_ADDRESS; i++) {
mac_addr[i] = ee_map->mac_addr[i];
DEBUGOUT2("mac(%d) = %.2X\n", i, mac_addr[i]);
@@ -577,7 +577,7 @@ ixgb_get_ee_mac_addr(struct ixgb_hw *hw,
uint32_t
ixgb_get_ee_pba_number(struct ixgb_hw *hw)
{
- if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
+ if(ixgb_check_and_get_eeprom_data(hw) == true)
return (le16_to_cpu(hw->eeprom[EEPROM_PBA_1_2_REG])
| (le16_to_cpu(hw->eeprom[EEPROM_PBA_3_4_REG])<<16));

@@ -598,7 +598,7 @@ ixgb_get_ee_device_id(struct ixgb_hw *hw)
{
struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;

- if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
+ if(ixgb_check_and_get_eeprom_data(hw) == true)
return (le16_to_cpu(ee_map->device_id));

return (0);
diff --git a/drivers/net/ixgb/ixgb_ee.h b/drivers/net/ixgb/ixgb_ee.h
index 7908bf3..da62f58 100644
--- a/drivers/net/ixgb/ixgb_ee.h
+++ b/drivers/net/ixgb/ixgb_ee.h
@@ -97,7 +97,7 @@ struct ixgb_ee_map_type {
/* EEPROM Functions */
uint16_t ixgb_read_eeprom(struct ixgb_hw *hw, uint16_t reg);

-boolean_t ixgb_validate_eeprom_checksum(struct ixgb_hw *hw);
+bool ixgb_validate_eeprom_checksum(struct ixgb_hw *hw);

void ixgb_update_eeprom_checksum(struct ixgb_hw *hw);

diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 75f3a68..5d61c2e 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -33,7 +33,7 @@
#include <asm/uaccess.h>

extern int ixgb_up(struct ixgb_adapter *adapter);
-extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog);
+extern void ixgb_down(struct ixgb_adapter *adapter, bool kill_watchdog);
extern void ixgb_reset(struct ixgb_adapter *adapter);
extern int ixgb_setup_rx_resources(struct ixgb_adapter *adapter);
extern int ixgb_setup_tx_resources(struct ixgb_adapter *adapter);
@@ -136,7 +136,7 @@ ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
return -EINVAL;

if(netif_running(adapter->netdev)) {
- ixgb_down(adapter, TRUE);
+ ixgb_down(adapter, true);
ixgb_reset(adapter);
ixgb_up(adapter);
ixgb_set_speed_duplex(netdev);
@@ -185,7 +185,7 @@ ixgb_set_pauseparam(struct net_device *netdev,
hw->fc.type = ixgb_fc_none;

if(netif_running(adapter->netdev)) {
- ixgb_down(adapter, TRUE);
+ ixgb_down(adapter, true);
ixgb_up(adapter);
ixgb_set_speed_duplex(netdev);
} else
@@ -210,7 +210,7 @@ ixgb_set_rx_csum(struct net_device *netdev, uint32_t data)
adapter->rx_csum = data;

if(netif_running(netdev)) {
- ixgb_down(adapter,TRUE);
+ ixgb_down(adapter, true);
ixgb_up(adapter);
ixgb_set_speed_duplex(netdev);
} else
@@ -570,7 +570,7 @@ ixgb_set_ringparam(struct net_device *netdev,
return -EINVAL;

if(netif_running(adapter->netdev))
- ixgb_down(adapter,TRUE);
+ ixgb_down(adapter, true);

rxdr->count = max(ring->rx_pending,(uint32_t)MIN_RXD);
rxdr->count = min(rxdr->count,(uint32_t)MAX_RXD);
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index 80a8b98..522172d 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -41,7 +41,7 @@ static void ixgb_mta_set(struct ixgb_hw *hw, uint32_t hash_value);

static void ixgb_get_bus_info(struct ixgb_hw *hw);

-static boolean_t ixgb_link_reset(struct ixgb_hw *hw);
+static bool ixgb_link_reset(struct ixgb_hw *hw);

static void ixgb_optics_reset(struct ixgb_hw *hw);

@@ -60,9 +60,9 @@ static uint16_t ixgb_read_phy_reg(struct ixgb_hw *hw,
uint32_t phy_address,
uint32_t device_type);

-static boolean_t ixgb_setup_fc(struct ixgb_hw *hw);
+static bool ixgb_setup_fc(struct ixgb_hw *hw);

-static boolean_t mac_addr_valid(uint8_t *mac_addr);
+static bool mac_addr_valid(uint8_t *mac_addr);

static uint32_t ixgb_mac_reset(struct ixgb_hw *hw)
{
@@ -114,7 +114,7 @@ static uint32_t ixgb_mac_reset(struct ixgb_hw *hw)
*
* hw - Struct containing variables accessed by shared code
*****************************************************************************/
-boolean_t
+bool
ixgb_adapter_stop(struct ixgb_hw *hw)
{
uint32_t ctrl_reg;
@@ -127,13 +127,13 @@ ixgb_adapter_stop(struct ixgb_hw *hw)
*/
if(hw->adapter_stopped) {
DEBUGOUT("Exiting because the adapter is already stopped!!!\n");
- return FALSE;
+ return false;
}

/* Set the Adapter Stopped flag so other driver functions stop
* touching the Hardware.
*/
- hw->adapter_stopped = TRUE;
+ hw->adapter_stopped = true;

/* Clear interrupt mask to stop board from generating interrupts */
DEBUGOUT("Masking off all interrupts\n");
@@ -286,15 +286,15 @@ ixgb_identify_phy(struct ixgb_hw *hw)
* Leaves the transmit and receive units disabled and uninitialized.
*
* Returns:
- * TRUE if successful,
- * FALSE if unrecoverable problems were encountered.
+ * true if successful,
+ * false if unrecoverable problems were encountered.
*****************************************************************************/
-boolean_t
+bool
ixgb_init_hw(struct ixgb_hw *hw)
{
uint32_t i;
uint32_t ctrl_reg;
- boolean_t status;
+ bool status;

DEBUGFUNC("ixgb_init_hw");

@@ -318,8 +318,8 @@ ixgb_init_hw(struct ixgb_hw *hw)
/* Delay a few ms just to allow the reset to complete */
msleep(IXGB_DELAY_AFTER_EE_RESET);

- if (ixgb_get_eeprom_data(hw) == FALSE) {
- return(FALSE);
+ if (ixgb_get_eeprom_data(hw) == false) {
+ return(false);
}

/* Use the device id to determine the type of phy/transceiver. */
@@ -337,11 +337,11 @@ ixgb_init_hw(struct ixgb_hw *hw)
*/
if (!mac_addr_valid(hw->curr_mac_addr)) {
DEBUGOUT("MAC address invalid after ixgb_init_rx_addrs\n");
- return(FALSE);
+ return(false);
}

/* tell the routines in this file they can access hardware again */
- hw->adapter_stopped = FALSE;
+ hw->adapter_stopped = false;

/* Fill in the bus_info structure */
ixgb_get_bus_info(hw);
@@ -661,12 +661,12 @@ ixgb_clear_vfta(struct ixgb_hw *hw)
* hw - Struct containing variables accessed by shared code
*****************************************************************************/

-static boolean_t
+static bool
ixgb_setup_fc(struct ixgb_hw *hw)
{
uint32_t ctrl_reg;
uint32_t pap_reg = 0; /* by default, assume no pause time */
- boolean_t status = TRUE;
+ bool status = true;

DEBUGFUNC("ixgb_setup_fc");

@@ -950,7 +950,7 @@ ixgb_check_for_link(struct ixgb_hw *hw)

if ((xpcss_reg & IXGB_XPCSS_ALIGN_STATUS) &&
(status_reg & IXGB_STATUS_LU)) {
- hw->link_up = TRUE;
+ hw->link_up = true;
} else if (!(xpcss_reg & IXGB_XPCSS_ALIGN_STATUS) &&
(status_reg & IXGB_STATUS_LU)) {
DEBUGOUT("XPCSS Not Aligned while Status:LU is set.\n");
@@ -974,10 +974,10 @@ ixgb_check_for_link(struct ixgb_hw *hw)
*
* Called by any function that needs to check the link status of the adapter.
*****************************************************************************/
-boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw)
+bool ixgb_check_for_bad_link(struct ixgb_hw *hw)
{
uint32_t newLFC, newRFC;
- boolean_t bad_link_returncode = FALSE;
+ bool bad_link_returncode = false;

if (hw->phy_type == ixgb_phy_type_txn17401) {
newLFC = IXGB_READ_REG(hw, LFC);
@@ -986,7 +986,7 @@ boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw)
|| (hw->lastRFC + 250 < newRFC)) {
DEBUGOUT
("BAD LINK! too many LFC/RFC since last check\n");
- bad_link_returncode = TRUE;
+ bad_link_returncode = true;
}
hw->lastLFC = newLFC;
hw->lastRFC = newRFC;
@@ -1155,21 +1155,21 @@ ixgb_get_bus_info(struct ixgb_hw *hw)
* mac_addr - pointer to MAC address.
*
*****************************************************************************/
-static boolean_t
+static bool
mac_addr_valid(uint8_t *mac_addr)
{
- boolean_t is_valid = TRUE;
+ bool is_valid = true;
DEBUGFUNC("mac_addr_valid");

/* Make sure it is not a multicast address */
if (IS_MULTICAST(mac_addr)) {
DEBUGOUT("MAC address is multicast\n");
- is_valid = FALSE;
+ is_valid = false;
}
/* Not a broadcast address */
else if (IS_BROADCAST(mac_addr)) {
DEBUGOUT("MAC address is broadcast\n");
- is_valid = FALSE;
+ is_valid = false;
}
/* Reject the zero address */
else if (mac_addr[0] == 0 &&
@@ -1179,7 +1179,7 @@ mac_addr_valid(uint8_t *mac_addr)
mac_addr[4] == 0 &&
mac_addr[5] == 0) {
DEBUGOUT("MAC address is all zeros\n");
- is_valid = FALSE;
+ is_valid = false;
}
return (is_valid);
}
@@ -1190,10 +1190,10 @@ mac_addr_valid(uint8_t *mac_addr)
*
* hw - Struct containing variables accessed by shared code
*****************************************************************************/
-static boolean_t
+static bool
ixgb_link_reset(struct ixgb_hw *hw)
{
- boolean_t link_status = FALSE;
+ bool link_status = false;
uint8_t wait_retries = MAX_RESET_ITERATIONS;
uint8_t lrst_retries = MAX_RESET_ITERATIONS;

@@ -1208,7 +1208,7 @@ ixgb_link_reset(struct ixgb_hw *hw)
link_status =
((IXGB_READ_REG(hw, STATUS) & IXGB_STATUS_LU)
&& (IXGB_READ_REG(hw, XPCSS) &
- IXGB_XPCSS_ALIGN_STATUS)) ? TRUE : FALSE;
+ IXGB_XPCSS_ALIGN_STATUS)) ? true : false;
} while (!link_status && --wait_retries);

} while (!link_status && --lrst_retries);
diff --git a/drivers/net/ixgb/ixgb_hw.h b/drivers/net/ixgb/ixgb_hw.h
index 4f176ff..d4e9566 100644
--- a/drivers/net/ixgb/ixgb_hw.h
+++ b/drivers/net/ixgb/ixgb_hw.h
@@ -650,7 +650,7 @@ struct ixgb_flash_buffer {
* This is a little-endian specific check.
*/
#define IS_MULTICAST(Address) \
- (boolean_t)(((uint8_t *)(Address))[0] & ((uint8_t)0x01))
+ (bool)(((uint8_t *)(Address))[0] & ((uint8_t)0x01))

/*
* Check whether an address is broadcast.
@@ -663,7 +663,7 @@ struct ixgb_fc {
uint32_t high_water; /* Flow Control High-water */
uint32_t low_water; /* Flow Control Low-water */
uint16_t pause_time; /* Flow Control Pause timer */
- boolean_t send_xon; /* Flow control send XON */
+ bool send_xon; /* Flow control send XON */
ixgb_fc_type type; /* Type of flow control */
};

@@ -700,8 +700,8 @@ struct ixgb_hw {
uint32_t num_tx_desc; /* Number of Transmit descriptors */
uint32_t num_rx_desc; /* Number of Receive descriptors */
uint32_t rx_buffer_size; /* Size of Receive buffer */
- boolean_t link_up; /* TRUE if link is valid */
- boolean_t adapter_stopped; /* State of adapter */
+ bool link_up; /* true if link is valid */
+ bool adapter_stopped; /* State of adapter */
uint16_t device_id; /* device id from PCI configuration space */
uint16_t vendor_id; /* vendor id from PCI configuration space */
uint8_t revision_id; /* revision id from PCI configuration space */
@@ -783,11 +783,11 @@ struct ixgb_hw_stats {
};

/* Function Prototypes */
-extern boolean_t ixgb_adapter_stop(struct ixgb_hw *hw);
-extern boolean_t ixgb_init_hw(struct ixgb_hw *hw);
-extern boolean_t ixgb_adapter_start(struct ixgb_hw *hw);
+extern bool ixgb_adapter_stop(struct ixgb_hw *hw);
+extern bool ixgb_init_hw(struct ixgb_hw *hw);
+extern bool ixgb_adapter_start(struct ixgb_hw *hw);
extern void ixgb_check_for_link(struct ixgb_hw *hw);
-extern boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw);
+extern bool ixgb_check_for_bad_link(struct ixgb_hw *hw);

extern void ixgb_rar_set(struct ixgb_hw *hw,
uint8_t *addr,
@@ -809,7 +809,7 @@ extern void ixgb_write_vfta(struct ixgb_hw *hw,
void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, uint8_t *mac_addr);
uint32_t ixgb_get_ee_pba_number(struct ixgb_hw *hw);
uint16_t ixgb_get_ee_device_id(struct ixgb_hw *hw);
-boolean_t ixgb_get_eeprom_data(struct ixgb_hw *hw);
+bool ixgb_get_eeprom_data(struct ixgb_hw *hw);
__le16 ixgb_get_eeprom_word(struct ixgb_hw *hw, uint16_t index);

/* Everything else */
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 269e6f8..ae71dd1 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -67,7 +67,7 @@ MODULE_DEVICE_TABLE(pci, ixgb_pci_tbl);
/* Local Function Prototypes */

int ixgb_up(struct ixgb_adapter *adapter);
-void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog);
+void ixgb_down(struct ixgb_adapter *adapter, bool kill_watchdog);
void ixgb_reset(struct ixgb_adapter *adapter);
int ixgb_setup_tx_resources(struct ixgb_adapter *adapter);
int ixgb_setup_rx_resources(struct ixgb_adapter *adapter);
@@ -94,14 +94,14 @@ static struct net_device_stats *ixgb_get_stats(struct net_device *netdev);
static int ixgb_change_mtu(struct net_device *netdev, int new_mtu);
static int ixgb_set_mac(struct net_device *netdev, void *p);
static irqreturn_t ixgb_intr(int irq, void *data);
-static boolean_t ixgb_clean_tx_irq(struct ixgb_adapter *adapter);
+static bool ixgb_clean_tx_irq(struct ixgb_adapter *adapter);

#ifdef CONFIG_IXGB_NAPI
static int ixgb_clean(struct napi_struct *napi, int budget);
-static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter,
- int *work_done, int work_to_do);
+static bool ixgb_clean_rx_irq(struct ixgb_adapter *adapter,
+ int *work_done, int work_to_do);
#else
-static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter);
+static bool ixgb_clean_rx_irq(struct ixgb_adapter *adapter);
#endif
static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter);
static void ixgb_tx_timeout(struct net_device *dev);
@@ -294,7 +294,7 @@ ixgb_up(struct ixgb_adapter *adapter)
}

void
-ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
+ixgb_down(struct ixgb_adapter *adapter, bool kill_watchdog)
{
struct net_device *netdev = adapter->netdev;

@@ -656,7 +656,7 @@ ixgb_close(struct net_device *netdev)
{
struct ixgb_adapter *adapter = netdev_priv(netdev);

- ixgb_down(adapter, TRUE);
+ ixgb_down(adapter, true);

ixgb_free_tx_resources(adapter);
ixgb_free_rx_resources(adapter);
@@ -881,7 +881,7 @@ ixgb_configure_rx(struct ixgb_adapter *adapter)
IXGB_WRITE_REG(hw, RXDCTL, rxdctl);

/* Enable Receive Checksum Offload for TCP and UDP */
- if(adapter->rx_csum == TRUE) {
+ if(adapter->rx_csum) {
rxcsum = IXGB_READ_REG(hw, RXCSUM);
rxcsum |= IXGB_RXCSUM_TUOFL;
IXGB_WRITE_REG(hw, RXCSUM, rxcsum);
@@ -1164,7 +1164,7 @@ ixgb_watchdog(unsigned long data)
}

/* Force detection of hung controller every watchdog period */
- adapter->detect_tx_hung = TRUE;
+ adapter->detect_tx_hung = true;

/* generate an interrupt to force clean up of any stragglers */
IXGB_WRITE_REG(&adapter->hw, ICS, IXGB_INT_TXDW);
@@ -1243,7 +1243,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
return 0;
}

-static boolean_t
+static bool
ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
{
struct ixgb_context_desc *context_desc;
@@ -1275,10 +1275,10 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
if(++i == adapter->tx_ring.count) i = 0;
adapter->tx_ring.next_to_use = i;

- return TRUE;
+ return true;
}

- return FALSE;
+ return false;
}

#define IXGB_MAX_TXD_PWR 14
@@ -1548,7 +1548,7 @@ ixgb_tx_timeout_task(struct work_struct *work)
container_of(work, struct ixgb_adapter, tx_timeout_task);

adapter->tx_timeout_count++;
- ixgb_down(adapter, TRUE);
+ ixgb_down(adapter, true);
ixgb_up(adapter);
}

@@ -1595,7 +1595,7 @@ ixgb_change_mtu(struct net_device *netdev, int new_mtu)
netdev->mtu = new_mtu;

if ((old_max_frame != max_frame) && netif_running(netdev)) {
- ixgb_down(adapter, TRUE);
+ ixgb_down(adapter, true);
ixgb_up(adapter);
}

@@ -1812,7 +1812,7 @@ ixgb_clean(struct napi_struct *napi, int budget)
* @adapter: board private structure
**/

-static boolean_t
+static bool
ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
{
struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
@@ -1820,7 +1820,7 @@ ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
struct ixgb_tx_desc *tx_desc, *eop_desc;
struct ixgb_buffer *buffer_info;
unsigned int i, eop;
- boolean_t cleaned = FALSE;
+ bool cleaned = false;

i = tx_ring->next_to_clean;
eop = tx_ring->buffer_info[i].next_to_watch;
@@ -1828,7 +1828,7 @@ ixgb_clean_tx_irq(struct ixgb_adapter *adapter)

while(eop_desc->status & IXGB_TX_DESC_STATUS_DD) {

- for(cleaned = FALSE; !cleaned; ) {
+ for(cleaned = false; !cleaned; ) {
tx_desc = IXGB_TX_DESC(*tx_ring, i);
buffer_info = &tx_ring->buffer_info[i];

@@ -1862,7 +1862,7 @@ ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
if(adapter->detect_tx_hung) {
/* detect a transmit hang in hardware, this serializes the
* check with the clearing of time_stamp and movement of i */
- adapter->detect_tx_hung = FALSE;
+ adapter->detect_tx_hung = false;
if (tx_ring->buffer_info[eop].dma &&
time_after(jiffies, tx_ring->buffer_info[eop].time_stamp + HZ)
&& !(IXGB_READ_REG(&adapter->hw, STATUS) &
@@ -1932,7 +1932,7 @@ ixgb_rx_checksum(struct ixgb_adapter *adapter,
* @adapter: board private structure
**/

-static boolean_t
+static bool
#ifdef CONFIG_IXGB_NAPI
ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
#else
@@ -1946,7 +1946,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
struct ixgb_buffer *buffer_info, *next_buffer, *next2_buffer;
uint32_t length;
unsigned int i, j;
- boolean_t cleaned = FALSE;
+ bool cleaned = false;

i = rx_ring->next_to_clean;
rx_desc = IXGB_RX_DESC(*rx_ring, i);
@@ -1980,7 +1980,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
next_skb = next_buffer->skb;
prefetch(next_skb);

- cleaned = TRUE;
+ cleaned = true;

pci_unmap_single(pdev,
buffer_info->dma,
@@ -2279,7 +2279,7 @@ static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev,
struct ixgb_adapter *adapter = netdev_priv(netdev);

if(netif_running(netdev))
- ixgb_down(adapter, TRUE);
+ ixgb_down(adapter, true);

pci_disable_device(pdev);

diff --git a/drivers/net/ixgb/ixgb_osdep.h b/drivers/net/ixgb/ixgb_osdep.h
index 9e04a6b..4be1b27 100644
--- a/drivers/net/ixgb/ixgb_osdep.h
+++ b/drivers/net/ixgb/ixgb_osdep.h
@@ -39,13 +39,6 @@
#include <linux/interrupt.h>
#include <linux/sched.h>

-typedef enum {
-#undef FALSE
- FALSE = 0,
-#undef TRUE
- TRUE = 1
-} boolean_t;
-
#undef ASSERT
#define ASSERT(x) if(!(x)) BUG()
#define MSGOUT(S, A, B) printk(KERN_DEBUG S "\n", A, B)

2008-03-07 17:15:26

by Kok, Auke

[permalink] [raw]
Subject: Re: [PATCH] drivers/net/ixgb - convert boolean_t to bool

Joe Perches wrote:
>> send me a patch for e1000 and for ixgb and I'll happily apply those :)
>
> boolean_t to bool
> TRUE to true
> FALSE to false
>
> Signed-off-by: Joe Perches <[email protected]>


thanks Joe, I'll apply both. (I'll fix up the checkpatch warnings)

Auke




>
> drivers/net/ixgb/ixgb.h | 8 +++---
> drivers/net/ixgb/ixgb_ee.c | 50 +++++++++++++++++-----------------
> drivers/net/ixgb/ixgb_ee.h | 2 +-
> drivers/net/ixgb/ixgb_ethtool.c | 10 +++---
> drivers/net/ixgb/ixgb_hw.c | 56 +++++++++++++++++++-------------------
> drivers/net/ixgb/ixgb_hw.h | 18 ++++++------
> drivers/net/ixgb/ixgb_main.c | 44 +++++++++++++++---------------
> drivers/net/ixgb/ixgb_osdep.h | 7 -----
> 8 files changed, 94 insertions(+), 101 deletions(-)
>
> diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
> index 3d2e721..2066161 100644
> --- a/drivers/net/ixgb/ixgb.h
> +++ b/drivers/net/ixgb/ixgb.h
> @@ -173,15 +173,15 @@ struct ixgb_adapter {
> uint64_t hw_csum_tx_error;
> uint32_t tx_int_delay;
> uint32_t tx_timeout_count;
> - boolean_t tx_int_delay_enable;
> - boolean_t detect_tx_hung;
> + bool tx_int_delay_enable;
> + bool detect_tx_hung;
>
> /* RX */
> struct ixgb_desc_ring rx_ring;
> uint64_t hw_csum_rx_error;
> uint64_t hw_csum_rx_good;
> uint32_t rx_int_delay;
> - boolean_t rx_csum;
> + bool rx_csum;
>
> /* OS defined structs */
> struct napi_struct napi;
> @@ -194,7 +194,7 @@ struct ixgb_adapter {
> u16 msg_enable;
> struct ixgb_hw_stats stats;
> uint32_t alloc_rx_buff_failed;
> - boolean_t have_msi;
> + bool have_msi;
> };
>
> /* Exported from other modules */
> diff --git a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c
> index e8eb0fd..1c57ded 100644
> --- a/drivers/net/ixgb/ixgb_ee.c
> +++ b/drivers/net/ixgb/ixgb_ee.c
> @@ -36,7 +36,7 @@ static void ixgb_shift_out_bits(struct ixgb_hw *hw,
> uint16_t count);
> static void ixgb_standby_eeprom(struct ixgb_hw *hw);
>
> -static boolean_t ixgb_wait_eeprom_command(struct ixgb_hw *hw);
> +static bool ixgb_wait_eeprom_command(struct ixgb_hw *hw);
>
> static void ixgb_cleanup_eeprom(struct ixgb_hw *hw);
>
> @@ -279,10 +279,10 @@ ixgb_cleanup_eeprom(struct ixgb_hw *hw)
> * The command is done when the EEPROM's data out pin goes high.
> *
> * Returns:
> - * TRUE: EEPROM data pin is high before timeout.
> - * FALSE: Time expired.
> + * true: EEPROM data pin is high before timeout.
> + * false: Time expired.
> *****************************************************************************/
> -static boolean_t
> +static bool
> ixgb_wait_eeprom_command(struct ixgb_hw *hw)
> {
> uint32_t eecd_reg;
> @@ -301,12 +301,12 @@ ixgb_wait_eeprom_command(struct ixgb_hw *hw)
> eecd_reg = IXGB_READ_REG(hw, EECD);
>
> if(eecd_reg & IXGB_EECD_DO)
> - return (TRUE);
> + return (true);
>
> udelay(50);
> }
> ASSERT(0);
> - return (FALSE);
> + return (false);
> }
>
> /******************************************************************************
> @@ -319,10 +319,10 @@ ixgb_wait_eeprom_command(struct ixgb_hw *hw)
> * valid.
> *
> * Returns:
> - * TRUE: Checksum is valid
> - * FALSE: Checksum is not valid.
> + * true: Checksum is valid
> + * false: Checksum is not valid.
> *****************************************************************************/
> -boolean_t
> +bool
> ixgb_validate_eeprom_checksum(struct ixgb_hw *hw)
> {
> uint16_t checksum = 0;
> @@ -332,9 +332,9 @@ ixgb_validate_eeprom_checksum(struct ixgb_hw *hw)
> checksum += ixgb_read_eeprom(hw, i);
>
> if(checksum == (uint16_t) EEPROM_SUM)
> - return (TRUE);
> + return (true);
> else
> - return (FALSE);
> + return (false);
> }
>
> /******************************************************************************
> @@ -457,10 +457,10 @@ ixgb_read_eeprom(struct ixgb_hw *hw,
> * hw - Struct containing variables accessed by shared code
> *
> * Returns:
> - * TRUE: if eeprom read is successful
> - * FALSE: otherwise.
> + * true: if eeprom read is successful
> + * false: otherwise.
> *****************************************************************************/
> -boolean_t
> +bool
> ixgb_get_eeprom_data(struct ixgb_hw *hw)
> {
> uint16_t i;
> @@ -484,16 +484,16 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)
> /* clear the init_ctrl_reg_1 to signify that the cache is
> * invalidated */
> ee_map->init_ctrl_reg_1 = cpu_to_le16(EEPROM_ICW1_SIGNATURE_CLEAR);
> - return (FALSE);
> + return (false);
> }
>
> if ((ee_map->init_ctrl_reg_1 & cpu_to_le16(EEPROM_ICW1_SIGNATURE_MASK))
> != cpu_to_le16(EEPROM_ICW1_SIGNATURE_VALID)) {
> DEBUGOUT("ixgb_ee: Signature invalid.\n");
> - return(FALSE);
> + return(false);
> }
>
> - return(TRUE);
> + return(true);
> }
>
> /******************************************************************************
> @@ -503,17 +503,17 @@ ixgb_get_eeprom_data(struct ixgb_hw *hw)
> * hw - Struct containing variables accessed by shared code
> *
> * Returns:
> - * TRUE: eeprom signature was good and the eeprom read was successful
> - * FALSE: otherwise.
> + * true: eeprom signature was good and the eeprom read was successful
> + * false: otherwise.
> ******************************************************************************/
> -static boolean_t
> +static bool
> ixgb_check_and_get_eeprom_data (struct ixgb_hw* hw)
> {
> struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
>
> if ((ee_map->init_ctrl_reg_1 & cpu_to_le16(EEPROM_ICW1_SIGNATURE_MASK))
> == cpu_to_le16(EEPROM_ICW1_SIGNATURE_VALID)) {
> - return (TRUE);
> + return (true);
> } else {
> return ixgb_get_eeprom_data(hw);
> }
> @@ -533,7 +533,7 @@ ixgb_get_eeprom_word(struct ixgb_hw *hw, uint16_t index)
> {
>
> if ((index < IXGB_EEPROM_SIZE) &&
> - (ixgb_check_and_get_eeprom_data(hw) == TRUE)) {
> + (ixgb_check_and_get_eeprom_data(hw) == true)) {
> return(hw->eeprom[index]);
> }
>
> @@ -557,7 +557,7 @@ ixgb_get_ee_mac_addr(struct ixgb_hw *hw,
>
> DEBUGFUNC("ixgb_get_ee_mac_addr");
>
> - if (ixgb_check_and_get_eeprom_data(hw) == TRUE) {
> + if (ixgb_check_and_get_eeprom_data(hw) == true) {
> for (i = 0; i < IXGB_ETH_LENGTH_OF_ADDRESS; i++) {
> mac_addr[i] = ee_map->mac_addr[i];
> DEBUGOUT2("mac(%d) = %.2X\n", i, mac_addr[i]);
> @@ -577,7 +577,7 @@ ixgb_get_ee_mac_addr(struct ixgb_hw *hw,
> uint32_t
> ixgb_get_ee_pba_number(struct ixgb_hw *hw)
> {
> - if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
> + if(ixgb_check_and_get_eeprom_data(hw) == true)
> return (le16_to_cpu(hw->eeprom[EEPROM_PBA_1_2_REG])
> | (le16_to_cpu(hw->eeprom[EEPROM_PBA_3_4_REG])<<16));
>
> @@ -598,7 +598,7 @@ ixgb_get_ee_device_id(struct ixgb_hw *hw)
> {
> struct ixgb_ee_map_type *ee_map = (struct ixgb_ee_map_type *)hw->eeprom;
>
> - if(ixgb_check_and_get_eeprom_data(hw) == TRUE)
> + if(ixgb_check_and_get_eeprom_data(hw) == true)
> return (le16_to_cpu(ee_map->device_id));
>
> return (0);
> diff --git a/drivers/net/ixgb/ixgb_ee.h b/drivers/net/ixgb/ixgb_ee.h
> index 7908bf3..da62f58 100644
> --- a/drivers/net/ixgb/ixgb_ee.h
> +++ b/drivers/net/ixgb/ixgb_ee.h
> @@ -97,7 +97,7 @@ struct ixgb_ee_map_type {
> /* EEPROM Functions */
> uint16_t ixgb_read_eeprom(struct ixgb_hw *hw, uint16_t reg);
>
> -boolean_t ixgb_validate_eeprom_checksum(struct ixgb_hw *hw);
> +bool ixgb_validate_eeprom_checksum(struct ixgb_hw *hw);
>
> void ixgb_update_eeprom_checksum(struct ixgb_hw *hw);
>
> diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
> index 75f3a68..5d61c2e 100644
> --- a/drivers/net/ixgb/ixgb_ethtool.c
> +++ b/drivers/net/ixgb/ixgb_ethtool.c
> @@ -33,7 +33,7 @@
> #include <asm/uaccess.h>
>
> extern int ixgb_up(struct ixgb_adapter *adapter);
> -extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog);
> +extern void ixgb_down(struct ixgb_adapter *adapter, bool kill_watchdog);
> extern void ixgb_reset(struct ixgb_adapter *adapter);
> extern int ixgb_setup_rx_resources(struct ixgb_adapter *adapter);
> extern int ixgb_setup_tx_resources(struct ixgb_adapter *adapter);
> @@ -136,7 +136,7 @@ ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
> return -EINVAL;
>
> if(netif_running(adapter->netdev)) {
> - ixgb_down(adapter, TRUE);
> + ixgb_down(adapter, true);
> ixgb_reset(adapter);
> ixgb_up(adapter);
> ixgb_set_speed_duplex(netdev);
> @@ -185,7 +185,7 @@ ixgb_set_pauseparam(struct net_device *netdev,
> hw->fc.type = ixgb_fc_none;
>
> if(netif_running(adapter->netdev)) {
> - ixgb_down(adapter, TRUE);
> + ixgb_down(adapter, true);
> ixgb_up(adapter);
> ixgb_set_speed_duplex(netdev);
> } else
> @@ -210,7 +210,7 @@ ixgb_set_rx_csum(struct net_device *netdev, uint32_t data)
> adapter->rx_csum = data;
>
> if(netif_running(netdev)) {
> - ixgb_down(adapter,TRUE);
> + ixgb_down(adapter, true);
> ixgb_up(adapter);
> ixgb_set_speed_duplex(netdev);
> } else
> @@ -570,7 +570,7 @@ ixgb_set_ringparam(struct net_device *netdev,
> return -EINVAL;
>
> if(netif_running(adapter->netdev))
> - ixgb_down(adapter,TRUE);
> + ixgb_down(adapter, true);
>
> rxdr->count = max(ring->rx_pending,(uint32_t)MIN_RXD);
> rxdr->count = min(rxdr->count,(uint32_t)MAX_RXD);
> diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
> index 80a8b98..522172d 100644
> --- a/drivers/net/ixgb/ixgb_hw.c
> +++ b/drivers/net/ixgb/ixgb_hw.c
> @@ -41,7 +41,7 @@ static void ixgb_mta_set(struct ixgb_hw *hw, uint32_t hash_value);
>
> static void ixgb_get_bus_info(struct ixgb_hw *hw);
>
> -static boolean_t ixgb_link_reset(struct ixgb_hw *hw);
> +static bool ixgb_link_reset(struct ixgb_hw *hw);
>
> static void ixgb_optics_reset(struct ixgb_hw *hw);
>
> @@ -60,9 +60,9 @@ static uint16_t ixgb_read_phy_reg(struct ixgb_hw *hw,
> uint32_t phy_address,
> uint32_t device_type);
>
> -static boolean_t ixgb_setup_fc(struct ixgb_hw *hw);
> +static bool ixgb_setup_fc(struct ixgb_hw *hw);
>
> -static boolean_t mac_addr_valid(uint8_t *mac_addr);
> +static bool mac_addr_valid(uint8_t *mac_addr);
>
> static uint32_t ixgb_mac_reset(struct ixgb_hw *hw)
> {
> @@ -114,7 +114,7 @@ static uint32_t ixgb_mac_reset(struct ixgb_hw *hw)
> *
> * hw - Struct containing variables accessed by shared code
> *****************************************************************************/
> -boolean_t
> +bool
> ixgb_adapter_stop(struct ixgb_hw *hw)
> {
> uint32_t ctrl_reg;
> @@ -127,13 +127,13 @@ ixgb_adapter_stop(struct ixgb_hw *hw)
> */
> if(hw->adapter_stopped) {
> DEBUGOUT("Exiting because the adapter is already stopped!!!\n");
> - return FALSE;
> + return false;
> }
>
> /* Set the Adapter Stopped flag so other driver functions stop
> * touching the Hardware.
> */
> - hw->adapter_stopped = TRUE;
> + hw->adapter_stopped = true;
>
> /* Clear interrupt mask to stop board from generating interrupts */
> DEBUGOUT("Masking off all interrupts\n");
> @@ -286,15 +286,15 @@ ixgb_identify_phy(struct ixgb_hw *hw)
> * Leaves the transmit and receive units disabled and uninitialized.
> *
> * Returns:
> - * TRUE if successful,
> - * FALSE if unrecoverable problems were encountered.
> + * true if successful,
> + * false if unrecoverable problems were encountered.
> *****************************************************************************/
> -boolean_t
> +bool
> ixgb_init_hw(struct ixgb_hw *hw)
> {
> uint32_t i;
> uint32_t ctrl_reg;
> - boolean_t status;
> + bool status;
>
> DEBUGFUNC("ixgb_init_hw");
>
> @@ -318,8 +318,8 @@ ixgb_init_hw(struct ixgb_hw *hw)
> /* Delay a few ms just to allow the reset to complete */
> msleep(IXGB_DELAY_AFTER_EE_RESET);
>
> - if (ixgb_get_eeprom_data(hw) == FALSE) {
> - return(FALSE);
> + if (ixgb_get_eeprom_data(hw) == false) {
> + return(false);
> }
>
> /* Use the device id to determine the type of phy/transceiver. */
> @@ -337,11 +337,11 @@ ixgb_init_hw(struct ixgb_hw *hw)
> */
> if (!mac_addr_valid(hw->curr_mac_addr)) {
> DEBUGOUT("MAC address invalid after ixgb_init_rx_addrs\n");
> - return(FALSE);
> + return(false);
> }
>
> /* tell the routines in this file they can access hardware again */
> - hw->adapter_stopped = FALSE;
> + hw->adapter_stopped = false;
>
> /* Fill in the bus_info structure */
> ixgb_get_bus_info(hw);
> @@ -661,12 +661,12 @@ ixgb_clear_vfta(struct ixgb_hw *hw)
> * hw - Struct containing variables accessed by shared code
> *****************************************************************************/
>
> -static boolean_t
> +static bool
> ixgb_setup_fc(struct ixgb_hw *hw)
> {
> uint32_t ctrl_reg;
> uint32_t pap_reg = 0; /* by default, assume no pause time */
> - boolean_t status = TRUE;
> + bool status = true;
>
> DEBUGFUNC("ixgb_setup_fc");
>
> @@ -950,7 +950,7 @@ ixgb_check_for_link(struct ixgb_hw *hw)
>
> if ((xpcss_reg & IXGB_XPCSS_ALIGN_STATUS) &&
> (status_reg & IXGB_STATUS_LU)) {
> - hw->link_up = TRUE;
> + hw->link_up = true;
> } else if (!(xpcss_reg & IXGB_XPCSS_ALIGN_STATUS) &&
> (status_reg & IXGB_STATUS_LU)) {
> DEBUGOUT("XPCSS Not Aligned while Status:LU is set.\n");
> @@ -974,10 +974,10 @@ ixgb_check_for_link(struct ixgb_hw *hw)
> *
> * Called by any function that needs to check the link status of the adapter.
> *****************************************************************************/
> -boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw)
> +bool ixgb_check_for_bad_link(struct ixgb_hw *hw)
> {
> uint32_t newLFC, newRFC;
> - boolean_t bad_link_returncode = FALSE;
> + bool bad_link_returncode = false;
>
> if (hw->phy_type == ixgb_phy_type_txn17401) {
> newLFC = IXGB_READ_REG(hw, LFC);
> @@ -986,7 +986,7 @@ boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw)
> || (hw->lastRFC + 250 < newRFC)) {
> DEBUGOUT
> ("BAD LINK! too many LFC/RFC since last check\n");
> - bad_link_returncode = TRUE;
> + bad_link_returncode = true;
> }
> hw->lastLFC = newLFC;
> hw->lastRFC = newRFC;
> @@ -1155,21 +1155,21 @@ ixgb_get_bus_info(struct ixgb_hw *hw)
> * mac_addr - pointer to MAC address.
> *
> *****************************************************************************/
> -static boolean_t
> +static bool
> mac_addr_valid(uint8_t *mac_addr)
> {
> - boolean_t is_valid = TRUE;
> + bool is_valid = true;
> DEBUGFUNC("mac_addr_valid");
>
> /* Make sure it is not a multicast address */
> if (IS_MULTICAST(mac_addr)) {
> DEBUGOUT("MAC address is multicast\n");
> - is_valid = FALSE;
> + is_valid = false;
> }
> /* Not a broadcast address */
> else if (IS_BROADCAST(mac_addr)) {
> DEBUGOUT("MAC address is broadcast\n");
> - is_valid = FALSE;
> + is_valid = false;
> }
> /* Reject the zero address */
> else if (mac_addr[0] == 0 &&
> @@ -1179,7 +1179,7 @@ mac_addr_valid(uint8_t *mac_addr)
> mac_addr[4] == 0 &&
> mac_addr[5] == 0) {
> DEBUGOUT("MAC address is all zeros\n");
> - is_valid = FALSE;
> + is_valid = false;
> }
> return (is_valid);
> }
> @@ -1190,10 +1190,10 @@ mac_addr_valid(uint8_t *mac_addr)
> *
> * hw - Struct containing variables accessed by shared code
> *****************************************************************************/
> -static boolean_t
> +static bool
> ixgb_link_reset(struct ixgb_hw *hw)
> {
> - boolean_t link_status = FALSE;
> + bool link_status = false;
> uint8_t wait_retries = MAX_RESET_ITERATIONS;
> uint8_t lrst_retries = MAX_RESET_ITERATIONS;
>
> @@ -1208,7 +1208,7 @@ ixgb_link_reset(struct ixgb_hw *hw)
> link_status =
> ((IXGB_READ_REG(hw, STATUS) & IXGB_STATUS_LU)
> && (IXGB_READ_REG(hw, XPCSS) &
> - IXGB_XPCSS_ALIGN_STATUS)) ? TRUE : FALSE;
> + IXGB_XPCSS_ALIGN_STATUS)) ? true : false;
> } while (!link_status && --wait_retries);
>
> } while (!link_status && --lrst_retries);
> diff --git a/drivers/net/ixgb/ixgb_hw.h b/drivers/net/ixgb/ixgb_hw.h
> index 4f176ff..d4e9566 100644
> --- a/drivers/net/ixgb/ixgb_hw.h
> +++ b/drivers/net/ixgb/ixgb_hw.h
> @@ -650,7 +650,7 @@ struct ixgb_flash_buffer {
> * This is a little-endian specific check.
> */
> #define IS_MULTICAST(Address) \
> - (boolean_t)(((uint8_t *)(Address))[0] & ((uint8_t)0x01))
> + (bool)(((uint8_t *)(Address))[0] & ((uint8_t)0x01))
>
> /*
> * Check whether an address is broadcast.
> @@ -663,7 +663,7 @@ struct ixgb_fc {
> uint32_t high_water; /* Flow Control High-water */
> uint32_t low_water; /* Flow Control Low-water */
> uint16_t pause_time; /* Flow Control Pause timer */
> - boolean_t send_xon; /* Flow control send XON */
> + bool send_xon; /* Flow control send XON */
> ixgb_fc_type type; /* Type of flow control */
> };
>
> @@ -700,8 +700,8 @@ struct ixgb_hw {
> uint32_t num_tx_desc; /* Number of Transmit descriptors */
> uint32_t num_rx_desc; /* Number of Receive descriptors */
> uint32_t rx_buffer_size; /* Size of Receive buffer */
> - boolean_t link_up; /* TRUE if link is valid */
> - boolean_t adapter_stopped; /* State of adapter */
> + bool link_up; /* true if link is valid */
> + bool adapter_stopped; /* State of adapter */
> uint16_t device_id; /* device id from PCI configuration space */
> uint16_t vendor_id; /* vendor id from PCI configuration space */
> uint8_t revision_id; /* revision id from PCI configuration space */
> @@ -783,11 +783,11 @@ struct ixgb_hw_stats {
> };
>
> /* Function Prototypes */
> -extern boolean_t ixgb_adapter_stop(struct ixgb_hw *hw);
> -extern boolean_t ixgb_init_hw(struct ixgb_hw *hw);
> -extern boolean_t ixgb_adapter_start(struct ixgb_hw *hw);
> +extern bool ixgb_adapter_stop(struct ixgb_hw *hw);
> +extern bool ixgb_init_hw(struct ixgb_hw *hw);
> +extern bool ixgb_adapter_start(struct ixgb_hw *hw);
> extern void ixgb_check_for_link(struct ixgb_hw *hw);
> -extern boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw);
> +extern bool ixgb_check_for_bad_link(struct ixgb_hw *hw);
>
> extern void ixgb_rar_set(struct ixgb_hw *hw,
> uint8_t *addr,
> @@ -809,7 +809,7 @@ extern void ixgb_write_vfta(struct ixgb_hw *hw,
> void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, uint8_t *mac_addr);
> uint32_t ixgb_get_ee_pba_number(struct ixgb_hw *hw);
> uint16_t ixgb_get_ee_device_id(struct ixgb_hw *hw);
> -boolean_t ixgb_get_eeprom_data(struct ixgb_hw *hw);
> +bool ixgb_get_eeprom_data(struct ixgb_hw *hw);
> __le16 ixgb_get_eeprom_word(struct ixgb_hw *hw, uint16_t index);
>
> /* Everything else */
> diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
> index 269e6f8..ae71dd1 100644
> --- a/drivers/net/ixgb/ixgb_main.c
> +++ b/drivers/net/ixgb/ixgb_main.c
> @@ -67,7 +67,7 @@ MODULE_DEVICE_TABLE(pci, ixgb_pci_tbl);
> /* Local Function Prototypes */
>
> int ixgb_up(struct ixgb_adapter *adapter);
> -void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog);
> +void ixgb_down(struct ixgb_adapter *adapter, bool kill_watchdog);
> void ixgb_reset(struct ixgb_adapter *adapter);
> int ixgb_setup_tx_resources(struct ixgb_adapter *adapter);
> int ixgb_setup_rx_resources(struct ixgb_adapter *adapter);
> @@ -94,14 +94,14 @@ static struct net_device_stats *ixgb_get_stats(struct net_device *netdev);
> static int ixgb_change_mtu(struct net_device *netdev, int new_mtu);
> static int ixgb_set_mac(struct net_device *netdev, void *p);
> static irqreturn_t ixgb_intr(int irq, void *data);
> -static boolean_t ixgb_clean_tx_irq(struct ixgb_adapter *adapter);
> +static bool ixgb_clean_tx_irq(struct ixgb_adapter *adapter);
>
> #ifdef CONFIG_IXGB_NAPI
> static int ixgb_clean(struct napi_struct *napi, int budget);
> -static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter,
> - int *work_done, int work_to_do);
> +static bool ixgb_clean_rx_irq(struct ixgb_adapter *adapter,
> + int *work_done, int work_to_do);
> #else
> -static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter);
> +static bool ixgb_clean_rx_irq(struct ixgb_adapter *adapter);
> #endif
> static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter);
> static void ixgb_tx_timeout(struct net_device *dev);
> @@ -294,7 +294,7 @@ ixgb_up(struct ixgb_adapter *adapter)
> }
>
> void
> -ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
> +ixgb_down(struct ixgb_adapter *adapter, bool kill_watchdog)
> {
> struct net_device *netdev = adapter->netdev;
>
> @@ -656,7 +656,7 @@ ixgb_close(struct net_device *netdev)
> {
> struct ixgb_adapter *adapter = netdev_priv(netdev);
>
> - ixgb_down(adapter, TRUE);
> + ixgb_down(adapter, true);
>
> ixgb_free_tx_resources(adapter);
> ixgb_free_rx_resources(adapter);
> @@ -881,7 +881,7 @@ ixgb_configure_rx(struct ixgb_adapter *adapter)
> IXGB_WRITE_REG(hw, RXDCTL, rxdctl);
>
> /* Enable Receive Checksum Offload for TCP and UDP */
> - if(adapter->rx_csum == TRUE) {
> + if(adapter->rx_csum) {
> rxcsum = IXGB_READ_REG(hw, RXCSUM);
> rxcsum |= IXGB_RXCSUM_TUOFL;
> IXGB_WRITE_REG(hw, RXCSUM, rxcsum);
> @@ -1164,7 +1164,7 @@ ixgb_watchdog(unsigned long data)
> }
>
> /* Force detection of hung controller every watchdog period */
> - adapter->detect_tx_hung = TRUE;
> + adapter->detect_tx_hung = true;
>
> /* generate an interrupt to force clean up of any stragglers */
> IXGB_WRITE_REG(&adapter->hw, ICS, IXGB_INT_TXDW);
> @@ -1243,7 +1243,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
> return 0;
> }
>
> -static boolean_t
> +static bool
> ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
> {
> struct ixgb_context_desc *context_desc;
> @@ -1275,10 +1275,10 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
> if(++i == adapter->tx_ring.count) i = 0;
> adapter->tx_ring.next_to_use = i;
>
> - return TRUE;
> + return true;
> }
>
> - return FALSE;
> + return false;
> }
>
> #define IXGB_MAX_TXD_PWR 14
> @@ -1548,7 +1548,7 @@ ixgb_tx_timeout_task(struct work_struct *work)
> container_of(work, struct ixgb_adapter, tx_timeout_task);
>
> adapter->tx_timeout_count++;
> - ixgb_down(adapter, TRUE);
> + ixgb_down(adapter, true);
> ixgb_up(adapter);
> }
>
> @@ -1595,7 +1595,7 @@ ixgb_change_mtu(struct net_device *netdev, int new_mtu)
> netdev->mtu = new_mtu;
>
> if ((old_max_frame != max_frame) && netif_running(netdev)) {
> - ixgb_down(adapter, TRUE);
> + ixgb_down(adapter, true);
> ixgb_up(adapter);
> }
>
> @@ -1812,7 +1812,7 @@ ixgb_clean(struct napi_struct *napi, int budget)
> * @adapter: board private structure
> **/
>
> -static boolean_t
> +static bool
> ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
> {
> struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
> @@ -1820,7 +1820,7 @@ ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
> struct ixgb_tx_desc *tx_desc, *eop_desc;
> struct ixgb_buffer *buffer_info;
> unsigned int i, eop;
> - boolean_t cleaned = FALSE;
> + bool cleaned = false;
>
> i = tx_ring->next_to_clean;
> eop = tx_ring->buffer_info[i].next_to_watch;
> @@ -1828,7 +1828,7 @@ ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
>
> while(eop_desc->status & IXGB_TX_DESC_STATUS_DD) {
>
> - for(cleaned = FALSE; !cleaned; ) {
> + for(cleaned = false; !cleaned; ) {
> tx_desc = IXGB_TX_DESC(*tx_ring, i);
> buffer_info = &tx_ring->buffer_info[i];
>
> @@ -1862,7 +1862,7 @@ ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
> if(adapter->detect_tx_hung) {
> /* detect a transmit hang in hardware, this serializes the
> * check with the clearing of time_stamp and movement of i */
> - adapter->detect_tx_hung = FALSE;
> + adapter->detect_tx_hung = false;
> if (tx_ring->buffer_info[eop].dma &&
> time_after(jiffies, tx_ring->buffer_info[eop].time_stamp + HZ)
> && !(IXGB_READ_REG(&adapter->hw, STATUS) &
> @@ -1932,7 +1932,7 @@ ixgb_rx_checksum(struct ixgb_adapter *adapter,
> * @adapter: board private structure
> **/
>
> -static boolean_t
> +static bool
> #ifdef CONFIG_IXGB_NAPI
> ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
> #else
> @@ -1946,7 +1946,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
> struct ixgb_buffer *buffer_info, *next_buffer, *next2_buffer;
> uint32_t length;
> unsigned int i, j;
> - boolean_t cleaned = FALSE;
> + bool cleaned = false;
>
> i = rx_ring->next_to_clean;
> rx_desc = IXGB_RX_DESC(*rx_ring, i);
> @@ -1980,7 +1980,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter)
> next_skb = next_buffer->skb;
> prefetch(next_skb);
>
> - cleaned = TRUE;
> + cleaned = true;
>
> pci_unmap_single(pdev,
> buffer_info->dma,
> @@ -2279,7 +2279,7 @@ static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev,
> struct ixgb_adapter *adapter = netdev_priv(netdev);
>
> if(netif_running(netdev))
> - ixgb_down(adapter, TRUE);
> + ixgb_down(adapter, true);
>
> pci_disable_device(pdev);
>
> diff --git a/drivers/net/ixgb/ixgb_osdep.h b/drivers/net/ixgb/ixgb_osdep.h
> index 9e04a6b..4be1b27 100644
> --- a/drivers/net/ixgb/ixgb_osdep.h
> +++ b/drivers/net/ixgb/ixgb_osdep.h
> @@ -39,13 +39,6 @@
> #include <linux/interrupt.h>
> #include <linux/sched.h>
>
> -typedef enum {
> -#undef FALSE
> - FALSE = 0,
> -#undef TRUE
> - TRUE = 1
> -} boolean_t;
> -
> #undef ASSERT
> #define ASSERT(x) if(!(x)) BUG()
> #define MSGOUT(S, A, B) printk(KERN_DEBUG S "\n", A, B)
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2008-03-07 18:21:49

by Joe Perches

[permalink] [raw]
Subject: Re: [E1000-devel] [PATCH] drivers/net: convert & to &&

On Thu, 2008-03-06 at 10:07 -0800, Kok, Auke wrote:
> (which, BTW also could use the uint32_t -> u32 (etc) changes... while you're at it)

I think this does what you want:

for size in "8" "16" "32" "64" ; do \
sed -r -i -e 's/\bu_{0,1}int'$size'_t\b/u'$size'/g' \
$(grep -rPlw --include=*.[ch] 'u_{0,1}int'$size'_t' drivers/net/e1000 drivers/net/ixgb); done

But why? boolean_t is used by 3 subsystems with local typedefs.
These others are much more frequently used by kernel source.

$ grep -rPlw --include=*.[ch] "u{0,1}_{0,1}int(8|16|32|64)_t" * | wc -l
876

include/linux/types.h has typedefs for these but not boolean_t

include/linux/types.h:typedef __u8 u_int8_t;
include/linux/types.h:typedef __s8 int8_t;
include/linux/types.h:typedef __u16 u_int16_t;
include/linux/types.h:typedef __s16 int16_t;
include/linux/types.h:typedef __u32 u_int32_t;
include/linux/types.h:typedef __s32 int32_t;
include/linux/types.h:typedef __u8 uint8_t;
include/linux/types.h:typedef __u16 uint16_t;
include/linux/types.h:typedef __u32 uint32_t;
include/linux/types.h:typedef __u64 uint64_t;
include/linux/types.h:typedef __u64 u_int64_t;
include/linux/types.h:typedef __s64 int64_t;

cheers, Joe

2008-03-07 18:40:41

by Kok, Auke

[permalink] [raw]
Subject: Re: [E1000-devel] [PATCH] drivers/net: convert & to &&

Joe Perches wrote:
> On Thu, 2008-03-06 at 10:07 -0800, Kok, Auke wrote:
>> (which, BTW also could use the uint32_t -> u32 (etc) changes... while you're at it)
>
> I think this does what you want:
>
> for size in "8" "16" "32" "64" ; do \
> sed -r -i -e 's/\bu_{0,1}int'$size'_t\b/u'$size'/g' \
> $(grep -rPlw --include=*.[ch] 'u_{0,1}int'$size'_t' drivers/net/e1000 drivers/net/ixgb); done
>
> But why? boolean_t is used by 3 subsystems with local typedefs.
> These others are much more frequently used by kernel source.

afaik they're really meant for userspace related code and don't belong in our
driver from that perspective.

> $ grep -rPlw --include=*.[ch] "u{0,1}_{0,1}int(8|16|32|64)_t" * | wc -l
> 876

yes, a lot of that *is* userspace related code.

do the same search in drivers/net/ .... you'll see the only drivers using this for
everything is our old drivers...

Auke

2008-03-10 12:42:06

by walter harms

[permalink] [raw]
Subject: Re: [E1000-devel] [PATCH] drivers/net: convert & to &&



Joe Perches wrote:
> On Thu, 2008-03-06 at 10:07 -0800, Kok, Auke wrote:
>> (which, BTW also could use the uint32_t -> u32 (etc) changes... while you're at it)
>
> I think this does what you want:
>
> for size in "8" "16" "32" "64" ; do \
> sed -r -i -e 's/\bu_{0,1}int'$size'_t\b/u'$size'/g' \
> $(grep -rPlw --include=*.[ch] 'u_{0,1}int'$size'_t' drivers/net/e1000 drivers/net/ixgb); done
>
> But why? boolean_t is used by 3 subsystems with local typedefs.
> These others are much more frequently used by kernel source.
>
> $ grep -rPlw --include=*.[ch] "u{0,1}_{0,1}int(8|16|32|64)_t" * | wc -l
> 876
>
> include/linux/types.h has typedefs for these but not boolean_t
>
> include/linux/types.h:typedef __u8 u_int8_t;
> include/linux/types.h:typedef __s8 int8_t;
> include/linux/types.h:typedef __u16 u_int16_t;
> include/linux/types.h:typedef __s16 int16_t;
> include/linux/types.h:typedef __u32 u_int32_t;
> include/linux/types.h:typedef __s32 int32_t;
> include/linux/types.h:typedef __u8 uint8_t;
> include/linux/types.h:typedef __u16 uint16_t;
> include/linux/types.h:typedef __u32 uint32_t;
> include/linux/types.h:typedef __u64 uint64_t;
> include/linux/types.h:typedef __u64 u_int64_t;
> include/linux/types.h:typedef __s64 int64_t;
>

Why not the other way around ?
inttypes.h is C99 and defines int16_t (or uint16_t). i do not see any reason
not to use them or any other type (like __u8) that does actually the same.

In that case we do not need different type names for userspace/kernelspace, or is there an other name
for int ? in that case we can remove the whole heap of typedef's.

re,
wh