[SCSI] lpfc: use wwn_to_u64() transport helper

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Acked-by: Smart, James <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by

Andrew Vasquez and committed by
James Bottomley
f631b4be f8b02a85

+25 -28
+10 -12
drivers/scsi/lpfc/lpfc_attr.c
··· 966 966 lpfc_get_host_fabric_name (struct Scsi_Host *shost) 967 967 { 968 968 struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata[0]; 969 - u64 nodename; 969 + u64 node_name; 970 970 971 971 spin_lock_irq(shost->host_lock); 972 972 973 973 if ((phba->fc_flag & FC_FABRIC) || 974 974 ((phba->fc_topology == TOPOLOGY_LOOP) && 975 975 (phba->fc_flag & FC_PUBLIC_LOOP))) 976 - memcpy(&nodename, &phba->fc_fabparam.nodeName, sizeof(u64)); 976 + node_name = wwn_to_u64(phba->fc_fabparam.nodeName.wwn); 977 977 else 978 978 /* fabric is local port if there is no F/FL_Port */ 979 - memcpy(&nodename, &phba->fc_nodename, sizeof(u64)); 979 + node_name = wwn_to_u64(phba->fc_nodename.wwn); 980 980 981 981 spin_unlock_irq(shost->host_lock); 982 982 983 - fc_host_fabric_name(shost) = be64_to_cpu(nodename); 983 + fc_host_fabric_name(shost) = node_name; 984 984 } 985 985 986 986 ··· 1103 1103 { 1104 1104 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 1105 1105 struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata[0]; 1106 - uint64_t node_name = 0; 1106 + u64 node_name = 0; 1107 1107 struct lpfc_nodelist *ndlp = NULL; 1108 1108 1109 1109 spin_lock_irq(shost->host_lock); 1110 1110 /* Search the mapped list for this target ID */ 1111 1111 list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { 1112 1112 if (starget->id == ndlp->nlp_sid) { 1113 - memcpy(&node_name, &ndlp->nlp_nodename, 1114 - sizeof(struct lpfc_name)); 1113 + node_name = wwn_to_u64(ndlp->nlp_nodename.wwn); 1115 1114 break; 1116 1115 } 1117 1116 } 1118 1117 spin_unlock_irq(shost->host_lock); 1119 1118 1120 - fc_starget_node_name(starget) = be64_to_cpu(node_name); 1119 + fc_starget_node_name(starget) = node_name; 1121 1120 } 1122 1121 1123 1122 static void ··· 1124 1125 { 1125 1126 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 1126 1127 struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata[0]; 1127 - uint64_t port_name = 0; 1128 + u64 port_name = 0; 1128 1129 struct lpfc_nodelist *ndlp = NULL; 1129 1130 1130 1131 spin_lock_irq(shost->host_lock); 1131 1132 /* Search the mapped list for this target ID */ 1132 1133 list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) { 1133 1134 if (starget->id == ndlp->nlp_sid) { 1134 - memcpy(&port_name, &ndlp->nlp_portname, 1135 - sizeof(struct lpfc_name)); 1135 + port_name = wwn_to_u64(ndlp->nlp_portname.wwn); 1136 1136 break; 1137 1137 } 1138 1138 } 1139 1139 spin_unlock_irq(shost->host_lock); 1140 1140 1141 - fc_starget_port_name(starget) = be64_to_cpu(port_name); 1141 + fc_starget_port_name(starget) = port_name; 1142 1142 } 1143 1143 1144 1144 static void
+2 -5
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 1017 1017 struct fc_rport *rport; 1018 1018 struct lpfc_rport_data *rdata; 1019 1019 struct fc_rport_identifiers rport_ids; 1020 - uint64_t wwn; 1021 1020 1022 1021 /* Remote port has reappeared. Re-register w/ FC transport */ 1023 - memcpy(&wwn, &ndlp->nlp_nodename, sizeof(uint64_t)); 1024 - rport_ids.node_name = be64_to_cpu(wwn); 1025 - memcpy(&wwn, &ndlp->nlp_portname, sizeof(uint64_t)); 1026 - rport_ids.port_name = be64_to_cpu(wwn); 1022 + rport_ids.node_name = wwn_to_u64(ndlp->nlp_nodename.wwn); 1023 + rport_ids.port_name = wwn_to_u64(ndlp->nlp_portname.wwn); 1027 1024 rport_ids.port_id = ndlp->nlp_DID; 1028 1025 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; 1029 1026 if (ndlp->nlp_type & NLP_FCP_TARGET)
+11 -6
drivers/scsi/lpfc/lpfc_hw.h
··· 262 262 #define FF_FRAME_SIZE 2048 263 263 264 264 struct lpfc_name { 265 + union { 266 + struct { 265 267 #ifdef __BIG_ENDIAN_BITFIELD 266 - uint8_t nameType:4; /* FC Word 0, bit 28:31 */ 267 - uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */ 268 + uint8_t nameType:4; /* FC Word 0, bit 28:31 */ 269 + uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */ 268 270 #else /* __LITTLE_ENDIAN_BITFIELD */ 269 - uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */ 270 - uint8_t nameType:4; /* FC Word 0, bit 28:31 */ 271 + uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */ 272 + uint8_t nameType:4; /* FC Word 0, bit 28:31 */ 271 273 #endif 272 274 273 275 #define NAME_IEEE 0x1 /* IEEE name - nameType */ ··· 278 276 #define NAME_IP_TYPE 0x4 /* IP address */ 279 277 #define NAME_CCITT_TYPE 0xC 280 278 #define NAME_CCITT_GR_TYPE 0xE 281 - uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE extended Lsb */ 282 - uint8_t IEEE[6]; /* FC IEEE address */ 279 + uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE extended Lsb */ 280 + uint8_t IEEE[6]; /* FC IEEE address */ 281 + }; 282 + uint8_t wwn[8]; 283 + }; 283 284 }; 284 285 285 286 struct csp {
+2 -5
drivers/scsi/lpfc/lpfc_init.c
··· 1333 1333 unsigned long bar0map_len, bar2map_len; 1334 1334 int error = -ENODEV, retval; 1335 1335 int i; 1336 - u64 wwname; 1337 1336 1338 1337 if (pci_enable_device(pdev)) 1339 1338 goto out; ··· 1523 1524 * Must done after lpfc_sli_hba_setup() 1524 1525 */ 1525 1526 1526 - memcpy(&wwname, &phba->fc_nodename, sizeof(u64)); 1527 - fc_host_node_name(host) = be64_to_cpu(wwname); 1528 - memcpy(&wwname, &phba->fc_portname, sizeof(u64)); 1529 - fc_host_port_name(host) = be64_to_cpu(wwname); 1527 + fc_host_node_name(host) = wwn_to_u64(phba->fc_nodename.wwn); 1528 + fc_host_port_name(host) = wwn_to_u64(phba->fc_portname.wwn); 1530 1529 fc_host_supported_classes(host) = FC_COS_CLASS3; 1531 1530 1532 1531 memset(fc_host_supported_fc4s(host), 0,