mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0814/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-02 11:49 Baole Ni
  0 siblings, 0 replies; only message in thread
From: Baole Ni @ 2016-08-02 11:49 UTC (permalink / raw)
  To: jejb, deller, Allen.Hubbe, rjui, sbranden, m.chehab, pawel,
	m.szyprowski, kyungmin.park, k.kozlowski
  Cc: linux-parisc, linux-kernel, chuansheng.liu, baolex.ni, arnd

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/parisc/pdc_stable.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index 3651c38..0cb008f 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -487,8 +487,8 @@ static const struct sysfs_ops pdcspath_attr_ops = {
 };
 
 /* These are the two attributes of any PDC path. */
-static PATHS_ATTR(hwpath, 0644, pdcspath_hwpath_read, pdcspath_hwpath_write);
-static PATHS_ATTR(layer, 0644, pdcspath_layer_read, pdcspath_layer_write);
+static PATHS_ATTR(hwpath, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, pdcspath_hwpath_read, pdcspath_hwpath_write);
+static PATHS_ATTR(layer, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, pdcspath_layer_read, pdcspath_layer_write);
 
 static struct attribute *paths_subsys_attrs[] = {
 	&paths_attr_hwpath.attr,
@@ -931,15 +931,15 @@ static ssize_t pdcs_osdep2_write(struct kobject *kobj,
 }
 
 /* The remaining attributes. */
-static PDCS_ATTR(size, 0444, pdcs_size_read, NULL);
-static PDCS_ATTR(autoboot, 0644, pdcs_autoboot_read, pdcs_autoboot_write);
-static PDCS_ATTR(autosearch, 0644, pdcs_autosearch_read, pdcs_autosearch_write);
-static PDCS_ATTR(timer, 0444, pdcs_timer_read, NULL);
-static PDCS_ATTR(osid, 0444, pdcs_osid_read, NULL);
-static PDCS_ATTR(osdep1, 0600, pdcs_osdep1_read, pdcs_osdep1_write);
-static PDCS_ATTR(diagnostic, 0400, pdcs_diagnostic_read, NULL);
-static PDCS_ATTR(fastsize, 0400, pdcs_fastsize_read, NULL);
-static PDCS_ATTR(osdep2, 0600, pdcs_osdep2_read, pdcs_osdep2_write);
+static PDCS_ATTR(size, S_IRUSR | S_IRGRP | S_IROTH, pdcs_size_read, NULL);
+static PDCS_ATTR(autoboot, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, pdcs_autoboot_read, pdcs_autoboot_write);
+static PDCS_ATTR(autosearch, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, pdcs_autosearch_read, pdcs_autosearch_write);
+static PDCS_ATTR(timer, S_IRUSR | S_IRGRP | S_IROTH, pdcs_timer_read, NULL);
+static PDCS_ATTR(osid, S_IRUSR | S_IRGRP | S_IROTH, pdcs_osid_read, NULL);
+static PDCS_ATTR(osdep1, S_IRUSR | S_IWUSR, pdcs_osdep1_read, pdcs_osdep1_write);
+static PDCS_ATTR(diagnostic, S_IRUSR, pdcs_diagnostic_read, NULL);
+static PDCS_ATTR(fastsize, S_IRUSR, pdcs_fastsize_read, NULL);
+static PDCS_ATTR(osdep2, S_IRUSR | S_IWUSR, pdcs_osdep2_read, pdcs_osdep2_write);
 
 static struct attribute *pdcs_subsys_attrs[] = {
 	&pdcs_attr_size.attr,
-- 
2.9.2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-02 15:35 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:49 [PATCH 0814/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®