aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2010-04-05 06:19:28 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-06 06:58:03 -0400
commit859a58879d7c771e78a373028d719467a2f8feb7 (patch)
tree12f6af1d19fdd0c3cd4bb129b97e1669ee5e05b3 /drivers/net/tg3.c
parent33f401aec709e4fea414e5a4cf81b96462bc224f (diff)
tg3: Cleanup if codestyle
This patch cleans up the code style as it pertains to if statements. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c75
1 files changed, 31 insertions, 44 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 7314919b9e08..ebf16050474d 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1858,8 +1858,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
1858 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { 1858 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
1859 /* Set Extended packet length bit for jumbo frames */ 1859 /* Set Extended packet length bit for jumbo frames */
1860 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4400); 1860 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x4400);
1861 } 1861 } else {
1862 else {
1863 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400); 1862 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
1864 } 1863 }
1865 1864
@@ -1977,8 +1976,7 @@ out:
1977 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x401f); 1976 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x401f);
1978 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x14e2); 1977 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x14e2);
1979 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400); 1978 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0400);
1980 } 1979 } else if (tp->tg3_flags2 & TG3_FLG2_PHY_JITTER_BUG) {
1981 else if (tp->tg3_flags2 & TG3_FLG2_PHY_JITTER_BUG) {
1982 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00); 1980 tg3_writephy(tp, MII_TG3_AUX_CTRL, 0x0c00);
1983 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a); 1981 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a);
1984 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADJUST_TRIM) { 1982 if (tp->tg3_flags2 & TG3_FLG2_PHY_ADJUST_TRIM) {
@@ -3466,11 +3464,10 @@ static int tg3_fiber_aneg_smachine(struct tg3 *tp,
3466 /* fallthru */ 3464 /* fallthru */
3467 case ANEG_STATE_RESTART: 3465 case ANEG_STATE_RESTART:
3468 delta = ap->cur_time - ap->link_time; 3466 delta = ap->cur_time - ap->link_time;
3469 if (delta > ANEG_STATE_SETTLE_TIME) { 3467 if (delta > ANEG_STATE_SETTLE_TIME)
3470 ap->state = ANEG_STATE_ABILITY_DETECT_INIT; 3468 ap->state = ANEG_STATE_ABILITY_DETECT_INIT;
3471 } else { 3469 else
3472 ret = ANEG_TIMER_ENAB; 3470 ret = ANEG_TIMER_ENAB;
3473 }
3474 break; 3471 break;
3475 3472
3476 case ANEG_STATE_DISABLE_LINK_OK: 3473 case ANEG_STATE_DISABLE_LINK_OK:
@@ -3494,9 +3491,8 @@ static int tg3_fiber_aneg_smachine(struct tg3 *tp,
3494 break; 3491 break;
3495 3492
3496 case ANEG_STATE_ABILITY_DETECT: 3493 case ANEG_STATE_ABILITY_DETECT:
3497 if (ap->ability_match != 0 && ap->rxconfig != 0) { 3494 if (ap->ability_match != 0 && ap->rxconfig != 0)
3498 ap->state = ANEG_STATE_ACK_DETECT_INIT; 3495 ap->state = ANEG_STATE_ACK_DETECT_INIT;
3499 }
3500 break; 3496 break;
3501 3497
3502 case ANEG_STATE_ACK_DETECT_INIT: 3498 case ANEG_STATE_ACK_DETECT_INIT:
@@ -4174,9 +4170,9 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, int force_reset)
4174 current_duplex = DUPLEX_FULL; 4170 current_duplex = DUPLEX_FULL;
4175 else 4171 else
4176 current_duplex = DUPLEX_HALF; 4172 current_duplex = DUPLEX_HALF;
4177 } 4173 } else {
4178 else
4179 current_link_up = 0; 4174 current_link_up = 0;
4175 }
4180 } 4176 }
4181 } 4177 }
4182 4178
@@ -4244,10 +4240,9 @@ static void tg3_serdes_parallel_detect(struct tg3 *tp)
4244 tp->tg3_flags2 |= TG3_FLG2_PARALLEL_DETECT; 4240 tp->tg3_flags2 |= TG3_FLG2_PARALLEL_DETECT;
4245 } 4241 }
4246 } 4242 }
4247 } 4243 } else if (netif_carrier_ok(tp->dev) &&
4248 else if (netif_carrier_ok(tp->dev) && 4244 (tp->link_config.autoneg == AUTONEG_ENABLE) &&
4249 (tp->link_config.autoneg == AUTONEG_ENABLE) && 4245 (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT)) {
4250 (tp->tg3_flags2 & TG3_FLG2_PARALLEL_DETECT)) {
4251 u32 phy2; 4246 u32 phy2;
4252 4247
4253 /* Select expansion interrupt status register */ 4248 /* Select expansion interrupt status register */
@@ -4270,13 +4265,12 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
4270{ 4265{
4271 int err; 4266 int err;
4272 4267
4273 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) { 4268 if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)
4274 err = tg3_setup_fiber_phy(tp, force_reset); 4269 err = tg3_setup_fiber_phy(tp, force_reset);
4275 } else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES) { 4270 else if (tp->tg3_flags2 & TG3_FLG2_MII_SERDES)
4276 err = tg3_setup_fiber_mii_phy(tp, force_reset); 4271 err = tg3_setup_fiber_mii_phy(tp, force_reset);
4277 } else { 4272 else
4278 err = tg3_setup_copper_phy(tp, force_reset); 4273 err = tg3_setup_copper_phy(tp, force_reset);
4279 }
4280 4274
4281 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX) { 4275 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX) {
4282 u32 val, scale; 4276 u32 val, scale;
@@ -5560,9 +5554,10 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
5560 5554
5561 tcp_hdr(skb)->check = 0; 5555 tcp_hdr(skb)->check = 0;
5562 5556
5563 } 5557 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
5564 else if (skb->ip_summed == CHECKSUM_PARTIAL)
5565 base_flags |= TXD_FLAG_TCPUDP_CSUM; 5558 base_flags |= TXD_FLAG_TCPUDP_CSUM;
5559 }
5560
5566#if TG3_VLAN_TAG_USED 5561#if TG3_VLAN_TAG_USED
5567 if (tp->vlgrp != NULL && vlan_tx_tag_present(skb)) 5562 if (tp->vlgrp != NULL && vlan_tx_tag_present(skb))
5568 base_flags |= (TXD_FLAG_VLAN | 5563 base_flags |= (TXD_FLAG_VLAN |
@@ -5932,9 +5927,9 @@ static inline void tg3_set_mtu(struct net_device *dev, struct tg3 *tp,
5932 if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) { 5927 if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) {
5933 tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE; 5928 tp->tg3_flags2 &= ~TG3_FLG2_TSO_CAPABLE;
5934 ethtool_op_set_tso(dev, 0); 5929 ethtool_op_set_tso(dev, 0);
5935 } 5930 } else {
5936 else
5937 tp->tg3_flags |= TG3_FLAG_JUMBO_RING_ENABLE; 5931 tp->tg3_flags |= TG3_FLAG_JUMBO_RING_ENABLE;
5932 }
5938 } else { 5933 } else {
5939 if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) 5934 if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)
5940 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE; 5935 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE;
@@ -7585,9 +7580,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7585 7580
7586 tg3_write_sig_pre_reset(tp, RESET_KIND_INIT); 7581 tg3_write_sig_pre_reset(tp, RESET_KIND_INIT);
7587 7582
7588 if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) { 7583 if (tp->tg3_flags & TG3_FLAG_INIT_COMPLETE)
7589 tg3_abort_hw(tp, 1); 7584 tg3_abort_hw(tp, 1);
7590 }
7591 7585
7592 if (reset_phy) 7586 if (reset_phy)
7593 tg3_phy_reset(tp); 7587 tg3_phy_reset(tp);
@@ -7740,8 +7734,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7740 tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE96); 7734 tw32(BUFMGR_MB_POOL_SIZE, NIC_SRAM_MBUF_POOL_SIZE96);
7741 tw32(BUFMGR_DMA_DESC_POOL_ADDR, NIC_SRAM_DMA_DESC_POOL_BASE); 7735 tw32(BUFMGR_DMA_DESC_POOL_ADDR, NIC_SRAM_DMA_DESC_POOL_BASE);
7742 tw32(BUFMGR_DMA_DESC_POOL_SIZE, NIC_SRAM_DMA_DESC_POOL_SIZE); 7736 tw32(BUFMGR_DMA_DESC_POOL_SIZE, NIC_SRAM_DMA_DESC_POOL_SIZE);
7743 } 7737 } else if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) {
7744 else if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) {
7745 int fw_len; 7738 int fw_len;
7746 7739
7747 fw_len = tp->fw_len; 7740 fw_len = tp->fw_len;
@@ -9424,9 +9417,8 @@ static inline u32 calc_crc(unsigned char *buf, int len)
9424 9417
9425 reg >>= 1; 9418 reg >>= 1;
9426 9419
9427 if (tmp) { 9420 if (tmp)
9428 reg ^= 0xedb88320; 9421 reg ^= 0xedb88320;
9429 }
9430 } 9422 }
9431 } 9423 }
9432 9424
@@ -10380,8 +10372,7 @@ static int tg3_test_nvram(struct tg3 *tp)
10380 for (l = 0, msk = 0x80; l < 7; l++, msk >>= 1) 10372 for (l = 0, msk = 0x80; l < 7; l++, msk >>= 1)
10381 parity[k++] = buf8[i] & msk; 10373 parity[k++] = buf8[i] & msk;
10382 i++; 10374 i++;
10383 } 10375 } else if (i == 16) {
10384 else if (i == 16) {
10385 int l; 10376 int l;
10386 u8 msk; 10377 u8 msk;
10387 10378
@@ -10844,9 +10835,9 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
10844 MII_TG3_EXT_CTRL_LNK3_LED_MODE); 10835 MII_TG3_EXT_CTRL_LNK3_LED_MODE);
10845 } 10836 }
10846 tw32(MAC_MODE, mac_mode); 10837 tw32(MAC_MODE, mac_mode);
10847 } 10838 } else {
10848 else
10849 return -EINVAL; 10839 return -EINVAL;
10840 }
10850 10841
10851 err = -EIO; 10842 err = -EIO;
10852 10843
@@ -12048,8 +12039,7 @@ static int tg3_nvram_write_block(struct tg3 *tp, u32 offset, u32 len, u8 *buf)
12048 12039
12049 if (!(tp->tg3_flags & TG3_FLAG_NVRAM)) { 12040 if (!(tp->tg3_flags & TG3_FLAG_NVRAM)) {
12050 ret = tg3_nvram_write_block_using_eeprom(tp, offset, len, buf); 12041 ret = tg3_nvram_write_block_using_eeprom(tp, offset, len, buf);
12051 } 12042 } else {
12052 else {
12053 u32 grc_mode; 12043 u32 grc_mode;
12054 12044
12055 ret = tg3_nvram_lock(tp); 12045 ret = tg3_nvram_lock(tp);
@@ -12069,8 +12059,7 @@ static int tg3_nvram_write_block(struct tg3 *tp, u32 offset, u32 len, u8 *buf)
12069 12059
12070 ret = tg3_nvram_write_block_buffered(tp, offset, len, 12060 ret = tg3_nvram_write_block_buffered(tp, offset, len,
12071 buf); 12061 buf);
12072 } 12062 } else {
12073 else {
12074 ret = tg3_nvram_write_block_unbuffered(tp, offset, len, 12063 ret = tg3_nvram_write_block_unbuffered(tp, offset, len,
12075 buf); 12064 buf);
12076 } 12065 }
@@ -13119,8 +13108,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
13119 tp->tg3_flags2 |= TG3_FLG2_5780_CLASS; 13108 tp->tg3_flags2 |= TG3_FLG2_5780_CLASS;
13120 tp->tg3_flags |= TG3_FLAG_40BIT_DMA_BUG; 13109 tp->tg3_flags |= TG3_FLAG_40BIT_DMA_BUG;
13121 tp->msi_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_MSI); 13110 tp->msi_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_MSI);
13122 } 13111 } else {
13123 else {
13124 struct pci_dev *bridge = NULL; 13112 struct pci_dev *bridge = NULL;
13125 13113
13126 do { 13114 do {
@@ -14018,11 +14006,10 @@ static int __devinit tg3_do_test_dma(struct tg3 *tp, u32 *buf, dma_addr_t buf_dm
14018 } 14006 }
14019 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0); 14007 pci_write_config_dword(tp->pdev, TG3PCI_MEM_WIN_BASE_ADDR, 0);
14020 14008
14021 if (to_device) { 14009 if (to_device)
14022 tw32(FTQ_DMA_HIGH_READ_FIFO_ENQDEQ, sram_dma_descs); 14010 tw32(FTQ_DMA_HIGH_READ_FIFO_ENQDEQ, sram_dma_descs);
14023 } else { 14011 else
14024 tw32(FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ, sram_dma_descs); 14012 tw32(FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ, sram_dma_descs);
14025 }
14026 14013
14027 ret = -ENODEV; 14014 ret = -ENODEV;
14028 for (i = 0; i < 40; i++) { 14015 for (i = 0; i < 40; i++) {
@@ -14227,10 +14214,10 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
14227 if (pci_dev_present(dma_wait_state_chipsets)) { 14214 if (pci_dev_present(dma_wait_state_chipsets)) {
14228 tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK; 14215 tp->dma_rwctrl &= ~DMA_RWCTRL_WRITE_BNDRY_MASK;
14229 tp->dma_rwctrl |= DMA_RWCTRL_WRITE_BNDRY_16; 14216 tp->dma_rwctrl |= DMA_RWCTRL_WRITE_BNDRY_16;
14230 } 14217 } else {
14231 else
14232 /* Safe to use the calculated DMA boundary. */ 14218 /* Safe to use the calculated DMA boundary. */
14233 tp->dma_rwctrl = saved_dma_rwctrl; 14219 tp->dma_rwctrl = saved_dma_rwctrl;
14220 }
14234 14221
14235 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); 14222 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
14236 } 14223 }