[PATCH 0962/1285] Replace numeric parameter like 0444 with macro

From: Baole Ni
Date: Tue Aug 02 2016 - 08:43:16 EST


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@xxxxxxxxx>
Signed-off-by: Baole Ni <baolex.ni@xxxxxxxxx>
---
drivers/thermal/thermal_core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 5133cd1..de6d349 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1099,9 +1099,9 @@ int power_actor_set_power(struct thermal_cooling_device *cdev,
return 0;
}

-static DEVICE_ATTR(type, 0444, type_show, NULL);
-static DEVICE_ATTR(temp, 0444, temp_show, NULL);
-static DEVICE_ATTR(mode, 0644, mode_show, mode_store);
+static DEVICE_ATTR(type, S_IRUSR | S_IRGRP | S_IROTH, type_show, NULL);
+static DEVICE_ATTR(temp, S_IRUSR | S_IRGRP | S_IROTH, temp_show, NULL);
+static DEVICE_ATTR(mode, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, mode_show, mode_store);
static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, passive_store);
static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show, policy_store);
static DEVICE_ATTR(available_policies, S_IRUGO, available_policies_show, NULL);
@@ -1170,9 +1170,9 @@ thermal_cooling_device_cur_state_store(struct device *dev,

static struct device_attribute dev_attr_cdev_type =
__ATTR(type, 0444, thermal_cooling_device_type_show, NULL);
-static DEVICE_ATTR(max_state, 0444,
+static DEVICE_ATTR(max_state, S_IRUSR | S_IRGRP | S_IROTH,
thermal_cooling_device_max_state_show, NULL);
-static DEVICE_ATTR(cur_state, 0644,
+static DEVICE_ATTR(cur_state, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH,
thermal_cooling_device_cur_state_show,
thermal_cooling_device_cur_state_store);

--
2.9.2