scsi: devinfo: use const_ilog2 for array indices
authorMartin Wilck <mwilck@suse.com>
Tue, 17 Apr 2018 23:35:07 +0000 (01:35 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 20 Apr 2018 23:14:28 +0000 (19:14 -0400)
Use the just introduced const_ilog2() macro to avoid sparse errors.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_debugfs.c
drivers/scsi/scsi_sysfs.c

index b784002ef0bd00369c10f79aced81290a2366a3c..c5a8756384bcf1b120a54b0d1a1bc391137bc964 100644 (file)
@@ -4,7 +4,7 @@
 #include <scsi/scsi_dbg.h>
 #include "scsi_debugfs.h"
 
-#define SCSI_CMD_FLAG_NAME(name) [ilog2(SCMD_##name)] = #name
+#define SCSI_CMD_FLAG_NAME(name)[const_ilog2(SCMD_##name)] = #name
 static const char *const scsi_cmd_flags[] = {
        SCSI_CMD_FLAG_NAME(TAGGED),
        SCSI_CMD_FLAG_NAME(UNCHECKED_ISA_DMA),
index 1e36c9a9ad17df678529e13bf0dfc0f888a3c35e..5120e613a29c01a19cc8ff7a27353b1b7c425e91 100644 (file)
@@ -968,7 +968,7 @@ sdev_show_wwid(struct device *dev, struct device_attribute *attr,
 static DEVICE_ATTR(wwid, S_IRUGO, sdev_show_wwid, NULL);
 
 #define BLIST_FLAG_NAME(name)                                  \
-       [ilog2((__force unsigned int)BLIST_##name)] = #name
+       [const_ilog2((__force unsigned int)BLIST_##name)] = #name
 static const char *const sdev_bflags_name[] = {
 #include "scsi_devinfo_tbl.c"
 };