From: Baole Ni <baolex.ni@intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org, paulus@samba.org,
mpe@ellerman.id.au, dwmw2@infradead.org, m.chehab@samsung.com,
pawel@osciak.com, m.szyprowski@samsung.com,
kyungmin.park@samsung.com, k.kozlowski@samsung.com
Cc: linux-kernel@vger.kernel.org, chuansheng.liu@intel.com,
baolex.ni@intel.com
Subject: [PATCH 0870/1285] Replace numeric parameter like 0444 with macro
Date: Tue, 2 Aug 2016 19:53:49 +0800 [thread overview]
Message-ID: <20160802115349.7978-1-baolex.ni@intel.com> (raw)
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
reply other threads:[~2016-08-02 14:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160802115349.7978-1-baolex.ni@intel.com \
--to=baolex.ni@intel.com \
--cc=broonie@kernel.org \
--cc=chuansheng.liu@intel.com \
--cc=dwmw2@infradead.org \
--cc=k.kozlowski@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=m.szyprowski@samsung.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=pawel@osciak.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®