* [PATCH 0985/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-02 12:05 Baole Ni
0 siblings, 0 replies; only message in thread
From: Baole Ni @ 2016-08-02 12:05 UTC (permalink / raw)
To: b-liu, gregkh, m.chehab, m.szyprowski, kyungmin.park, k.kozlowski
Cc: linux-usb, linux-kernel, chuansheng.liu, baolex.ni, mina86,
deepa.kernel, mathias.nyman, stern, oneukum
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@intel.com>
Signed-off-by: Baole Ni <baolex.ni@intel.com>
---
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-08-02 14:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-02 12:05 [PATCH 0985/1285] Replace numeric parameter like 0444 with macro Baole Ni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®