lkml.org 
[lkml]   [2016]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 0843/1285] Replace numeric parameter like 0444 with macro
Date
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/platform/x86/asus-laptop.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index 15f1311..a1fdd5a 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -78,18 +78,18 @@ MODULE_LICENSE("GPL");
* 4 | Software | Software
*/
static uint wapf = 1;
-module_param(wapf, uint, 0444);
+module_param(wapf, uint, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(wapf, "WAPF value");

static char *wled_type = "unknown";
static char *bled_type = "unknown";

-module_param(wled_type, charp, 0444);
+module_param(wled_type, charp, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(wled_type, "Set the wled type on boot "
"(unknown, led or rfkill). "
"default is unknown");

-module_param(bled_type, charp, 0444);
+module_param(bled_type, charp, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(bled_type, "Set the bled type on boot "
"(unknown, led or rfkill). "
"default is unknown");
@@ -100,27 +100,27 @@ static int wimax_status = -1;
static int wwan_status = -1;
static int als_status;

-module_param(wlan_status, int, 0444);
+module_param(wlan_status, int, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot "
"(0 = disabled, 1 = enabled, -1 = don't do anything). "
"default is -1");

-module_param(bluetooth_status, int, 0444);
+module_param(bluetooth_status, int, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot "
"(0 = disabled, 1 = enabled, -1 = don't do anything). "
"default is -1");

-module_param(wimax_status, int, 0444);
+module_param(wimax_status, int, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(wimax_status, "Set the wireless status on boot "
"(0 = disabled, 1 = enabled, -1 = don't do anything). "
"default is -1");

-module_param(wwan_status, int, 0444);
+module_param(wwan_status, int, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(wwan_status, "Set the wireless status on boot "
"(0 = disabled, 1 = enabled, -1 = don't do anything). "
"default is -1");

-module_param(als_status, int, 0444);
+module_param(als_status, int, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(als_status, "Set the ALS status on boot "
"(0 = disabled, 1 = enabled). "
"default is 0");
--
2.9.2
\
 
 \ /
  Last update: 2016-08-02 15:21    [W:0.041 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site