-------- 转发的消息 --------
主题: [PATCH] nvme: use octal permissions '0444' and '0644'
日期: Thu, 25 Mar 2021 11:45:45 +0800
From: Meng Yu <yumeng18(a)huawei.com>
收件人: xuzaibo(a)huawei.com, wangzhou1(a)hisilicon.com,
fanghao11(a)huawei.com, yekai13(a)huawei.com, qianweili(a)huawei.com,
shenyang39(a)huawei.com, tanghui20(a)huawei.com, liulongfang(a)huawei.com,
chensihang1(a)hisilicon.com, yumeng18(a)huawei.com, songzhiqi1(a)huawei.com
Fixed following checkpatch warnings:
1. Symbolic permissions 'S_IRUGO | S_IWUSR' are not preferred. Consider
using octal permissions '0644';
2. Symbolic permissions 'S_IRUGO | S_IWUSR' are not preferred. Consider
using octal permissions '0644'.
Signed-off-by: Meng Yu <yumeng18(a)huawei.com>
---
drivers/nvme/host/core.c | 30 +++++++++++++++---------------
drivers/nvme/host/lightnvm.c | 6 +++---
drivers/nvme/host/multipath.c | 6 +++---
drivers/nvme/host/pci.c | 4 ++--
4 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e68a8c4..aec94d2 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2867,7 +2867,7 @@ static ssize_t nvme_subsys_show_nqn(struct device
*dev,
return sysfs_emit(buf, "%s\n", subsys->subnqn);
}
-static SUBSYS_ATTR_RO(subsysnqn, S_IRUGO, nvme_subsys_show_nqn);
+static SUBSYS_ATTR_RO(subsysnqn, 0444, nvme_subsys_show_nqn);
#define nvme_subsys_show_str_function(field) \
static ssize_t subsys_##field##_show(struct device *dev, \
@@ -2878,7 +2878,7 @@ static ssize_t subsys_##field##_show(struct
device *dev, \
return sprintf(buf, "%.*s\n", \
(int)sizeof(subsys->field), subsys->field); \
} \
-static SUBSYS_ATTR_RO(field, S_IRUGO, subsys_##field##_show);
+static SUBSYS_ATTR_RO(field, 0444, subsys_##field##_show);
nvme_subsys_show_str_function(model);
nvme_subsys_show_str_function(serial);
@@ -3224,7 +3224,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
ret = nvme_configure_apst(ctrl);
if (ret < 0)
return ret;
-
+
ret = nvme_configure_timestamp(ctrl);
if (ret < 0)
return ret;
@@ -3520,7 +3520,7 @@ static ssize_t field##_show(struct device *dev, \
return sprintf(buf, "%.*s\n", \
(int)sizeof(ctrl->subsys->field), ctrl->subsys->field); \
} \
-static DEVICE_ATTR(field, S_IRUGO, field##_show, NULL);
+static DEVICE_ATTR(field, 0444, field##_show, NULL);
nvme_show_str_function(model);
nvme_show_str_function(serial);
@@ -3533,7 +3533,7 @@ static ssize_t field##_show(struct device *dev, \
struct nvme_ctrl *ctrl = dev_get_drvdata(dev); \
return sprintf(buf, "%d\n", ctrl->field); \
} \
-static DEVICE_ATTR(field, S_IRUGO, field##_show, NULL);
+static DEVICE_ATTR(field, 0444, field##_show, NULL);
nvme_show_int_function(cntlid);
nvme_show_int_function(numa_node);
@@ -3560,7 +3560,7 @@ static ssize_t nvme_sysfs_show_transport(struct
device *dev,
return sysfs_emit(buf, "%s\n", ctrl->ops->name);
}
-static DEVICE_ATTR(transport, S_IRUGO, nvme_sysfs_show_transport, NULL);
+static DEVICE_ATTR(transport, 0444, nvme_sysfs_show_transport, NULL);
static ssize_t nvme_sysfs_show_state(struct device *dev,
struct device_attribute *attr,
@@ -3584,7 +3584,7 @@ static ssize_t nvme_sysfs_show_state(struct device
*dev,
return sprintf(buf, "unknown state\n");
}
-static DEVICE_ATTR(state, S_IRUGO, nvme_sysfs_show_state, NULL);
+static DEVICE_ATTR(state, 0444, nvme_sysfs_show_state, NULL);
static ssize_t nvme_sysfs_show_subsysnqn(struct device *dev,
struct device_attribute *attr,
@@ -3594,7 +3594,7 @@ static ssize_t nvme_sysfs_show_subsysnqn(struct
device *dev,
return sysfs_emit(buf, "%s\n", ctrl->subsys->subnqn);
}
-static DEVICE_ATTR(subsysnqn, S_IRUGO, nvme_sysfs_show_subsysnqn, NULL);
+static DEVICE_ATTR(subsysnqn, 0444, nvme_sysfs_show_subsysnqn, NULL);
static ssize_t nvme_sysfs_show_hostnqn(struct device *dev,
struct device_attribute *attr,
@@ -3604,7 +3604,7 @@ static ssize_t nvme_sysfs_show_hostnqn(struct
device *dev,
return sysfs_emit(buf, "%s\n", ctrl->opts->host->nqn);
}
-static DEVICE_ATTR(hostnqn, S_IRUGO, nvme_sysfs_show_hostnqn, NULL);
+static DEVICE_ATTR(hostnqn, 0444, nvme_sysfs_show_hostnqn, NULL);
static ssize_t nvme_sysfs_show_hostid(struct device *dev,
struct device_attribute *attr,
@@ -3614,7 +3614,7 @@ static ssize_t nvme_sysfs_show_hostid(struct
device *dev,
return sysfs_emit(buf, "%pU\n", &ctrl->opts->host->id);
}
-static DEVICE_ATTR(hostid, S_IRUGO, nvme_sysfs_show_hostid, NULL);
+static DEVICE_ATTR(hostid, 0444, nvme_sysfs_show_hostid, NULL);
static ssize_t nvme_sysfs_show_address(struct device *dev,
struct device_attribute *attr,
@@ -3624,7 +3624,7 @@ static ssize_t nvme_sysfs_show_address(struct
device *dev,
return ctrl->ops->get_address(ctrl, buf, PAGE_SIZE);
}
-static DEVICE_ATTR(address, S_IRUGO, nvme_sysfs_show_address, NULL);
+static DEVICE_ATTR(address, 0444, nvme_sysfs_show_address, NULL);
static ssize_t nvme_ctrl_loss_tmo_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -3656,8 +3656,8 @@ static ssize_t nvme_ctrl_loss_tmo_store(struct
device *dev,
opts->reconnect_delay);
return count;
}
-static DEVICE_ATTR(ctrl_loss_tmo, S_IRUGO | S_IWUSR,
- nvme_ctrl_loss_tmo_show, nvme_ctrl_loss_tmo_store);
+static DEVICE_ATTR(ctrl_loss_tmo, 0644, nvme_ctrl_loss_tmo_show,
+ nvme_ctrl_loss_tmo_store);
static ssize_t nvme_ctrl_reconnect_delay_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -3683,8 +3683,8 @@ static ssize_t
nvme_ctrl_reconnect_delay_store(struct device *dev,
ctrl->opts->reconnect_delay = v;
return count;
}
-static DEVICE_ATTR(reconnect_delay, S_IRUGO | S_IWUSR,
- nvme_ctrl_reconnect_delay_show, nvme_ctrl_reconnect_delay_store);
+static DEVICE_ATTR(reconnect_delay, 0644, nvme_ctrl_reconnect_delay_show,
+ nvme_ctrl_reconnect_delay_store);
static struct attribute *nvme_dev_attrs[] = {
&dev_attr_reset_controller.attr,
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index b705988..ec25565 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -1137,11 +1137,11 @@ static ssize_t nvm_dev_attr_show_20(struct
device *dev,
}
#define NVM_DEV_ATTR_RO(_name) \
- DEVICE_ATTR(_name, S_IRUGO, nvm_dev_attr_show, NULL)
+ DEVICE_ATTR(_name, 0444, nvm_dev_attr_show, NULL)
#define NVM_DEV_ATTR_12_RO(_name) \
- DEVICE_ATTR(_name, S_IRUGO, nvm_dev_attr_show_12, NULL)
+ DEVICE_ATTR(_name, 0444, nvm_dev_attr_show_12, NULL)
#define NVM_DEV_ATTR_20_RO(_name) \
- DEVICE_ATTR(_name, S_IRUGO, nvm_dev_attr_show_20, NULL)
+ DEVICE_ATTR(_name, 0444, nvm_dev_attr_show_20, NULL)
/* general attributes */
static NVM_DEV_ATTR_RO(version);
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index a1d476e..216604f 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -622,8 +622,8 @@ static ssize_t nvme_subsys_iopolicy_store(struct
device *dev,
return -EINVAL;
}
-SUBSYS_ATTR_RW(iopolicy, S_IRUGO | S_IWUSR,
- nvme_subsys_iopolicy_show, nvme_subsys_iopolicy_store);
+SUBSYS_ATTR_RW(iopolicy, 0644, nvme_subsys_iopolicy_show,
+ nvme_subsys_iopolicy_store);
static ssize_t ana_grpid_show(struct device *dev, struct
device_attribute *attr,
char *buf)
@@ -670,7 +670,7 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct
nvme_id_ns *id)
nvme_update_ns_ana_state(&desc, ns);
}
} else {
- ns->ana_state = NVME_ANA_OPTIMIZED; + ns->ana_state =
NVME_ANA_OPTIMIZED;
nvme_mpath_set_live(ns);
}
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 17ab332..678eeba 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1801,7 +1801,7 @@ static ssize_t nvme_cmb_show(struct device *dev,
return scnprintf(buf, PAGE_SIZE, "cmbloc : x%08x\ncmbsz : x%08x\n",
ndev->cmbloc, ndev->cmbsz);
}
-static DEVICE_ATTR(cmb, S_IRUGO, nvme_cmb_show, NULL);
+static DEVICE_ATTR(cmb, 0444, nvme_cmb_show, NULL);
static u64 nvme_cmb_size_unit(struct nvme_dev *dev)
{
@@ -2178,7 +2178,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
if (nr_io_queues == 0)
return 0;
-
+
clear_bit(NVMEQ_ENABLED, &adminq->flags);
if (dev->cmb_use_sqes) {
--
2.8.1
.