lkml.org 
[lkml]   [2016]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 0880/1285] Replace numeric parameter like 0444 with macro
Date
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/s390/char/tape_core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index 3c379da..fb69230 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -99,7 +99,7 @@ tape_medium_state_show(struct device *dev, struct device_attribute *attr, char *
}

static
-DEVICE_ATTR(medium_state, 0444, tape_medium_state_show, NULL);
+DEVICE_ATTR(medium_state, S_IRUSR | S_IRGRP | S_IROTH, tape_medium_state_show, NULL);

static ssize_t
tape_first_minor_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -111,7 +111,7 @@ tape_first_minor_show(struct device *dev, struct device_attribute *attr, char *b
}

static
-DEVICE_ATTR(first_minor, 0444, tape_first_minor_show, NULL);
+DEVICE_ATTR(first_minor, S_IRUSR | S_IRGRP | S_IROTH, tape_first_minor_show, NULL);

static ssize_t
tape_state_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -124,7 +124,7 @@ tape_state_show(struct device *dev, struct device_attribute *attr, char *buf)
}

static
-DEVICE_ATTR(state, 0444, tape_state_show, NULL);
+DEVICE_ATTR(state, S_IRUSR | S_IRGRP | S_IROTH, tape_state_show, NULL);

static ssize_t
tape_operation_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -151,7 +151,7 @@ tape_operation_show(struct device *dev, struct device_attribute *attr, char *buf
}

static
-DEVICE_ATTR(operation, 0444, tape_operation_show, NULL);
+DEVICE_ATTR(operation, S_IRUSR | S_IRGRP | S_IROTH, tape_operation_show, NULL);

static ssize_t
tape_blocksize_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -164,7 +164,7 @@ tape_blocksize_show(struct device *dev, struct device_attribute *attr, char *buf
}

static
-DEVICE_ATTR(blocksize, 0444, tape_blocksize_show, NULL);
+DEVICE_ATTR(blocksize, S_IRUSR | S_IRGRP | S_IROTH, tape_blocksize_show, NULL);

static struct attribute *tape_attrs[] = {
&dev_attr_medium_state.attr,
--
2.9.2
\
 
 \ /
  Last update: 2016-08-02 18:01    [W:0.032 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site