From: Bart Van Assche Date: Thu, 4 Apr 2019 19:44:41 +0000 (-0700) Subject: scsi: qla2xxx: Use ARRAY_SIZE() in the definition of QLA_LAST_SPEED X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b0a1c5b5c38ad6ee813875a28472774474d72589;p=openwrt%2Fstaging%2Fblogic.git scsi: qla2xxx: Use ARRAY_SIZE() in the definition of QLA_LAST_SPEED Make the code easier to read by avoiding to use a hard-coded constant. This patch does not change any functionality. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche Acked-by: Himanshu Madhani Signed-off-by: Martin K. Petersen --- 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];