* [PATCH] net/core/sock: fix coding style issues Fix multiple coding style issues in net/core/sock.c:
@ 2025-11-03 2:36 XueBing Chen
2025-11-04 1:26 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: XueBing Chen @ 2025-11-03 2:36 UTC (permalink / raw)
To: edumazet, kuniyu, pabeni, willemb, davem, kuba, horms
Cc: netdev, linux-kernel, XueBing Chen
- Remove spaces before commas in _sock_locks macro definition
- Use tabs instead of spaces for macro line continuation indentation
- Separate assignment from if condition in __sk_receive_skb function
- Fix pointer declaration format in timer functions
- Add spaces around == operator in preprocessor directive
These changes improve code style compliance with kernel coding standards
without affecting functionality.
Signed-off-by: XueBing Chen <chenxb_99091@126.com>
---
net/core/sock.c | 59 ++++++++++++++++++++++++++-----------------------
1 file changed, 31 insertions(+), 28 deletions(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index dc03d4b59..a5dbf6c07 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -223,23 +223,23 @@ static struct lock_class_key af_family_kern_slock_keys[AF_MAX];
*/
#define _sock_locks(x) \
- x "AF_UNSPEC", x "AF_UNIX" , x "AF_INET" , \
- x "AF_AX25" , x "AF_IPX" , x "AF_APPLETALK", \
- x "AF_NETROM", x "AF_BRIDGE" , x "AF_ATMPVC" , \
- x "AF_X25" , x "AF_INET6" , x "AF_ROSE" , \
- x "AF_DECnet", x "AF_NETBEUI" , x "AF_SECURITY" , \
- x "AF_KEY" , x "AF_NETLINK" , x "AF_PACKET" , \
- x "AF_ASH" , x "AF_ECONET" , x "AF_ATMSVC" , \
- x "AF_RDS" , x "AF_SNA" , x "AF_IRDA" , \
- x "AF_PPPOX" , x "AF_WANPIPE" , x "AF_LLC" , \
- x "27" , x "28" , x "AF_CAN" , \
- x "AF_TIPC" , x "AF_BLUETOOTH", x "IUCV" , \
- x "AF_RXRPC" , x "AF_ISDN" , x "AF_PHONET" , \
- x "AF_IEEE802154", x "AF_CAIF" , x "AF_ALG" , \
- x "AF_NFC" , x "AF_VSOCK" , x "AF_KCM" , \
- x "AF_QIPCRTR", x "AF_SMC" , x "AF_XDP" , \
- x "AF_MCTP" , \
- x "AF_MAX"
+ x "AF_UNSPEC", x "AF_UNIX", x "AF_INET", \
+ x "AF_AX25", x "AF_IPX", x "AF_APPLETALK", \
+ x "AF_NETROM", x "AF_BRIDGE", x "AF_ATMPVC", \
+ x "AF_X25", x "AF_INET6", x "AF_ROSE", \
+ x "AF_DECnet", x "AF_NETBEUI", x "AF_SECURITY", \
+ x "AF_KEY", x "AF_NETLINK", x "AF_PACKET", \
+ x "AF_ASH", x "AF_ECONET", x "AF_ATMSVC", \
+ x "AF_RDS", x "AF_SNA", x "AF_IRDA", \
+ x "AF_PPPOX", x "AF_WANPIPE", x "AF_LLC", \
+ x "27", x "28", x "AF_CAN", \
+ x "AF_TIPC", x "AF_BLUETOOTH", x "IUCV", \
+ x "AF_RXRPC", x "AF_ISDN", x "AF_PHONET", \
+ x "AF_IEEE802154", x "AF_CAIF", x "AF_ALG", \
+ x "AF_NFC", x "AF_VSOCK", x "AF_KCM", \
+ x "AF_QIPCRTR", x "AF_SMC", x "AF_XDP", \
+ x "AF_MCTP", \
+ x "AF_MAX"
static const char *const af_family_key_strings[AF_MAX+1] = {
_sock_locks("sk_lock-")
@@ -579,14 +579,17 @@ int __sk_receive_skb(struct sock *sk, struct sk_buff *skb,
rc = sk_backlog_rcv(sk, skb);
mutex_release(&sk->sk_lock.dep_map, _RET_IP_);
- } else if ((err = sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf)))) {
- bh_unlock_sock(sk);
- if (err == -ENOMEM)
- reason = SKB_DROP_REASON_PFMEMALLOC;
- if (err == -ENOBUFS)
- reason = SKB_DROP_REASON_SOCKET_BACKLOG;
- sk_drops_inc(sk);
- goto discard_and_relse;
+ } else {
+ err = sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf));
+ if (err) {
+ bh_unlock_sock(sk);
+ if (err == -ENOMEM)
+ reason = SKB_DROP_REASON_PFMEMALLOC;
+ if (err == -ENOBUFS)
+ reason = SKB_DROP_REASON_SOCKET_BACKLOG;
+ sk_drops_inc(sk);
+ goto discard_and_relse;
+ }
}
bh_unlock_sock(sk);
@@ -3611,7 +3614,7 @@ void sk_send_sigurg(struct sock *sk)
}
EXPORT_SYMBOL(sk_send_sigurg);
-void sk_reset_timer(struct sock *sk, struct timer_list* timer,
+void sk_reset_timer(struct sock *sk, struct timer_list *timer,
unsigned long expires)
{
if (!mod_timer(timer, expires))
@@ -3619,7 +3622,7 @@ void sk_reset_timer(struct sock *sk, struct timer_list* timer,
}
EXPORT_SYMBOL(sk_reset_timer);
-void sk_stop_timer(struct sock *sk, struct timer_list* timer)
+void sk_stop_timer(struct sock *sk, struct timer_list *timer)
{
if (timer_delete(timer))
__sock_put(sk);
@@ -3678,7 +3681,7 @@ void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid)
sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
sk->sk_stamp = SK_DEFAULT_STAMP;
-#if BITS_PER_LONG==32
+#if BITS_PER_LONG == 32
seqlock_init(&sk->sk_stamp_seq);
#endif
atomic_set(&sk->sk_zckey, 0);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net/core/sock: fix coding style issues Fix multiple coding style issues in net/core/sock.c:
2025-11-03 2:36 [PATCH] net/core/sock: fix coding style issues Fix multiple coding style issues in net/core/sock.c: XueBing Chen
@ 2025-11-04 1:26 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2025-11-04 1:26 UTC (permalink / raw)
To: XueBing Chen
Cc: edumazet, kuniyu, pabeni, willemb, davem, horms, netdev,
linux-kernel
On Mon, 3 Nov 2025 10:36:53 +0800 XueBing Chen wrote:
> - Remove spaces before commas in _sock_locks macro definition
> - Use tabs instead of spaces for macro line continuation indentation
> - Separate assignment from if condition in __sk_receive_skb function
> - Fix pointer declaration format in timer functions
> - Add spaces around == operator in preprocessor directive
>
> These changes improve code style compliance with kernel coding standards
> without affecting functionality.
Quoting documentation:
Clean-up patches
~~~~~~~~~~~~~~~~
Netdev discourages patches which perform simple clean-ups, which are not in
the context of other work. For example:
* Addressing ``checkpatch.pl``, and other trivial coding style warnings
* Addressing :ref:`Local variable ordering<rcs>` issues
* Conversions to device-managed APIs (``devm_`` helpers)
This is because it is felt that the churn that such changes produce comes
at a greater cost than the value of such clean-ups.
Conversely, spelling and grammar fixes are not discouraged.
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#clean-up-patches
--
pw-bot: reject
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-04 1:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-03 2:36 [PATCH] net/core/sock: fix coding style issues Fix multiple coding style issues in net/core/sock.c: XueBing Chen
2025-11-04 1:26 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).