* [PATCH 0857/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-02 11:52 Baole Ni
2016-08-02 17:34 ` Henrique de Moraes Holschuh
0 siblings, 1 reply; 4+ messages in thread
From: Baole Ni @ 2016-08-02 11:52 UTC (permalink / raw)
To: ibm-acpi, dvhart, jgross, bhelgaas, m.chehab, pawel, m.szyprowski,
kyungmin.park, k.kozlowski
Cc: ibm-acpi-devel, platform-driver-x86, 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/platform/x86/thinkpad_acpi.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index b65ce75..898d185 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -9553,57 +9553,57 @@ static int __init set_ibm_param(const char *val, struct kernel_param *kp)
return -EINVAL;
}
-module_param(experimental, int, 0444);
+module_param(experimental, int, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(experimental,
"Enables experimental features when non-zero");
module_param_named(debug, dbg_level, uint, 0);
MODULE_PARM_DESC(debug, "Sets debug level bit-mask");
-module_param(force_load, bool, 0444);
+module_param(force_load, bool, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(force_load,
"Attempts to load the driver even on a "
"mis-identified ThinkPad when true");
-module_param_named(fan_control, fan_control_allowed, bool, 0444);
+module_param_named(fan_control, fan_control_allowed, bool, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(fan_control,
"Enables setting fan parameters features when true");
-module_param_named(brightness_mode, brightness_mode, uint, 0444);
+module_param_named(brightness_mode, brightness_mode, uint, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(brightness_mode,
"Selects brightness control strategy: "
"0=auto, 1=EC, 2=UCMS, 3=EC+NVRAM");
-module_param(brightness_enable, uint, 0444);
+module_param(brightness_enable, uint, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(brightness_enable,
"Enables backlight control when 1, disables when 0");
#ifdef CONFIG_THINKPAD_ACPI_ALSA_SUPPORT
-module_param_named(volume_mode, volume_mode, uint, 0444);
+module_param_named(volume_mode, volume_mode, uint, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(volume_mode,
"Selects volume control strategy: "
"0=auto, 1=EC, 2=N/A, 3=EC+NVRAM");
-module_param_named(volume_capabilities, volume_capabilities, uint, 0444);
+module_param_named(volume_capabilities, volume_capabilities, uint, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(volume_capabilities,
"Selects the mixer capabilites: "
"0=auto, 1=volume and mute, 2=mute only");
-module_param_named(volume_control, volume_control_allowed, bool, 0444);
+module_param_named(volume_control, volume_control_allowed, bool, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(volume_control,
"Enables software override for the console audio "
"control when true");
-module_param_named(software_mute, software_mute_requested, bool, 0444);
+module_param_named(software_mute, software_mute_requested, bool, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(software_mute,
"Request full software mute control");
/* ALSA module API parameters */
-module_param_named(index, alsa_index, int, 0444);
+module_param_named(index, alsa_index, int, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(index, "ALSA index for the ACPI EC Mixer");
-module_param_named(id, alsa_id, charp, 0444);
+module_param_named(id, alsa_id, charp, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(id, "ALSA id for the ACPI EC Mixer");
-module_param_named(enable, alsa_enable, bool, 0444);
+module_param_named(enable, alsa_enable, bool, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(enable, "Enable the ALSA interface for the ACPI EC Mixer");
#endif /* CONFIG_THINKPAD_ACPI_ALSA_SUPPORT */
@@ -9624,25 +9624,25 @@ TPACPI_PARAM(volume);
TPACPI_PARAM(fan);
#ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES
-module_param(dbg_wlswemul, uint, 0444);
+module_param(dbg_wlswemul, uint, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(dbg_wlswemul, "Enables WLSW emulation");
module_param_named(wlsw_state, tpacpi_wlsw_emulstate, bool, 0);
MODULE_PARM_DESC(wlsw_state,
"Initial state of the emulated WLSW switch");
-module_param(dbg_bluetoothemul, uint, 0444);
+module_param(dbg_bluetoothemul, uint, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(dbg_bluetoothemul, "Enables bluetooth switch emulation");
module_param_named(bluetooth_state, tpacpi_bluetooth_emulstate, bool, 0);
MODULE_PARM_DESC(bluetooth_state,
"Initial state of the emulated bluetooth switch");
-module_param(dbg_wwanemul, uint, 0444);
+module_param(dbg_wwanemul, uint, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(dbg_wwanemul, "Enables WWAN switch emulation");
module_param_named(wwan_state, tpacpi_wwan_emulstate, bool, 0);
MODULE_PARM_DESC(wwan_state,
"Initial state of the emulated WWAN switch");
-module_param(dbg_uwbemul, uint, 0444);
+module_param(dbg_uwbemul, uint, S_IRUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(dbg_uwbemul, "Enables UWB switch emulation");
module_param_named(uwb_state, tpacpi_uwb_emulstate, bool, 0);
MODULE_PARM_DESC(uwb_state,
--
2.9.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0857/1285] Replace numeric parameter like 0444 with macro
2016-08-02 11:52 [PATCH 0857/1285] Replace numeric parameter like 0444 with macro Baole Ni
@ 2016-08-02 17:34 ` Henrique de Moraes Holschuh
[not found] ` <20160802173407.GA1939-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Henrique de Moraes Holschuh @ 2016-08-02 17:34 UTC (permalink / raw)
To: Baole Ni
Cc: dvhart, ibm-acpi-devel, platform-driver-x86, linux-kernel,
chuansheng.liu
(cc list trimmed)
On Tue, 02 Aug 2016, Baole Ni wrote:
> 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>
NACK.
IMO, the proposed change reduces readiability for no good reason. Most
people touching kernel code have 0444, 0644, 0755, etc. already
hardwired into their pattern recognition neural network, while the POSIX
S_* crap is actually bug food.
PS: no more ill-managed ultra-large patch bombs, *please*.
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-08 6:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-02 11:52 [PATCH 0857/1285] Replace numeric parameter like 0444 with macro Baole Ni
2016-08-02 17:34 ` Henrique de Moraes Holschuh
[not found] ` <20160802173407.GA1939-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
2016-08-05 22:57 ` Darren Hart
2016-08-08 6:41 ` Ni, BaoleX
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox