Re: [PATCH v2] use cpu_to_le{16,32} instead of __constant_cpu_to_*

2020-09-02 Thread Joe Perches
On Wed, 2020-09-02 at 23:29 +0200, Rene Rebe wrote:
> As per recommendation, convert a few remaining __constant_cpu_to_le{16,32}
> instances in the qla2xxx, qla4xxx and cifs to just cpu_to_le{16,32}.
[]
> diff --git a/drivers/scsi/qla2xxx/qla_target.c 
> b/drivers/scsi/qla2xxx/qla_target.c
[]
> @@ -3583,7 +3583,7 @@ static int __qlt_send_term_imm_notif(struct 
> scsi_qla_host *vha,
>  
> /* terminate */
> nack->u.isp24.flags |=
> -   __constant_cpu_to_le16(NOTIFY_ACK_FLAGS_TERMINATE);
> +   cpu_to_le16(NOTIFY_ACK_FLAGS_TERMINATE);

trivia: this now fits on a single line.




[PATCH v2] use cpu_to_le{16,32} instead of __constant_cpu_to_*

2020-09-02 Thread Rene Rebe
Bart Van Assche  wrote:

> Hi René,
> 
> Whether __constant_cpu_to_le16() is used or cpu_to_le16(), the compiler
> generates exactly the same code. The name of the cpu_to_le16() function 
> however
> is shorter. I recommend cpu_to_le16() because of its shorter name and because
> that's what other kernel drivers use.

As per recommendation, convert a few remaining __constant_cpu_to_le{16,32}
instances in the qla2xxx, qla4xxx and cifs to just cpu_to_le{16,32}.

The later was apparently left over in f5307104e757 ("cifs: don't use
__constant_cpu_to_le32()").

Signed-off-by: René Rebe 

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index fbb80a043b4f..3de6bf94ccc0 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3583,7 +3583,7 @@ static int __qlt_send_term_imm_notif(struct scsi_qla_host 
*vha,
 
/* terminate */
nack->u.isp24.flags |=
-   __constant_cpu_to_le16(NOTIFY_ACK_FLAGS_TERMINATE);
+   cpu_to_le16(NOTIFY_ACK_FLAGS_TERMINATE);
 
nack->u.isp24.srr_rx_id = ntfy->u.isp24.srr_rx_id;
nack->u.isp24.status = ntfy->u.isp24.status;
diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
index 8dc82cfd38b2..f83b2f5fb490 100644
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
@@ -912,7 +912,7 @@ qla27xx_driver_info(struct qla27xx_fwdt_template *tmp)
tmp->driver_info[0] = cpu_to_le32(
v[3] << 24 | v[2] << 16 | v[1] << 8 | v[0]);
tmp->driver_info[1] = cpu_to_le32(v[5] << 8 | v[4]);
-   tmp->driver_info[2] = __constant_cpu_to_le32(0x12345678);
+   tmp->driver_info[2] = cpu_to_le32(0x12345678);
 }
 
 static void
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 4a7ef971a387..cc4cd54eb7a8 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -120,8 +120,8 @@ int qla4xxx_init_rings(struct scsi_qla_host *ha)
 * 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, >reg->req_q_in);
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index a8df2d7eb069..dd25f917b5e6 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -161,7 +161,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;
}
 
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index bc8de7d402d5..02396da2acd4 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -646,8 +646,8 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
/* Fill in the request and response queue information. */
init_fw_cb->rqq_consumer_idx = cpu_to_le16(ha->request_out);
init_fw_cb->compq_producer_idx = cpu_to_le16(ha->response_in);
-   init_fw_cb->rqq_len = __constant_cpu_to_le16(REQUEST_QUEUE_DEPTH);
-   init_fw_cb->compq_len = __constant_cpu_to_le16(RESPONSE_QUEUE_DEPTH);
+   init_fw_cb->rqq_len = cpu_to_le16(REQUEST_QUEUE_DEPTH);
+   init_fw_cb->compq_len = cpu_to_le16(RESPONSE_QUEUE_DEPTH);
init_fw_cb->rqq_addr_lo = cpu_to_le32(LSDW(ha->request_dma));
init_fw_cb->rqq_addr_hi = cpu_to_le32(MSDW(ha->request_dma));
init_fw_cb->compq_addr_lo = cpu_to_le32(LSDW(ha->response_dma));
@@ -657,20 +657,20 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
 
/* Set up required options. */
init_fw_cb->fw_options |=
-   __constant_cpu_to_le16(FWOPT_SESSION_MODE |
+   cpu_to_le16(FWOPT_SESSION_MODE |
   FWOPT_INITIATOR_MODE);
 
if (is_qla80XX(ha))
init_fw_cb->fw_options |=
-   __constant_cpu_to_le16(FWOPT_ENABLE_CRBDB);
+   cpu_to_le16(FWOPT_ENABLE_CRBDB);
 
-   init_fw_cb->fw_options &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE);
+   init_fw_cb->fw_options &= cpu_to_le16(~FWOPT_TARGET_MODE);
 
init_fw_cb->add_fw_options = 0;
init_fw_cb->add_fw_options |=
-   __constant_cpu_to_le16(ADFWOPT_SERIALIZE_TASK_MGMT);
+   cpu_to_le16(ADFWOPT_SERIALIZE_TASK_MGMT);
init_fw_cb->add_fw_options |=
-