diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2007-12-22 14:44:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:08:00 -0500 |
commit | 804d8541d217f73a6543baac937cf65b8b4de850 (patch) | |
tree | 54c3f022cc401789cbb01595a5fe60c708454105 /drivers/net/qla3xxx.c | |
parent | 7cd61888d2ab9fa7e08205b18a24885e523df048 (diff) |
qla3xxx annotations
stop the byteswap-in-place, annotate
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/qla3xxx.c')
-rw-r--r-- | drivers/net/qla3xxx.c | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index 00f2fddff1f2..a6aeb9d60443 100644 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c | |||
@@ -540,20 +540,12 @@ static void eeprom_readword(struct ql3_adapter *qdev, | |||
540 | fm93c56a_deselect(qdev); | 540 | fm93c56a_deselect(qdev); |
541 | } | 541 | } |
542 | 542 | ||
543 | static void ql_swap_mac_addr(u8 * macAddress) | 543 | static void ql_set_mac_addr(struct net_device *ndev, u16 *addr) |
544 | { | 544 | { |
545 | #ifdef __BIG_ENDIAN | 545 | __le16 *p = (__le16 *)ndev->dev_addr; |
546 | u8 temp; | 546 | p[0] = cpu_to_le16(addr[0]); |
547 | temp = macAddress[0]; | 547 | p[1] = cpu_to_le16(addr[1]); |
548 | macAddress[0] = macAddress[1]; | 548 | p[2] = cpu_to_le16(addr[2]); |
549 | macAddress[1] = temp; | ||
550 | temp = macAddress[2]; | ||
551 | macAddress[2] = macAddress[3]; | ||
552 | macAddress[3] = temp; | ||
553 | temp = macAddress[4]; | ||
554 | macAddress[4] = macAddress[5]; | ||
555 | macAddress[5] = temp; | ||
556 | #endif | ||
557 | } | 549 | } |
558 | 550 | ||
559 | static int ql_get_nvram_params(struct ql3_adapter *qdev) | 551 | static int ql_get_nvram_params(struct ql3_adapter *qdev) |
@@ -590,18 +582,6 @@ static int ql_get_nvram_params(struct ql3_adapter *qdev) | |||
590 | return -1; | 582 | return -1; |
591 | } | 583 | } |
592 | 584 | ||
593 | /* | ||
594 | * We have a problem with endianness for the MAC addresses | ||
595 | * and the two 8-bit values version, and numPorts. We | ||
596 | * have to swap them on big endian systems. | ||
597 | */ | ||
598 | ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn0.macAddress); | ||
599 | ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn1.macAddress); | ||
600 | ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn2.macAddress); | ||
601 | ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn3.macAddress); | ||
602 | pEEPROMData = (u16 *) & qdev->nvram_data.version; | ||
603 | *pEEPROMData = le16_to_cpu(*pEEPROMData); | ||
604 | |||
605 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | 585 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); |
606 | return checksum; | 586 | return checksum; |
607 | } | 587 | } |
@@ -3035,7 +3015,7 @@ static int ql_alloc_mem_resources(struct ql3_adapter *qdev) | |||
3035 | LS_64BITS(qdev->shadow_reg_phy_addr); | 3015 | LS_64BITS(qdev->shadow_reg_phy_addr); |
3036 | 3016 | ||
3037 | qdev->prsp_producer_index = | 3017 | qdev->prsp_producer_index = |
3038 | (u32 *) (((u8 *) qdev->preq_consumer_index) + 8); | 3018 | (__le32 *) (((u8 *) qdev->preq_consumer_index) + 8); |
3039 | qdev->rsp_producer_index_phy_addr_high = | 3019 | qdev->rsp_producer_index_phy_addr_high = |
3040 | qdev->req_consumer_index_phy_addr_high; | 3020 | qdev->req_consumer_index_phy_addr_high; |
3041 | qdev->rsp_producer_index_phy_addr_low = | 3021 | qdev->rsp_producer_index_phy_addr_low = |
@@ -3215,7 +3195,7 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev) | |||
3215 | ql_write_page1_reg(qdev, &hmem_regs->reqLength, NUM_REQ_Q_ENTRIES); | 3195 | ql_write_page1_reg(qdev, &hmem_regs->reqLength, NUM_REQ_Q_ENTRIES); |
3216 | 3196 | ||
3217 | /* Response Queue Registers */ | 3197 | /* Response Queue Registers */ |
3218 | *((u16 *) (qdev->prsp_producer_index)) = 0; | 3198 | *((__le16 *) (qdev->prsp_producer_index)) = 0; |
3219 | qdev->rsp_consumer_index = 0; | 3199 | qdev->rsp_consumer_index = 0; |
3220 | qdev->rsp_current = qdev->rsp_q_virt_addr; | 3200 | qdev->rsp_current = qdev->rsp_q_virt_addr; |
3221 | 3201 | ||
@@ -3548,7 +3528,7 @@ static void ql_set_mac_info(struct ql3_adapter *qdev) | |||
3548 | qdev->ndev->name,value); | 3528 | qdev->ndev->name,value); |
3549 | break; | 3529 | break; |
3550 | } | 3530 | } |
3551 | qdev->numPorts = qdev->nvram_data.numPorts; | 3531 | qdev->numPorts = qdev->nvram_data.version_and_numPorts >> 8; |
3552 | } | 3532 | } |
3553 | 3533 | ||
3554 | static void ql_display_dev_info(struct net_device *ndev) | 3534 | static void ql_display_dev_info(struct net_device *ndev) |
@@ -4051,12 +4031,10 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev, | |||
4051 | /* Validate and set parameters */ | 4031 | /* Validate and set parameters */ |
4052 | if (qdev->mac_index) { | 4032 | if (qdev->mac_index) { |
4053 | ndev->mtu = qdev->nvram_data.macCfg_port1.etherMtu_mac ; | 4033 | ndev->mtu = qdev->nvram_data.macCfg_port1.etherMtu_mac ; |
4054 | memcpy(ndev->dev_addr, &qdev->nvram_data.funcCfg_fn2.macAddress, | 4034 | ql_set_mac_addr(ndev, qdev->nvram_data.funcCfg_fn2.macAddress); |
4055 | ETH_ALEN); | ||
4056 | } else { | 4035 | } else { |
4057 | ndev->mtu = qdev->nvram_data.macCfg_port0.etherMtu_mac ; | 4036 | ndev->mtu = qdev->nvram_data.macCfg_port0.etherMtu_mac ; |
4058 | memcpy(ndev->dev_addr, &qdev->nvram_data.funcCfg_fn0.macAddress, | 4037 | ql_set_mac_addr(ndev, qdev->nvram_data.funcCfg_fn0.macAddress); |
4059 | ETH_ALEN); | ||
4060 | } | 4038 | } |
4061 | memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); | 4039 | memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); |
4062 | 4040 | ||