All of lore.kernel.org
 help / color / mirror / Atom feed
* [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; 6+ 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] 6+ 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
  2016-08-05 22:57     ` Darren Hart
  0 siblings, 1 reply; 6+ 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] 6+ messages in thread

* Re: [PATCH 0857/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-05 22:57     ` Darren Hart
  0 siblings, 0 replies; 6+ messages in thread
From: Darren Hart @ 2016-08-05 22:57 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh
  Cc: Baole Ni, ibm-acpi-devel, platform-driver-x86, linux-kernel,
	chuansheng.liu

On Tue, Aug 02, 2016 at 02:34:07PM -0300, Henrique de Moraes Holschuh wrote:
> (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.

While I'm generally in favor of using macros where they exist, I do agree with
Henrique that this is actually less legible.

> 
> PS: no more ill-managed ultra-large patch bombs, *please*.

Indeed. 1285 patches with the same subject line is "not ideal". Prefixing with
the subsystem at the very least would have been an improvement. An RFC on the
concept, cc'ing the subsystem maintainers to get consensus and direction on how
to manage the large change would have been advisable.

I'm dropping these for pdx86 unless a compelling argument arises for including
them (like - the only subsystem not taking these is pdx86...)

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0857/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-05 22:57     ` Darren Hart
  0 siblings, 0 replies; 6+ messages in thread
From: Darren Hart @ 2016-08-05 22:57 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh
  Cc: Baole Ni, ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	chuansheng.liu-ral2JQCrhuEAvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	platform-driver-x86-u79uwXL29TY76Z2rM5mHXA

On Tue, Aug 02, 2016 at 02:34:07PM -0300, Henrique de Moraes Holschuh wrote:
> (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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Signed-off-by: Baole Ni <baolex.ni-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> 
> 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.

While I'm generally in favor of using macros where they exist, I do agree with
Henrique that this is actually less legible.

> 
> PS: no more ill-managed ultra-large patch bombs, *please*.

Indeed. 1285 patches with the same subject line is "not ideal". Prefixing with
the subsystem at the very least would have been an improvement. An RFC on the
concept, cc'ing the subsystem maintainers to get consensus and direction on how
to manage the large change would have been advisable.

I'm dropping these for pdx86 unless a compelling argument arises for including
them (like - the only subsystem not taking these is pdx86...)

-- 
Darren Hart
Intel Open Source Technology Center

------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 0857/1285] Replace numeric parameter like 0444 with macro
  2016-08-05 22:57     ` Darren Hart
@ 2016-08-08  6:41       ` Ni, BaoleX
  -1 siblings, 0 replies; 6+ messages in thread
From: Ni, BaoleX @ 2016-08-08  6:41 UTC (permalink / raw)
  To: Darren Hart
  Cc: ibm-acpi-devel, platform-driver-x86, linux-kernel, Liu,
	Chuansheng, Henrique de Moraes Holschuh

Dear Darren, 

Thank you very much! I'll be glad to take your advice.

Baole

-----Original Message-----
From: Darren Hart [mailto:dvhart@infradead.org] 
Sent: Saturday, August 06, 2016 6:57 AM
To: Henrique de Moraes Holschuh
Cc: Ni, BaoleX; ibm-acpi-devel@lists.sourceforge.net; platform-driver-x86@vger.kernel.org; linux-kernel@vger.kernel.org; Liu, Chuansheng
Subject: Re: [PATCH 0857/1285] Replace numeric parameter like 0444 with macro

On Tue, Aug 02, 2016 at 02:34:07PM -0300, Henrique de Moraes Holschuh wrote:
> (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.

While I'm generally in favor of using macros where they exist, I do agree with Henrique that this is actually less legible.

> 
> PS: no more ill-managed ultra-large patch bombs, *please*.

Indeed. 1285 patches with the same subject line is "not ideal". Prefixing with the subsystem at the very least would have been an improvement. An RFC on the concept, cc'ing the subsystem maintainers to get consensus and direction on how to manage the large change would have been advisable.

I'm dropping these for pdx86 unless a compelling argument arises for including them (like - the only subsystem not taking these is pdx86...)

--
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 0857/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-08  6:41       ` Ni, BaoleX
  0 siblings, 0 replies; 6+ messages in thread
From: Ni, BaoleX @ 2016-08-08  6:41 UTC (permalink / raw)
  To: Darren Hart
  Cc: ibm-acpi-devel, platform-driver-x86, linux-kernel, Liu,
	Chuansheng, Henrique de Moraes Holschuh

Dear Darren, 

Thank you very much! I'll be glad to take your advice.

Baole

-----Original Message-----
From: Darren Hart [mailto:dvhart@infradead.org] 
Sent: Saturday, August 06, 2016 6:57 AM
To: Henrique de Moraes Holschuh
Cc: Ni, BaoleX; ibm-acpi-devel@lists.sourceforge.net; platform-driver-x86@vger.kernel.org; linux-kernel@vger.kernel.org; Liu, Chuansheng
Subject: Re: [PATCH 0857/1285] Replace numeric parameter like 0444 with macro

On Tue, Aug 02, 2016 at 02:34:07PM -0300, Henrique de Moraes Holschuh wrote:
> (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.

While I'm generally in favor of using macros where they exist, I do agree with Henrique that this is actually less legible.

> 
> PS: no more ill-managed ultra-large patch bombs, *please*.

Indeed. 1285 patches with the same subject line is "not ideal". Prefixing with the subsystem at the very least would have been an improvement. An RFC on the concept, cc'ing the subsystem maintainers to get consensus and direction on how to manage the large change would have been advisable.

I'm dropping these for pdx86 unless a compelling argument arises for including them (like - the only subsystem not taking these is pdx86...)

--
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-08  6:41 UTC | newest]

Thread overview: 6+ 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
2016-08-05 22:57   ` Darren Hart
2016-08-05 22:57     ` Darren Hart
2016-08-08  6:41     ` Ni, BaoleX
2016-08-08  6:41       ` Ni, BaoleX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.