All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0805/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-02 11:48 ` Baole Ni
  0 siblings, 0 replies; 4+ messages in thread
From: Baole Ni @ 2016-08-02 11:48 UTC (permalink / raw)
  To: wei.liu2, kvalo, linuxwifi, m.chehab, pawel, m.szyprowski,
	kyungmin.park, k.kozlowski
  Cc: xen-devel, netdev, 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/net/xen-netback/netback.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index edbae0b..e6e6598 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -53,22 +53,22 @@
  * enabled by default.
  */
 bool separate_tx_rx_irq = true;
-module_param(separate_tx_rx_irq, bool, 0644);
+module_param(separate_tx_rx_irq, bool, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
 /* The time that packets can stay on the guest Rx internal queue
  * before they are dropped.
  */
 unsigned int rx_drain_timeout_msecs = 10000;
-module_param(rx_drain_timeout_msecs, uint, 0444);
+module_param(rx_drain_timeout_msecs, uint, S_IRUSR | S_IRGRP | S_IROTH);
 
 /* The length of time before the frontend is considered unresponsive
  * because it isn't providing Rx slots.
  */
 unsigned int rx_stall_timeout_msecs = 60000;
-module_param(rx_stall_timeout_msecs, uint, 0444);
+module_param(rx_stall_timeout_msecs, uint, S_IRUSR | S_IRGRP | S_IROTH);
 
 unsigned int xenvif_max_queues;
-module_param_named(max_queues, xenvif_max_queues, uint, 0644);
+module_param_named(max_queues, xenvif_max_queues, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 MODULE_PARM_DESC(max_queues,
 		 "Maximum number of queues per virtual interface");
 
@@ -78,7 +78,7 @@ MODULE_PARM_DESC(max_queues,
  */
 #define FATAL_SKB_SLOTS_DEFAULT 20
 static unsigned int fatal_skb_slots = FATAL_SKB_SLOTS_DEFAULT;
-module_param(fatal_skb_slots, uint, 0444);
+module_param(fatal_skb_slots, uint, S_IRUSR | S_IRGRP | S_IROTH);
 
 /* The amount to copy out of the first guest Tx slot into the skb's
  * linear area.  If the first slot has more data, it will be mapped
@@ -92,7 +92,7 @@ module_param(fatal_skb_slots, uint, 0444);
 /* This is the maximum number of flows in the hash cache. */
 #define XENVIF_HASH_CACHE_SIZE_DEFAULT 64
 unsigned int xenvif_hash_cache_size = XENVIF_HASH_CACHE_SIZE_DEFAULT;
-module_param_named(hash_cache_size, xenvif_hash_cache_size, uint, 0644);
+module_param_named(hash_cache_size, xenvif_hash_cache_size, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 MODULE_PARM_DESC(hash_cache_size, "Number of flows in the hash cache");
 
 static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
-- 
2.9.2

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

* [PATCH 0805/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-02 11:48 ` Baole Ni
  0 siblings, 0 replies; 4+ messages in thread
From: Baole Ni @ 2016-08-02 11:48 UTC (permalink / raw)
  To: wei.liu2, kvalo, linuxwifi, m.chehab, pawel, m.szyprowski,
	kyungmin.park, k.kozlowski
  Cc: baolex.ni, xen-devel, chuansheng.liu, linux-kernel, netdev

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/net/xen-netback/netback.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index edbae0b..e6e6598 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -53,22 +53,22 @@
  * enabled by default.
  */
 bool separate_tx_rx_irq = true;
-module_param(separate_tx_rx_irq, bool, 0644);
+module_param(separate_tx_rx_irq, bool, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 
 /* The time that packets can stay on the guest Rx internal queue
  * before they are dropped.
  */
 unsigned int rx_drain_timeout_msecs = 10000;
-module_param(rx_drain_timeout_msecs, uint, 0444);
+module_param(rx_drain_timeout_msecs, uint, S_IRUSR | S_IRGRP | S_IROTH);
 
 /* The length of time before the frontend is considered unresponsive
  * because it isn't providing Rx slots.
  */
 unsigned int rx_stall_timeout_msecs = 60000;
-module_param(rx_stall_timeout_msecs, uint, 0444);
+module_param(rx_stall_timeout_msecs, uint, S_IRUSR | S_IRGRP | S_IROTH);
 
 unsigned int xenvif_max_queues;
-module_param_named(max_queues, xenvif_max_queues, uint, 0644);
+module_param_named(max_queues, xenvif_max_queues, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 MODULE_PARM_DESC(max_queues,
 		 "Maximum number of queues per virtual interface");
 
@@ -78,7 +78,7 @@ MODULE_PARM_DESC(max_queues,
  */
 #define FATAL_SKB_SLOTS_DEFAULT 20
 static unsigned int fatal_skb_slots = FATAL_SKB_SLOTS_DEFAULT;
-module_param(fatal_skb_slots, uint, 0444);
+module_param(fatal_skb_slots, uint, S_IRUSR | S_IRGRP | S_IROTH);
 
 /* The amount to copy out of the first guest Tx slot into the skb's
  * linear area.  If the first slot has more data, it will be mapped
@@ -92,7 +92,7 @@ module_param(fatal_skb_slots, uint, 0444);
 /* This is the maximum number of flows in the hash cache. */
 #define XENVIF_HASH_CACHE_SIZE_DEFAULT 64
 unsigned int xenvif_hash_cache_size = XENVIF_HASH_CACHE_SIZE_DEFAULT;
-module_param_named(hash_cache_size, xenvif_hash_cache_size, uint, 0644);
+module_param_named(hash_cache_size, xenvif_hash_cache_size, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 MODULE_PARM_DESC(hash_cache_size, "Number of flows in the hash cache");
 
 static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
-- 
2.9.2


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH 0805/1285] Replace numeric parameter like 0444 with macro
  2016-08-02 11:48 ` Baole Ni
@ 2016-08-02 12:40   ` Wei Liu
  -1 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2016-08-02 12:40 UTC (permalink / raw)
  To: Baole Ni
  Cc: wei.liu2, kvalo, linuxwifi, m.chehab, pawel, m.szyprowski,
	kyungmin.park, k.kozlowski, xen-devel, netdev, linux-kernel,
	chuansheng.liu

On Tue, Aug 02, 2016 at 07:48:12PM +0800, 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>

Acked-by: Wei Liu <wei.liu2@citrix.com>

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

* Re: [PATCH 0805/1285] Replace numeric parameter like 0444 with macro
@ 2016-08-02 12:40   ` Wei Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2016-08-02 12:40 UTC (permalink / raw)
  To: Baole Ni
  Cc: k.kozlowski, chuansheng.liu, wei.liu2, pawel, linuxwifi, netdev,
	linux-kernel, kyungmin.park, xen-devel, m.chehab, kvalo,
	m.szyprowski

On Tue, Aug 02, 2016 at 07:48:12PM +0800, 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>

Acked-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-08-02 15:36 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:48 [PATCH 0805/1285] Replace numeric parameter like 0444 with macro Baole Ni
2016-08-02 11:48 ` Baole Ni
2016-08-02 12:40 ` Wei Liu
2016-08-02 12:40   ` Wei Liu

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.