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

From: Baole Ni
Date: Tue Aug 02 2016 - 11:14:54 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/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