diff mbox series

[v3,net-next,12/15] socket: Move sock_inuse_add() to sock.c.

Message ID 20241213092152.14057-13-kuniyu@amazon.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series treewide: socket: Clean up sock_create() and friends. | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 15 this patch: 15
netdev/build_tools success Errors and warnings before: 0 (+0) this patch: 0 (+0)
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 28 this patch: 28
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 2596 this patch: 2596
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 49 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 13 this patch: 13
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-12-15--09-00 (tests: 795)

Commit Message

Kuniyuki Iwashima Dec. 13, 2024, 9:21 a.m. UTC
sock_inuse_add() is used only in net/core/sock.c.

Let's move sock_inuse_add() there.

This is mostly revert of commit d477eb900484 ("net: make
sock_inuse_add() available").

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
 include/net/sock.h |  9 ---------
 net/core/sock.c    | 10 ++++++++++
 2 files changed, 10 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/include/net/sock.h b/include/net/sock.h
index 8de415fefe3b..845efc3c5568 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1433,11 +1433,6 @@  static inline void sock_prot_inuse_add(const struct net *net,
 	this_cpu_add(net->core.prot_inuse->val[prot->inuse_idx], val);
 }
 
-static inline void sock_inuse_add(const struct net *net, int val)
-{
-	this_cpu_add(net->core.prot_inuse->all, val);
-}
-
 int sock_prot_inuse_get(struct net *net, struct proto *proto);
 int sock_inuse_get(struct net *net);
 #else
@@ -1445,10 +1440,6 @@  static inline void sock_prot_inuse_add(const struct net *net,
 				       const struct proto *prot, int val)
 {
 }
-
-static inline void sock_inuse_add(const struct net *net, int val)
-{
-}
 #endif
 
 
diff --git a/net/core/sock.c b/net/core/sock.c
index 9fb57afe6848..78c812205e35 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -153,6 +153,7 @@ 
 static DEFINE_MUTEX(proto_list_mutex);
 static LIST_HEAD(proto_list);
 
+static void sock_inuse_add(const struct net *net, int val);
 static void sock_def_write_space_wfree(struct sock *sk);
 static void sock_def_write_space(struct sock *sk);
 
@@ -3885,6 +3886,11 @@  int sock_prot_inuse_get(struct net *net, struct proto *prot)
 }
 EXPORT_SYMBOL_GPL(sock_prot_inuse_get);
 
+static void sock_inuse_add(const struct net *net, int val)
+{
+	this_cpu_add(net->core.prot_inuse->all, val);
+}
+
 int sock_inuse_get(struct net *net)
 {
 	int cpu, res = 0;
@@ -3944,6 +3950,10 @@  static void release_proto_idx(struct proto *prot)
 		clear_bit(prot->inuse_idx, proto_inuse_idx);
 }
 #else
+static void sock_inuse_add(const struct net *net, int val)
+{
+}
+
 static inline int assign_proto_idx(struct proto *prot)
 {
 	return 0;