Fixed following checkpatch warnings: 1. Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'; 2. Symbolic permissions 'S_IWUSR' are not preferred. Consider using octal permissions '0200'; 3. Symbolic permissions 'S_IRUGO | S_IWUSR' are not preferred. Consider using octal permissions '0644'; 4. And coding style fix.
Signed-off-by: Meng Yu yumeng18@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 c2c5bc4..46dadfb 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2578,7 +2578,7 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct size_t nqnlen; int off;
- if(!(ctrl->quirks & NVME_QUIRK_IGNORE_DEV_SUBNQN)) { + if (!(ctrl->quirks & NVME_QUIRK_IGNORE_DEV_SUBNQN)) { nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE); if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) { strlcpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE); @@ -2670,7 +2670,7 @@ static ssize_t nvme_subsys_show_nqn(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%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, \ @@ -2681,7 +2681,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); @@ -3014,7 +3014,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; @@ -3134,7 +3134,7 @@ static ssize_t nvme_sysfs_reset(struct device *dev, return ret; return count; } -static DEVICE_ATTR(reset_controller, S_IWUSR, NULL, nvme_sysfs_reset); +static DEVICE_ATTR(reset_controller, 0200, NULL, nvme_sysfs_reset);
static ssize_t nvme_sysfs_rescan(struct device *dev, struct device_attribute *attr, const char *buf, @@ -3145,7 +3145,7 @@ static ssize_t nvme_sysfs_rescan(struct device *dev, nvme_queue_scan(ctrl); return count; } -static DEVICE_ATTR(rescan_controller, S_IWUSR, NULL, nvme_sysfs_rescan); +static DEVICE_ATTR(rescan_controller, 0200, NULL, nvme_sysfs_rescan);
static inline struct nvme_ns_head *dev_to_ns_head(struct device *dev) { @@ -3290,7 +3290,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); @@ -3303,7 +3303,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); @@ -3324,7 +3324,7 @@ static ssize_t nvme_sysfs_delete(struct device *dev, nvme_delete_ctrl_sync(ctrl); return count; } -static DEVICE_ATTR(delete_controller, S_IWUSR, NULL, nvme_sysfs_delete); +static DEVICE_ATTR(delete_controller, 0200, NULL, nvme_sysfs_delete);
static ssize_t nvme_sysfs_show_transport(struct device *dev, struct device_attribute *attr, @@ -3334,7 +3334,7 @@ static ssize_t nvme_sysfs_show_transport(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%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, @@ -3357,7 +3357,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, @@ -3367,7 +3367,7 @@ static ssize_t nvme_sysfs_show_subsysnqn(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%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, @@ -3377,7 +3377,7 @@ static ssize_t nvme_sysfs_show_hostnqn(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%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, @@ -3387,7 +3387,7 @@ static ssize_t nvme_sysfs_show_hostid(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%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, @@ -3397,7 +3397,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 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 6960875..2c7b99f 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -1138,11 +1138,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 da78e49..deab995 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -621,8 +621,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) @@ -662,7 +662,7 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id) mutex_unlock(&ns->ctrl->ana_lock); } else { mutex_lock(&ns->head->lock); - ns->ana_state = NVME_ANA_OPTIMIZED; + ns->ana_state = NVME_ANA_OPTIMIZED; nvme_mpath_set_live(ns); mutex_unlock(&ns->head->lock); } diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index e2bacd3..47ee949 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1739,7 +1739,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) { @@ -2108,7 +2108,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) {