linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0962/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-02 12:03 Baole Ni
  0 siblings, 0 replies; only message in thread
From: Baole Ni @ 2016-08-02 12:03 UTC (permalink / raw)
  To: rui.zhang, edubezval, gregkh, m.chehab, m.szyprowski,
	kyungmin.park, k.kozlowski
  Cc: linux-pm, linux-kernel, chuansheng.liu, baolex.ni, heiko, s.hauer

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/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

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

only message in thread, other threads:[~2016-08-02 12:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-02 12:03 [PATCH 0962/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;
as well as URLs for NNTP newsgroup(s).