[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20160802103851.18817-1-baolex.ni@intel.com>
Date: Tue, 2 Aug 2016 18:38:51 +0800
From: Baole Ni <baolex.ni@...el.com>
To: gregkh@...uxfoundation.org, lenb@...nel.org, x86@...nel.org,
hpa@...or.com
Cc: linux-kernel@...r.kernel.org, chuansheng.liu@...el.com,
baolex.ni@...el.com
Subject: [PATCH 0076/1285] Replace numeric parameter like 0444 with macro
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@...el.com>
Signed-off-by: Baole Ni <baolex.ni@...el.com>
---
drivers/base/memory.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index f46dba8..10e7689 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -418,13 +418,13 @@ static ssize_t show_valid_zones(struct device *dev,
return sprintf(buf, "%s\n", zone->name);
}
-static DEVICE_ATTR(valid_zones, 0444, show_valid_zones, NULL);
+static DEVICE_ATTR(valid_zones, S_IRUSR | S_IRGRP | S_IROTH, show_valid_zones, NULL);
#endif
-static DEVICE_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL);
-static DEVICE_ATTR(state, 0644, show_mem_state, store_mem_state);
-static DEVICE_ATTR(phys_device, 0444, show_phys_device, NULL);
-static DEVICE_ATTR(removable, 0444, show_mem_removable, NULL);
+static DEVICE_ATTR(phys_index, S_IRUSR | S_IRGRP | S_IROTH, show_mem_start_phys_index, NULL);
+static DEVICE_ATTR(state, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, show_mem_state, store_mem_state);
+static DEVICE_ATTR(phys_device, S_IRUSR | S_IRGRP | S_IROTH, show_phys_device, NULL);
+static DEVICE_ATTR(removable, S_IRUSR | S_IRGRP | S_IROTH, show_mem_removable, NULL);
/*
* Block size attribute stuff
@@ -436,7 +436,7 @@ print_block_size(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "%lx\n", get_memory_block_size());
}
-static DEVICE_ATTR(block_size_bytes, 0444, print_block_size, NULL);
+static DEVICE_ATTR(block_size_bytes, S_IRUSR | S_IRGRP | S_IROTH, print_block_size, NULL);
/*
* Memory auto online policy.
@@ -466,7 +466,7 @@ store_auto_online_blocks(struct device *dev, struct device_attribute *attr,
return count;
}
-static DEVICE_ATTR(auto_online_blocks, 0644, show_auto_online_blocks,
+static DEVICE_ATTR(auto_online_blocks, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, show_auto_online_blocks,
store_auto_online_blocks);
/*
--
2.9.2
Powered by blists - more mailing lists