scsi: replace uses of __constant_{endian}
Subsystems (4)
PATCH 1/1 scsi: replace uses of __constant_{endian}
The base versions handle constant folding now. Almost entirely in qla2xxx/qla4xxx.
--- drivers/scsi/fcoe/fcoe_sw.c | 2 +- drivers/scsi/qla2xxx/qla_dbg.c | 16 ++-- drivers/scsi/qla2xxx/qla_gs.c | 98 ++++++++++++++-------------- drivers/scsi/qla2xxx/qla_init.c | 138 +++++++++++++++++++------------------- drivers/scsi/qla2xxx/qla_iocb.c | 22 +++--- drivers/scsi/qla2xxx/qla_isr.c | 4 +- drivers/scsi/qla2xxx/qla_mbx.c | 22 +++--- drivers/scsi/qla2xxx/qla_sup.c | 12 ++-- drivers/scsi/qla4xxx/ql4_init.c | 4 +- drivers/scsi/qla4xxx/ql4_iocb.c | 2 +- drivers/scsi/qla4xxx/ql4_mbx.c | 8 +- 11 files changed, 164 insertions(+), 164 deletions(-)
drivers/scsi/fcoe/fcoe_sw.c +1 -1
@@ -217,7 +217,7 @@ static int fcoe_sw_netdev_config(struct fc_lport *lp, struct net_device *netdev)* on the ethertype for the given device */ fc->fcoe_packet_type.func = fcoe_rcv; - fc->fcoe_packet_type.type =__constant_htons (ETH_P_FCOE ); + fc->fcoe_packet_type.type =cpu_to_be16 (ETH_P_FCOE ); fc->fcoe_packet_type.dev = fc->real_dev;dev_add_pack (&fc->fcoe_packet_type);
drivers/scsi/qla2xxx/qla_dbg.c +8 -8
@@ -331,7 +331,7 @@ qla25xx_copy_fce(struct qla_hw_data *ha, void *ptr, uint32_t **last_chain)return ptr; *last_chain = &fcec->type; - fcec->type =__constant_htonl (DUMP_CHAIN_FCE ); + fcec->type =cpu_to_be32 (DUMP_CHAIN_FCE ); fcec->chain_size =htonl (sizeof (struct qla2xxx_fce_chain ) +fce_calc_size (ha->fce_bufs)); fcec->size =htonl (fce_calc_size (ha->fce_bufs));
@@ -360,8 +360,8 @@ qla25xx_copy_mq(struct qla_hw_data *ha, void *ptr, uint32_t **last_chain) mq = ptr; *last_chain = &mq->type; - mq->type =__constant_htonl (DUMP_CHAIN_MQ ); - mq->chain_size =__constant_htonl (sizeof (struct qla2xxx_mq_chain )); + mq->type =cpu_to_be32 (DUMP_CHAIN_MQ ); + mq->chain_size =cpu_to_be32 (sizeof (struct qla2xxx_mq_chain )); req_cnt =find_first_zero_bit (ha->req_qid_map, ha->max_queues); rsp_cnt =find_first_zero_bit (ha->rsp_qid_map, ha->max_queues);
@@ -1042,7 +1042,7 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked) } fw = &ha->fw_dump->isp.isp25;qla2xxx_prep_dump (ha, ha->fw_dump); - ha->fw_dump->version =__constant_htonl (2 ); + ha->fw_dump->version =cpu_to_be32 (2 ); fw->host_status =htonl (RD_REG_DWORD (®->host_status));
@@ -1303,8 +1303,8 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)/* Chain entries -- started with MQ. */ qla25xx_copy_fce (ha, nxt_chain, &last_chain);if (last_chain) { - ha->fw_dump->version |=__constant_htonl (DUMP_CHAIN_VARIANT ); - *last_chain |=__constant_htonl (DUMP_CHAIN_LAST ); + ha->fw_dump->version |=cpu_to_be32 (DUMP_CHAIN_VARIANT ); + *last_chain |=cpu_to_be32 (DUMP_CHAIN_LAST ); } qla25xx_fw_dump_failed_0:
@@ -1626,8 +1626,8 @@ qla81xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)/* Chain entries -- started with MQ. */ qla25xx_copy_fce (ha, nxt_chain, &last_chain);if (last_chain) { - ha->fw_dump->version |=__constant_htonl (DUMP_CHAIN_VARIANT ); - *last_chain |=__constant_htonl (DUMP_CHAIN_LAST ); + ha->fw_dump->version |=cpu_to_be32 (DUMP_CHAIN_VARIANT ); + *last_chain |=cpu_to_be32 (DUMP_CHAIN_LAST ); } qla81xx_fw_dump_failed_0:
drivers/scsi/qla2xxx/qla_gs.c +49 -49
270 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_init.c +69 -69
319 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_iocb.c +11 -11
@@ -108,7 +108,7 @@ qla2x00_prep_cont_type0_iocb(struct req_que *req, struct scsi_qla_host *vha)/* Load packet defaults. */ *((uint32_t *)(&cont_pkt->entry_type)) = -__constant_cpu_to_le32 (CONTINUE_TYPE ); +cpu_to_le32 (CONTINUE_TYPE );return (cont_pkt); }
@@ -137,7 +137,7 @@ qla2x00_prep_cont_type1_iocb(struct req_que *req, scsi_qla_host_t *vha)/* Load packet defaults. */ *((uint32_t *)(&cont_pkt->entry_type)) = -__constant_cpu_to_le32 (CONTINUE_A64_TYPE ); +cpu_to_le32 (CONTINUE_A64_TYPE );return (cont_pkt); }
@@ -165,11 +165,11 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt,/* Update entry type to indicate Command Type 2 IOCB */ *((uint32_t *)(&cmd_pkt->entry_type)) = -__constant_cpu_to_le32 (COMMAND_TYPE ); +cpu_to_le32 (COMMAND_TYPE );/* No data transfer */ if (!scsi_bufflen (cmd) || cmd->sc_data_direction ==DMA_NONE ) { - cmd_pkt->byte_count =__constant_cpu_to_le32 (0 ); + cmd_pkt->byte_count =cpu_to_le32 (0 );return ; }
@@ -226,11 +226,11 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,/* Update entry type to indicate Command Type 3 IOCB */ *((uint32_t *)(&cmd_pkt->entry_type)) = -__constant_cpu_to_le32 (COMMAND_A64_TYPE ); +cpu_to_le32 (COMMAND_A64_TYPE );/* No data transfer */ if (!scsi_bufflen (cmd) || cmd->sc_data_direction ==DMA_NONE ) { - cmd_pkt->byte_count =__constant_cpu_to_le32 (0 ); + cmd_pkt->byte_count =cpu_to_le32 (0 );return ; }
@@ -369,7 +369,7 @@ qla2x00_start_scsi(srb_t *sp) cmd_pkt->lun =cpu_to_le16 (sp->cmd->device->lun);/* Update tagged queuing modifier */ - cmd_pkt->control_flags =__constant_cpu_to_le16 (CF_SIMPLE_TAG ); + cmd_pkt->control_flags =cpu_to_le16 (CF_SIMPLE_TAG );/* Load SCSI command packet. */ memcpy (cmd_pkt->scsi_cdb, cmd->cmnd, cmd->cmd_len);
@@ -647,11 +647,11 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,/* Update entry type to indicate Command Type 3 IOCB */ *((uint32_t *)(&cmd_pkt->entry_type)) = -__constant_cpu_to_le32 (COMMAND_TYPE_7 ); +cpu_to_le32 (COMMAND_TYPE_7 );/* No data transfer */ if (!scsi_bufflen (cmd) || cmd->sc_data_direction ==DMA_NONE ) { - cmd_pkt->byte_count =__constant_cpu_to_le32 (0 ); + cmd_pkt->byte_count =cpu_to_le32 (0 );return ; }
@@ -661,12 +661,12 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,/* Set transfer direction */ if (cmd->sc_data_direction ==DMA_TO_DEVICE ) { cmd_pkt->task_mgmt_flags = -__constant_cpu_to_le16 (TMF_WRITE_DATA ); +cpu_to_le16 (TMF_WRITE_DATA ); sp->fcport->vha->hw->qla_stats.output_bytes +=scsi_bufflen (sp->cmd); }else if (cmd->sc_data_direction ==DMA_FROM_DEVICE ) { cmd_pkt->task_mgmt_flags = -__constant_cpu_to_le16 (TMF_READ_DATA ); +cpu_to_le16 (TMF_READ_DATA ); sp->fcport->vha->hw->qla_stats.input_bytes +=scsi_bufflen (sp->cmd); }
drivers/scsi/qla2xxx/qla_isr.c +2 -2
@@ -1722,9 +1722,9 @@ qla25xx_msix_rsp_q(int irq, void *dev_id) msix_disabled_hccr = rsp->options;if (!rsp->id) - msix_disabled_hccr &=__constant_cpu_to_le32 (BIT_22 ); + msix_disabled_hccr &=cpu_to_le32 (BIT_22 );else - msix_disabled_hccr &=__constant_cpu_to_le32 (BIT_6 ); + msix_disabled_hccr &=cpu_to_le32 (BIT_6 );qla24xx_process_response_queue (rsp);
drivers/scsi/qla2xxx/qla_mbx.c +11 -11
@@ -1485,11 +1485,11 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain, lg->entry_type =LOGINOUT_PORT_IOCB_TYPE ; lg->entry_count =1 ; lg->nport_handle =cpu_to_le16 (loop_id); - lg->control_flags =__constant_cpu_to_le16 (LCF_COMMAND_PLOGI ); + lg->control_flags =cpu_to_le16 (LCF_COMMAND_PLOGI );if (opt &BIT_0 ) - lg->control_flags |=__constant_cpu_to_le16 (LCF_COND_PLOGI ); + lg->control_flags |=cpu_to_le16 (LCF_COND_PLOGI );if (opt &BIT_1 ) - lg->control_flags |=__constant_cpu_to_le16 (LCF_SKIP_PRLI ); + lg->control_flags |=cpu_to_le16 (LCF_SKIP_PRLI ); lg->port_id[0 ] = al_pa; lg->port_id[1 ] = area; lg->port_id[2 ] = domain;
@@ -1503,7 +1503,7 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,"-- error status (%x).\n" , __func__, vha->host_no, lg->entry_status)); rval =QLA_FUNCTION_FAILED ; - }else if (lg->comp_status !=__constant_cpu_to_le16 (CS_COMPLETE )) { + }else if (lg->comp_status !=cpu_to_le16 (CS_COMPLETE )) { iop[0 ] =le32_to_cpu (lg->io_parameter[0 ]); iop[1 ] =le32_to_cpu (lg->io_parameter[1 ]);
@@ -1747,7 +1747,7 @@ qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain, lg->entry_count =1 ; lg->nport_handle =cpu_to_le16 (loop_id); lg->control_flags = -__constant_cpu_to_le16 (LCF_COMMAND_LOGO |LCF_IMPL_LOGO ); +cpu_to_le16 (LCF_COMMAND_LOGO |LCF_IMPL_LOGO ); lg->port_id[0 ] = al_pa; lg->port_id[1 ] = area; lg->port_id[2 ] = domain;
@@ -1762,7 +1762,7 @@ qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,"-- error status (%x).\n" , __func__, vha->host_no, lg->entry_status)); rval =QLA_FUNCTION_FAILED ; - }else if (lg->comp_status !=__constant_cpu_to_le16 (CS_COMPLETE )) { + }else if (lg->comp_status !=cpu_to_le16 (CS_COMPLETE )) { DEBUG2_3_11(printk("%s(%ld %d): failed to complete IOCB " "-- completion status (%x) ioparam=%x/%x.\n", __func__, vha->host_no, vha->vp_idx, le16_to_cpu(lg->comp_status),
@@ -2240,7 +2240,7 @@ qla24xx_abort_command(scsi_qla_host_t *vha, srb_t *sp, struct req_que *req)"-- error status (%x).\n" , __func__, vha->host_no, abt->entry_status)); rval =QLA_FUNCTION_FAILED ; - }else if (abt->nport_handle !=__constant_cpu_to_le16 (0 )) { + }else if (abt->nport_handle !=cpu_to_le16 (0 )) {DEBUG2_3_11 (printk ("%s(%ld): failed to complete IOCB " "-- completion status (%x).\n" , __func__, vha->host_no,le16_to_cpu (abt->nport_handle)));
@@ -2312,7 +2312,7 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport, tsk->p.sts.entry_status)); rval =QLA_FUNCTION_FAILED ; }else if (tsk->p.sts.comp_status != -__constant_cpu_to_le16 (CS_COMPLETE )) { +cpu_to_le16 (CS_COMPLETE )) {DEBUG2_3_11 (printk ("%s(%ld): failed to complete IOCB " "-- completion status (%x).\n" , __func__, vha->host_no,le16_to_cpu (tsk->p.sts.comp_status)));
@@ -2782,7 +2782,7 @@ qla24xx_modify_vp_config(scsi_qla_host_t *vha)"-- error status (%x).\n" , __func__, base_vha->host_no, vpmod->comp_status)); rval =QLA_FUNCTION_FAILED ; - }else if (vpmod->comp_status !=__constant_cpu_to_le16 (CS_COMPLETE )) { + }else if (vpmod->comp_status !=cpu_to_le16 (CS_COMPLETE )) {DEBUG2_3_11 (printk ("%s(%ld): failed to complete IOCB " "-- completion status (%x).\n" , __func__, base_vha->host_no,le16_to_cpu (vpmod->comp_status)));
@@ -2842,7 +2842,7 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd) vce->entry_type =VP_CTRL_IOCB_TYPE ; vce->entry_count =1 ; vce->command =cpu_to_le16 (cmd); - vce->vp_count =__constant_cpu_to_le16 (1 ); + vce->vp_count =cpu_to_le16 (1 );/* index map in firmware starts with 1; decrement index * this is ok as we never use index 0
@@ -2867,7 +2867,7 @@ qla24xx_control_vp(scsi_qla_host_t *vha, int cmd)"-- error status (%x).\n" , __func__, base_vha->host_no, vce->entry_status); rval =QLA_FUNCTION_FAILED ; - }else if (vce->comp_status !=__constant_cpu_to_le16 (CS_COMPLETE )) { + }else if (vce->comp_status !=cpu_to_le16 (CS_COMPLETE )) {DEBUG2_3_11 (printk ("%s(%ld): failed to complete IOCB " "-- completion status (%x).\n" , __func__, base_vha->host_no,le16_to_cpu (vce->comp_status)));
drivers/scsi/qla2xxx/qla_sup.c +6 -6
@@ -313,7 +313,7 @@ qla2x00_clear_nvram_protection(struct qla_hw_data *ha) wprot_old =cpu_to_le16 (qla2x00_get_nvram_word (ha, ha->nvram_base)); stat =qla2x00_write_nvram_word_tmo (ha, ha->nvram_base, -__constant_cpu_to_le16 (0x1234 ),100000 ); +cpu_to_le16 (0x1234 ),100000 ); wprot =cpu_to_le16 (qla2x00_get_nvram_word (ha, ha->nvram_base));if (stat !=QLA_SUCCESS || wprot !=0x1234 ) {/* Write enable. */
@@ -653,9 +653,9 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) region = (struct qla_flt_region *)&flt[1 ]; ha->isp_ops->read_optrom (vha, (uint8_t *)req->ring, flt_addr <<2 ,OPTROM_BURST_SIZE ); -if (*wptr ==__constant_cpu_to_le16 (0xffff )) +if (*wptr ==cpu_to_le16 (0xffff )) goto no_flash_data; -if (flt->version !=__constant_cpu_to_le16 (1 )) { +if (flt->version !=cpu_to_le16 (1 )) { DEBUG2(qla_printk(KERN_INFO, ha, "Unsupported FLT detected: " "version=0x%x length=0x%x checksum=0x%x.\n", le16_to_cpu(flt->version), le16_to_cpu(flt->length),
@@ -751,7 +751,7 @@ qla2xxx_get_fdt_info(scsi_qla_host_t *vha) fdt = (struct qla_fdt_layout *)req->ring; ha->isp_ops->read_optrom (vha, (uint8_t *)req->ring, ha->flt_region_fdt <<2 ,OPTROM_BURST_SIZE ); -if (*wptr ==__constant_cpu_to_le16 (0xffff )) +if (*wptr ==cpu_to_le16 (0xffff )) goto no_flash_data;if (fdt->sig[0 ] !='Q' || fdt->sig[1 ] !='L' || fdt->sig[2 ] !='I' || fdt->sig[3 ] !='D' )
@@ -858,9 +858,9 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha) ha->isp_ops->read_optrom (vha, (uint8_t *)&hdr, ha->flt_region_npiv_conf <<2 ,sizeof (struct qla_npiv_header )); -if (hdr.version ==__constant_cpu_to_le16 (0xffff )) +if (hdr.version ==cpu_to_le16 (0xffff ))return ; -if (hdr.version !=__constant_cpu_to_le16 (1 )) { +if (hdr.version !=cpu_to_le16 (1 )) { DEBUG2(qla_printk(KERN_INFO, ha, "Unsupported NPIV-Config " "detected: version=0x%x entries=0x%x checksum=0x%x.\n", le16_to_cpu(hdr.version), le16_to_cpu(hdr.entries),
drivers/scsi/qla4xxx/ql4_init.c +2 -2
@@ -115,8 +115,8 @@ int qla4xxx_init_rings(struct scsi_qla_host *ha)* registers aren't cleared-- causing the interrupt_handler to think * there are responses to be processed when there aren't. */ - ha->shadow_regs->req_q_out =__constant_cpu_to_le32 (0 ); - ha->shadow_regs->rsp_q_in =__constant_cpu_to_le32 (0 ); + ha->shadow_regs->req_q_out =cpu_to_le32 (0 ); + ha->shadow_regs->rsp_q_in =cpu_to_le32 (0 );wmb ();writel (0 , &ha->reg->req_q_in);
drivers/scsi/qla4xxx/ql4_iocb.c +1 -1
@@ -153,7 +153,7 @@ static void qla4xxx_build_scsi_iocbs(struct srb *srb,if (!scsi_bufflen (cmd) || cmd->sc_data_direction ==DMA_NONE ) {/* No data being transferred */ - cmd_entry->ttlByteCnt =__constant_cpu_to_le32 (0 ); + cmd_entry->ttlByteCnt =cpu_to_le32 (0 );return ; }
drivers/scsi/qla4xxx/ql4_mbx.c +4 -4
@@ -217,8 +217,8 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)/* Fill in the request and response queue information. */ init_fw_cb->pri.rqq_consumer_idx =cpu_to_le16 (ha->request_out); init_fw_cb->pri.compq_producer_idx =cpu_to_le16 (ha->response_in); - init_fw_cb->pri.rqq_len =__constant_cpu_to_le16 (REQUEST_QUEUE_DEPTH ); - init_fw_cb->pri.compq_len =__constant_cpu_to_le16 (RESPONSE_QUEUE_DEPTH ); + init_fw_cb->pri.rqq_len =cpu_to_le16 (REQUEST_QUEUE_DEPTH ); + init_fw_cb->pri.compq_len =cpu_to_le16 (RESPONSE_QUEUE_DEPTH ); init_fw_cb->pri.rqq_addr_lo =cpu_to_le32 (LSDW (ha->request_dma)); init_fw_cb->pri.rqq_addr_hi =cpu_to_le32 (MSDW (ha->request_dma)); init_fw_cb->pri.compq_addr_lo =cpu_to_le32 (LSDW (ha->response_dma));
@@ -230,9 +230,9 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)/* Set up required options. */ init_fw_cb->pri.fw_options |= -__constant_cpu_to_le16 (FWOPT_SESSION_MODE | +cpu_to_le16 (FWOPT_SESSION_MODE |FWOPT_INITIATOR_MODE ); - init_fw_cb->pri.fw_options &=__constant_cpu_to_le16 (~FWOPT_TARGET_MODE ); + init_fw_cb->pri.fw_options &=cpu_to_le16 (~FWOPT_TARGET_MODE );/* Save some info in adapter structure. */ ha->firmware_options =le16_to_cpu (init_fw_cb->pri.fw_options);
Signature · 1 line
1.6.1.401.gf39d5
Quoted 2 lines · Harvey Harrison
The base versions handle constant folding now. Almost entirely in qla2xxx/qla4xxx.
Do the same semantics apply to htonl()? As, I'd rather see the changes from __constant_htonl() -> cpu_to_be32() be __constant_htonl() -> htonl():
...
drivers/scsi/qla2xxx/qla_dbg.c qla25xx_copy_fce(struct qla_hw_data *ha, void *ptr, uint32_t **last_chain) · line 337
Quoted 13 lines
drivers/scsi/qla2xxx/qla_dbg.c +1
-1@@ -331,7 +331,7 @@ qla25xx_copy_fce(struct qla_hw_data *ha, void *ptr, uint32_t **last_chain)return ptr; *last_chain = &fcec->type; - fcec->type =__constant_htonl (DUMP_CHAIN_FCE ); + fcec->type =cpu_to_be32 (DUMP_CHAIN_FCE ); fcec->chain_size =htonl (sizeof (struct qla2xxx_fce_chain ) +fce_calc_size (ha->fce_bufs)); fcec->size =htonl (fce_calc_size (ha->fce_bufs));
... fcec->type = htonl(DUMP_CHAIN_FCE); fcec->chain_size = htonl(sizeof(struct qla2xxx_fce_chain) + fce_calc_size(ha->fce_bufs));
As it lends itself to a greater level of consistency with the other assignments in the code regions...
--
av
Quoted 8 lines · Andrew Vasquez
Quoted 2 lines · Harvey Harrison
The base versions handle constant folding now. Almost entirely in qla2xxx/qla4xxx.
Do the same semantics apply to
htonl()? As, I'd rather see the changes from__constant_htonl()->cpu_to_be32()be__constant_htonl()->htonl():
They do, htonl is a simple wrapper around cpu_to_be32. This was just a stupid search/replace in the two drivers. If you'd prefer it done differently, feel free.
If it's just the htonl bits I'll do a respin.
Harvey