Replace numeric parameter like 0444 with macro
Subsystems (2)
PATCH 76/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 <[email protected]>
Signed-off-by Baole Ni <[email protected]>
--- drivers/base/memory.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/base/memory.c +7 -7
@@ -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);/*
Signature · 1 line
2.9.2