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

From: Baole Ni
Date: Tue Aug 02 2016 - 10:44:57 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/musb/musb_core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index f824336..6182097 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1642,7 +1642,7 @@ EXPORT_SYMBOL_GPL(musb_interrupt);
static bool use_dma = 1;

/* "modprobe ... use_dma=0" etc */
-module_param(use_dma, bool, 0644);
+module_param(use_dma, bool, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(use_dma, "enable/disable use of DMA");

void musb_dma_completion(struct musb *musb, u8 epnum, u8 transmit)
@@ -1734,7 +1734,7 @@ musb_mode_store(struct device *dev, struct device_attribute *attr,

return (status == 0) ? n : status;
}
-static DEVICE_ATTR(mode, 0644, musb_mode_show, musb_mode_store);
+static DEVICE_ATTR(mode, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, musb_mode_show, musb_mode_store);

static ssize_t
musb_vbus_store(struct device *dev, struct device_attribute *attr,
@@ -1786,7 +1786,7 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf)
return sprintf(buf, "Vbus %s, timeout %lu msec\n",
vbus ? "on" : "off", val);
}
-static DEVICE_ATTR(vbus, 0644, musb_vbus_show, musb_vbus_store);
+static DEVICE_ATTR(vbus, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, musb_vbus_show, musb_vbus_store);

/* Gadget drivers can't know that a host is connected so they might want
* to start SRP, but users can. This allows userspace to trigger SRP.
@@ -1809,7 +1809,7 @@ musb_srp_store(struct device *dev, struct device_attribute *attr,

return n;
}
-static DEVICE_ATTR(srp, 0644, NULL, musb_srp_store);
+static DEVICE_ATTR(srp, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, NULL, musb_srp_store);

static struct attribute *musb_attributes[] = {
&dev_attr_mode.attr,
--
2.9.2