* [PATCH 0002/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-02 10:33 Baole Ni
2016-08-02 14:11 ` Austin S. Hemmelgarn
0 siblings, 1 reply; 2+ messages in thread
From: Baole Ni @ 2016-08-02 10:33 UTC (permalink / raw)
To: linux; +Cc: linux-arm-kernel, 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>
---
arch/arm/common/dmabounce.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index 1143c4d..22d7a9a 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -98,7 +98,7 @@ static ssize_t dmabounce_show(struct device *dev, struct device_attribute *attr,
device_info->bounce_count);
}
-static DEVICE_ATTR(dmabounce_stats, 0400, dmabounce_show, NULL);
+static DEVICE_ATTR(dmabounce_stats, S_IRUSR, dmabounce_show, NULL);
#endif
--
2.9.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 0002/1285] Replace numeric parameter like 0444 with macro
2016-08-02 10:33 [PATCH 0002/1285] Replace numeric parameter like 0444 with macro Baole Ni
@ 2016-08-02 14:11 ` Austin S. Hemmelgarn
0 siblings, 0 replies; 2+ messages in thread
From: Austin S. Hemmelgarn @ 2016-08-02 14:11 UTC (permalink / raw)
To: Baole Ni; +Cc: linux-kernel, chuansheng.liu
On 2016-08-02 06:33, Baole Ni wrote:
> 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.
Have you taken the time to consider _why_ this is common practice? In
most cases, people who have been using UNIX-like systems for any
reasonable period of time can mentally parse the octal permissions
almost instantly, while it often takes them a while to figure out the
macros. So, overall, this change actually hurts readability for a large
number of people.
Additionally, the argument of robustness is somewhat bogus too, the
internal representation of POSIX DAC permissions is not going to change
any time soon, if at all, so abstracting the values away isn't really
improving robustness considering that what it's supposed to protect
against won't ever happen.
Beyond that, there are also a number of other issues with the set as a
whole:
1. In many places, you haven't properly re-wrapped lines at the 80
column limit.
2. In many places, you haven't condensed macros like you should (for
example, 0644 should be (S_IWUSR | S_IRUGO), not (S_IWUSR | S_IRUSR |
S_IRGRP | S_IROTH), and this would help with the line length limit too).
3. You're missing subsystem tags in your patch subjects.
4. Patches shouldn't be per-file for changes like this, they should be
per-subsystem. Dropping this many patches (you've sent more patches in
a few hours than the whole sees in a day on average) is a very good way
to get people to ignore you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-02 14:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-02 10:33 [PATCH 0002/1285] Replace numeric parameter like 0444 with macro Baole Ni
2016-08-02 14:11 ` Austin S. Hemmelgarn
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®