[PATCH 0988/1285] Replace numeric parameter like 0444 with macro

From: Baole Ni
Date: Tue Aug 02 2016 - 08:44:04 EST


I find that the developers often just specified the numeric value
when calling a macro which is defined with a parameter for access permission.
As we know, these numeric value for access permission have had the corresponding macro,
and that using macro can improve the robustness and readability of the code,
thus, I suggest replacing the numeric parameter with the macro.

Signed-off-by: Chuansheng Liu <chuansheng.liu@xxxxxxxxx>
Signed-off-by: Baole Ni <baolex.ni@xxxxxxxxx>
---
drivers/usb/wusbcore/cbaf.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/wusbcore/cbaf.c b/drivers/usb/wusbcore/cbaf.c
index da1b872..d37d918 100644
--- a/drivers/usb/wusbcore/cbaf.c
+++ b/drivers/usb/wusbcore/cbaf.c
@@ -355,7 +355,7 @@ static ssize_t cbaf_wusb_chid_store(struct device *dev,
return result;
return size;
}
-static DEVICE_ATTR(wusb_chid, 0600, cbaf_wusb_chid_show, cbaf_wusb_chid_store);
+static DEVICE_ATTR(wusb_chid, S_IRUSR | S_IWUSR, cbaf_wusb_chid_show, cbaf_wusb_chid_store);

static ssize_t cbaf_wusb_host_name_show(struct device *dev,
struct device_attribute *attr,
@@ -381,7 +381,7 @@ static ssize_t cbaf_wusb_host_name_store(struct device *dev,

return size;
}
-static DEVICE_ATTR(wusb_host_name, 0600, cbaf_wusb_host_name_show,
+static DEVICE_ATTR(wusb_host_name, S_IRUSR | S_IWUSR, cbaf_wusb_host_name_show,
cbaf_wusb_host_name_store);

static ssize_t cbaf_wusb_host_band_groups_show(struct device *dev,
@@ -412,7 +412,7 @@ static ssize_t cbaf_wusb_host_band_groups_store(struct device *dev,
return size;
}

-static DEVICE_ATTR(wusb_host_band_groups, 0600,
+static DEVICE_ATTR(wusb_host_band_groups, S_IRUSR | S_IWUSR,
cbaf_wusb_host_band_groups_show,
cbaf_wusb_host_band_groups_store);

@@ -464,7 +464,7 @@ static ssize_t cbaf_wusb_cdid_store(struct device *dev,

return size;
}
-static DEVICE_ATTR(wusb_cdid, 0600, cbaf_wusb_cdid_show, cbaf_wusb_cdid_store);
+static DEVICE_ATTR(wusb_cdid, S_IRUSR | S_IWUSR, cbaf_wusb_cdid_show, cbaf_wusb_cdid_store);

static ssize_t cbaf_wusb_device_band_groups_show(struct device *dev,
struct device_attribute *attr,
@@ -476,7 +476,7 @@ static ssize_t cbaf_wusb_device_band_groups_show(struct device *dev,
return scnprintf(buf, PAGE_SIZE, "0x%04x\n", cbaf->device_band_groups);
}

-static DEVICE_ATTR(wusb_device_band_groups, 0600,
+static DEVICE_ATTR(wusb_device_band_groups, S_IRUSR | S_IWUSR,
cbaf_wusb_device_band_groups_show,
NULL);

@@ -489,7 +489,7 @@ static ssize_t cbaf_wusb_device_name_show(struct device *dev,

return scnprintf(buf, PAGE_SIZE, "%s\n", cbaf->device_name);
}
-static DEVICE_ATTR(wusb_device_name, 0600, cbaf_wusb_device_name_show, NULL);
+static DEVICE_ATTR(wusb_device_name, S_IRUSR | S_IWUSR, cbaf_wusb_device_name_show, NULL);

static const struct wusb_cbaf_cc_data cbaf_cc_data_defaults = {
.AssociationTypeId_hdr = WUSB_AR_AssociationTypeId,
@@ -573,7 +573,7 @@ static ssize_t cbaf_wusb_ck_store(struct device *dev,

return size;
}
-static DEVICE_ATTR(wusb_ck, 0600, NULL, cbaf_wusb_ck_store);
+static DEVICE_ATTR(wusb_ck, S_IRUSR | S_IWUSR, NULL, cbaf_wusb_ck_store);

static struct attribute *cbaf_dev_attrs[] = {
&dev_attr_wusb_host_name.attr,
--
2.9.2