diff mbox series

[02/11] qla2xxx: Change a stack variable into a static const variable

Message ID 20190404194448.121489-3-bvanassche@acm.org (mailing list archive)
State Accepted
Headers show
Series qla2xxx patches for kernel v5.2 | expand

Commit Message

Bart Van Assche April 4, 2019, 7:44 p.m. UTC
Make qla2x00_get_host_fabric_name() slightly faster by changing a stack
array into a static array. Declare that array const now that the
wwn_to_u64() argument pointer has been declared const.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/qla2xxx/qla_attr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Himanshu Madhani April 8, 2019, 4:41 p.m. UTC | #1
Hi Bart, 


On 4/4/19, 12:45 PM, "Bart Van Assche" <bvanassche@acm.org> wrote:

    External Email
    
    ----------------------------------------------------------------------
    Make qla2x00_get_host_fabric_name() slightly faster by changing a stack
    array into a static array. Declare that array const now that the
    wwn_to_u64() argument pointer has been declared const.
    
    Cc: Himanshu Madhani <hmadhani@marvell.com>
    Cc: Giridhar Malavali <gmalavali@marvell.com>
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    ---
     drivers/scsi/qla2xxx/qla_attr.c | 5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)
    
    diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
    index da64fe54f59e..b8706ed3ae1d 100644
    --- a/drivers/scsi/qla2xxx/qla_attr.c
    +++ b/drivers/scsi/qla2xxx/qla_attr.c
    @@ -2723,8 +2723,9 @@ static void
     qla2x00_get_host_fabric_name(struct Scsi_Host *shost)
     {
     	scsi_qla_host_t *vha = shost_priv(shost);
    -	uint8_t node_name[WWN_SIZE] = { 0xFF, 0xFF, 0xFF, 0xFF, \
    -		0xFF, 0xFF, 0xFF, 0xFF};
    +	static const uint8_t node_name[WWN_SIZE] = {
    +		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
    +	};
     	u64 fabric_name = wwn_to_u64(node_name);
     
     	if (vha->device_flags & SWITCH_FOUND)
    -- 
    2.21.0.196.g041f5ea1cf98
    
 Looks Good. 

Acked-by: Himanshu Madhani <hmadhani@marvell.com>
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index da64fe54f59e..b8706ed3ae1d 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -2723,8 +2723,9 @@  static void
 qla2x00_get_host_fabric_name(struct Scsi_Host *shost)
 {
 	scsi_qla_host_t *vha = shost_priv(shost);
-	uint8_t node_name[WWN_SIZE] = { 0xFF, 0xFF, 0xFF, 0xFF, \
-		0xFF, 0xFF, 0xFF, 0xFF};
+	static const uint8_t node_name[WWN_SIZE] = {
+		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
+	};
 	u64 fabric_name = wwn_to_u64(node_name);
 
 	if (vha->device_flags & SWITCH_FOUND)