diff mbox series

[5/6] net/ipv4: Update ip_tunnel_metadata_cnt static key to modern api

Message ID 20180326210929.5244-6-dave@stgolabs.net
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series None | expand

Commit Message

Davidlohr Bueso March 26, 2018, 9:09 p.m. UTC
No changes in refcount semantics -- key init is false; replace

static_key_slow_inc|dec   with   static_branch_inc|dec
static_key_false          with   static_branch_unlikely

Added a '_key' suffix to i2c_trace_msg, for better self
documentation.

Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 include/net/ip_tunnels.h  | 4 ++--
 net/ipv4/ip_tunnel_core.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Davidlohr Bueso March 27, 2018, 3:37 p.m. UTC | #1
On Tue, 27 Mar 2018, David Miller wrote:

>From: Davidlohr Bueso <dave@stgolabs.net>
>Date: Mon, 26 Mar 2018 14:09:28 -0700
>
>> No changes in refcount semantics -- key init is false; replace
>>
>> static_key_slow_inc|dec   with   static_branch_inc|dec
>> static_key_false          with   static_branch_unlikely
>>
>> Added a '_key' suffix to i2c_trace_msg, for better self
>> documentation.
>
>I see no reference to i2c_trace_msg in this patch.

Sorry, that was from a previous changelog. The reason why it was not updated was
because I chose not to rename to ip_tunnel_metadata_cnt_key, so the whole sentence
needed removal. Do you want a v3 or can you pick up as is?

Thanks,
Davidlohr
David Miller March 27, 2018, 3:44 p.m. UTC | #2
From: Davidlohr Bueso <dave@stgolabs.net>
Date: Mon, 26 Mar 2018 14:09:28 -0700

> No changes in refcount semantics -- key init is false; replace
> 
> static_key_slow_inc|dec   with   static_branch_inc|dec
> static_key_false          with   static_branch_unlikely
> 
> Added a '_key' suffix to i2c_trace_msg, for better self
> documentation.

I see no reference to i2c_trace_msg in this patch.
diff mbox series

Patch

diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 540a4b4417bf..fc494b48a64a 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -466,12 +466,12 @@  static inline struct ip_tunnel_info *lwt_tun_info(struct lwtunnel_state *lwtstat
 	return (struct ip_tunnel_info *)lwtstate->data;
 }
 
-extern struct static_key ip_tunnel_metadata_cnt;
+DECLARE_STATIC_KEY_FALSE(ip_tunnel_metadata_cnt);
 
 /* Returns > 0 if metadata should be collected */
 static inline int ip_tunnel_collect_metadata(void)
 {
-	return static_key_false(&ip_tunnel_metadata_cnt);
+	return static_branch_unlikely(&ip_tunnel_metadata_cnt);
 }
 
 void __init ip_tunnel_core_init(void);
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 2f39479be92f..dde671e97829 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -423,17 +423,17 @@  void __init ip_tunnel_core_init(void)
 	lwtunnel_encap_add_ops(&ip6_tun_lwt_ops, LWTUNNEL_ENCAP_IP6);
 }
 
-struct static_key ip_tunnel_metadata_cnt = STATIC_KEY_INIT_FALSE;
+DEFINE_STATIC_KEY_FALSE(ip_tunnel_metadata_cnt);
 EXPORT_SYMBOL(ip_tunnel_metadata_cnt);
 
 void ip_tunnel_need_metadata(void)
 {
-	static_key_slow_inc(&ip_tunnel_metadata_cnt);
+	static_branch_inc(&ip_tunnel_metadata_cnt);
 }
 EXPORT_SYMBOL_GPL(ip_tunnel_need_metadata);
 
 void ip_tunnel_unneed_metadata(void)
 {
-	static_key_slow_dec(&ip_tunnel_metadata_cnt);
+	static_branch_dec(&ip_tunnel_metadata_cnt);
 }
 EXPORT_SYMBOL_GPL(ip_tunnel_unneed_metadata);