diff mbox series

[04/11] qla2xxx: Use ARRAY_SIZE() in the definition of QLA_LAST_SPEED

Message ID 20190404194448.121489-5-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 the code easier to read by avoiding to use a hard-coded constant. This
patch does not change any functionality.

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_isr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Himanshu Madhani April 8, 2019, 4:43 p.m. UTC | #1
On 4/4/19, 12:45 PM, "linux-scsi-owner@vger.kernel.org on behalf of Bart Van Assche" <linux-scsi-owner@vger.kernel.org on behalf of bvanassche@acm.org> wrote:

    Make the code easier to read by avoiding to use a hard-coded constant. This
    patch does not change any functionality.
    
    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_isr.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
    index 20f0761b8b87..055d313a0461 100644
    --- a/drivers/scsi/qla2xxx/qla_isr.c
    +++ b/drivers/scsi/qla2xxx/qla_isr.c
    @@ -366,7 +366,7 @@ qla2x00_get_link_speed_str(struct qla_hw_data *ha, uint16_t speed)
     	static const char *const link_speeds[] = {
     		"1", "2", "?", "4", "8", "16", "32", "10"
     	};
    -#define	QLA_LAST_SPEED	7
    +#define	QLA_LAST_SPEED (ARRAY_SIZE(link_speeds) - 1)
     
     	if (IS_QLA2100(ha) || IS_QLA2200(ha))
     		return link_speeds[0];
    -- 
    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_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 20f0761b8b87..055d313a0461 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -366,7 +366,7 @@  qla2x00_get_link_speed_str(struct qla_hw_data *ha, uint16_t speed)
 	static const char *const link_speeds[] = {
 		"1", "2", "?", "4", "8", "16", "32", "10"
 	};
-#define	QLA_LAST_SPEED	7
+#define	QLA_LAST_SPEED (ARRAY_SIZE(link_speeds) - 1)
 
 	if (IS_QLA2100(ha) || IS_QLA2200(ha))
 		return link_speeds[0];