* [PATCH 0870/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-02 11:53 Baole Ni
0 siblings, 0 replies; only message in thread
From: Baole Ni @ 2016-08-02 11:53 UTC (permalink / raw)
To: lgirdwood, broonie, paulus, mpe, dwmw2, m.chehab, pawel,
m.szyprowski, kyungmin.park, k.kozlowski
Cc: linux-kernel, chuansheng.liu, baolex.ni
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/regulator/core.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index ec8184d5..278f428 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -335,7 +335,7 @@ static ssize_t regulator_uV_show(struct device *dev,
return ret;
}
-static DEVICE_ATTR(microvolts, 0444, regulator_uV_show, NULL);
+static DEVICE_ATTR(microvolts, S_IRUSR | S_IRGRP | S_IROTH, regulator_uV_show, NULL);
static ssize_t regulator_uA_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -344,7 +344,7 @@ static ssize_t regulator_uA_show(struct device *dev,
return sprintf(buf, "%d\n", _regulator_get_current_limit(rdev));
}
-static DEVICE_ATTR(microamps, 0444, regulator_uA_show, NULL);
+static DEVICE_ATTR(microamps, S_IRUSR | S_IRGRP | S_IROTH, regulator_uA_show, NULL);
static ssize_t name_show(struct device *dev, struct device_attribute *attr,
char *buf)
@@ -377,7 +377,7 @@ static ssize_t regulator_opmode_show(struct device *dev,
return regulator_print_opmode(buf, _regulator_get_mode(rdev));
}
-static DEVICE_ATTR(opmode, 0444, regulator_opmode_show, NULL);
+static DEVICE_ATTR(opmode, S_IRUSR | S_IRGRP | S_IROTH, regulator_opmode_show, NULL);
static ssize_t regulator_print_state(char *buf, int state)
{
@@ -401,7 +401,7 @@ static ssize_t regulator_state_show(struct device *dev,
return ret;
}
-static DEVICE_ATTR(state, 0444, regulator_state_show, NULL);
+static DEVICE_ATTR(state, S_IRUSR | S_IRGRP | S_IROTH, regulator_state_show, NULL);
static ssize_t regulator_status_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -448,7 +448,7 @@ static ssize_t regulator_status_show(struct device *dev,
return sprintf(buf, "%s\n", label);
}
-static DEVICE_ATTR(status, 0444, regulator_status_show, NULL);
+static DEVICE_ATTR(status, S_IRUSR | S_IRGRP | S_IROTH, regulator_status_show, NULL);
static ssize_t regulator_min_uA_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -460,7 +460,7 @@ static ssize_t regulator_min_uA_show(struct device *dev,
return sprintf(buf, "%d\n", rdev->constraints->min_uA);
}
-static DEVICE_ATTR(min_microamps, 0444, regulator_min_uA_show, NULL);
+static DEVICE_ATTR(min_microamps, S_IRUSR | S_IRGRP | S_IROTH, regulator_min_uA_show, NULL);
static ssize_t regulator_max_uA_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -472,7 +472,7 @@ static ssize_t regulator_max_uA_show(struct device *dev,
return sprintf(buf, "%d\n", rdev->constraints->max_uA);
}
-static DEVICE_ATTR(max_microamps, 0444, regulator_max_uA_show, NULL);
+static DEVICE_ATTR(max_microamps, S_IRUSR | S_IRGRP | S_IROTH, regulator_max_uA_show, NULL);
static ssize_t regulator_min_uV_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -484,7 +484,7 @@ static ssize_t regulator_min_uV_show(struct device *dev,
return sprintf(buf, "%d\n", rdev->constraints->min_uV);
}
-static DEVICE_ATTR(min_microvolts, 0444, regulator_min_uV_show, NULL);
+static DEVICE_ATTR(min_microvolts, S_IRUSR | S_IRGRP | S_IROTH, regulator_min_uV_show, NULL);
static ssize_t regulator_max_uV_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -496,7 +496,7 @@ static ssize_t regulator_max_uV_show(struct device *dev,
return sprintf(buf, "%d\n", rdev->constraints->max_uV);
}
-static DEVICE_ATTR(max_microvolts, 0444, regulator_max_uV_show, NULL);
+static DEVICE_ATTR(max_microvolts, S_IRUSR | S_IRGRP | S_IROTH, regulator_max_uV_show, NULL);
static ssize_t regulator_total_uA_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -511,7 +511,7 @@ static ssize_t regulator_total_uA_show(struct device *dev,
mutex_unlock(&rdev->mutex);
return sprintf(buf, "%d\n", uA);
}
-static DEVICE_ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL);
+static DEVICE_ATTR(requested_microamps, S_IRUSR | S_IRGRP | S_IROTH, regulator_total_uA_show, NULL);
static ssize_t num_users_show(struct device *dev, struct device_attribute *attr,
char *buf)
@@ -543,7 +543,7 @@ static ssize_t regulator_suspend_mem_uV_show(struct device *dev,
return sprintf(buf, "%d\n", rdev->constraints->state_mem.uV);
}
-static DEVICE_ATTR(suspend_mem_microvolts, 0444,
+static DEVICE_ATTR(suspend_mem_microvolts, S_IRUSR | S_IRGRP | S_IROTH,
regulator_suspend_mem_uV_show, NULL);
static ssize_t regulator_suspend_disk_uV_show(struct device *dev,
@@ -553,7 +553,7 @@ static ssize_t regulator_suspend_disk_uV_show(struct device *dev,
return sprintf(buf, "%d\n", rdev->constraints->state_disk.uV);
}
-static DEVICE_ATTR(suspend_disk_microvolts, 0444,
+static DEVICE_ATTR(suspend_disk_microvolts, S_IRUSR | S_IRGRP | S_IROTH,
regulator_suspend_disk_uV_show, NULL);
static ssize_t regulator_suspend_standby_uV_show(struct device *dev,
@@ -563,7 +563,7 @@ static ssize_t regulator_suspend_standby_uV_show(struct device *dev,
return sprintf(buf, "%d\n", rdev->constraints->state_standby.uV);
}
-static DEVICE_ATTR(suspend_standby_microvolts, 0444,
+static DEVICE_ATTR(suspend_standby_microvolts, S_IRUSR | S_IRGRP | S_IROTH,
regulator_suspend_standby_uV_show, NULL);
static ssize_t regulator_suspend_mem_mode_show(struct device *dev,
@@ -574,7 +574,7 @@ static ssize_t regulator_suspend_mem_mode_show(struct device *dev,
return regulator_print_opmode(buf,
rdev->constraints->state_mem.mode);
}
-static DEVICE_ATTR(suspend_mem_mode, 0444,
+static DEVICE_ATTR(suspend_mem_mode, S_IRUSR | S_IRGRP | S_IROTH,
regulator_suspend_mem_mode_show, NULL);
static ssize_t regulator_suspend_disk_mode_show(struct device *dev,
@@ -585,7 +585,7 @@ static ssize_t regulator_suspend_disk_mode_show(struct device *dev,
return regulator_print_opmode(buf,
rdev->constraints->state_disk.mode);
}
-static DEVICE_ATTR(suspend_disk_mode, 0444,
+static DEVICE_ATTR(suspend_disk_mode, S_IRUSR | S_IRGRP | S_IROTH,
regulator_suspend_disk_mode_show, NULL);
static ssize_t regulator_suspend_standby_mode_show(struct device *dev,
@@ -596,7 +596,7 @@ static ssize_t regulator_suspend_standby_mode_show(struct device *dev,
return regulator_print_opmode(buf,
rdev->constraints->state_standby.mode);
}
-static DEVICE_ATTR(suspend_standby_mode, 0444,
+static DEVICE_ATTR(suspend_standby_mode, S_IRUSR | S_IRGRP | S_IROTH,
regulator_suspend_standby_mode_show, NULL);
static ssize_t regulator_suspend_mem_state_show(struct device *dev,
@@ -607,7 +607,7 @@ static ssize_t regulator_suspend_mem_state_show(struct device *dev,
return regulator_print_state(buf,
rdev->constraints->state_mem.enabled);
}
-static DEVICE_ATTR(suspend_mem_state, 0444,
+static DEVICE_ATTR(suspend_mem_state, S_IRUSR | S_IRGRP | S_IROTH,
regulator_suspend_mem_state_show, NULL);
static ssize_t regulator_suspend_disk_state_show(struct device *dev,
@@ -618,7 +618,7 @@ static ssize_t regulator_suspend_disk_state_show(struct device *dev,
return regulator_print_state(buf,
rdev->constraints->state_disk.enabled);
}
-static DEVICE_ATTR(suspend_disk_state, 0444,
+static DEVICE_ATTR(suspend_disk_state, S_IRUSR | S_IRGRP | S_IROTH,
regulator_suspend_disk_state_show, NULL);
static ssize_t regulator_suspend_standby_state_show(struct device *dev,
@@ -629,7 +629,7 @@ static ssize_t regulator_suspend_standby_state_show(struct device *dev,
return regulator_print_state(buf,
rdev->constraints->state_standby.enabled);
}
-static DEVICE_ATTR(suspend_standby_state, 0444,
+static DEVICE_ATTR(suspend_standby_state, S_IRUSR | S_IRGRP | S_IROTH,
regulator_suspend_standby_state_show, NULL);
static ssize_t regulator_bypass_show(struct device *dev,
@@ -651,7 +651,7 @@ static ssize_t regulator_bypass_show(struct device *dev,
return sprintf(buf, "%s\n", report);
}
-static DEVICE_ATTR(bypass, 0444,
+static DEVICE_ATTR(bypass, S_IRUSR | S_IRGRP | S_IROTH,
regulator_bypass_show, NULL);
/* Calculate the new optimum regulator operating mode based on the new total
--
2.9.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-08-02 14:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-02 11:53 [PATCH 0870/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®