From: Martin Wilck Date: Tue, 17 Apr 2018 23:35:07 +0000 (+0200) Subject: scsi: devinfo: use const_ilog2 for array indices X-Git-Tag: v4.18-rc1~66^2~186 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=659c1c1b29ebc4af9148eed74a9f28f00b8b6dc6;p=thirdparty%2Fkernel%2Flinux.git scsi: devinfo: use const_ilog2 for array indices Use the just introduced const_ilog2() macro to avoid sparse errors. Signed-off-by: Martin Wilck Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/scsi_debugfs.c b/drivers/scsi/scsi_debugfs.c index b784002ef0bd0..c5a8756384bcf 100644 --- a/drivers/scsi/scsi_debugfs.c +++ b/drivers/scsi/scsi_debugfs.c @@ -4,7 +4,7 @@ #include #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), diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 1e36c9a9ad17d..5120e613a29c0 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -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" };