* [PATCH 0864/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-02 11:53 Baole Ni
0 siblings, 0 replies; only message in thread
From: Baole Ni @ 2016-08-02 11:53 UTC (permalink / raw)
To: sre, dbaryshkov, dwmw2, m.chehab, pawel, m.szyprowski,
kyungmin.park, k.kozlowski
Cc: linux-pm, linux-kernel, chuansheng.liu, baolex.ni
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/power/test_power.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/power/test_power.c b/drivers/power/test_power.c
index 57246cd..ef97fe1 100644
--- a/drivers/power/test_power.c
+++ b/drivers/power/test_power.c
@@ -500,32 +500,32 @@ static const struct kernel_param_ops param_ops_battery_voltage = {
#define param_check_battery_voltage(name, p) __param_check(name, p, void);
-module_param(ac_online, ac_online, 0644);
+module_param(ac_online, ac_online, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(ac_online, "AC charging state <on|off>");
-module_param(usb_online, usb_online, 0644);
+module_param(usb_online, usb_online, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(usb_online, "USB charging state <on|off>");
-module_param(battery_status, battery_status, 0644);
+module_param(battery_status, battery_status, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(battery_status,
"battery status <charging|discharging|not-charging|full>");
-module_param(battery_present, battery_present, 0644);
+module_param(battery_present, battery_present, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(battery_present,
"battery presence state <good|overheat|dead|overvoltage|failure>");
-module_param(battery_technology, battery_technology, 0644);
+module_param(battery_technology, battery_technology, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(battery_technology,
"battery technology <NiMH|LION|LIPO|LiFe|NiCd|LiMn>");
-module_param(battery_health, battery_health, 0644);
+module_param(battery_health, battery_health, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(battery_health,
"battery health state <good|overheat|dead|overvoltage|failure>");
-module_param(battery_capacity, battery_capacity, 0644);
+module_param(battery_capacity, battery_capacity, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(battery_capacity, "battery capacity (percentage)");
-module_param(battery_voltage, battery_voltage, 0644);
+module_param(battery_voltage, battery_voltage, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(battery_voltage, "battery voltage (millivolts)");
MODULE_DESCRIPTION("Power supply driver for testing");
--
2.9.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-08-02 11:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-02 11:53 [PATCH 0864/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).