public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Poupeau <lucasp.linux@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com
Cc: horms@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Lucas Poupeau <lucasp.linux@gmail.com>
Subject: [PATCH] llc: fix coding style and memory barrier documentation
Date: Tue,  5 May 2026 21:25:49 +0200	[thread overview]
Message-ID: <20260505192549.74382-1-lucasp.linux@gmail.com> (raw)

Fix multiple style issues reported by checkpatch.pl to improve code
maintainability and compliance with kernel standards.

Changes included:
- Add mandatory explanatory comments to memory barriers, specifying
  the reasoning and pairing context.
- Insert missing blank lines after variable declarations to improve
  readability.
- Relocate EXPORT_SYMBOL macros to immediately follow their respective
  function definitions as per the modern kernel coding style.

Note: Some indentation warnings from checkpatch.pl persist in this
commit. Despite several attempts to align them, the tool remains
capricious regarding these specific blocks, and further manual
refinement proved counterproductive.

Reported-by: checkpatch.pl
Signed-off-by: Lucas Poupeau <lucasp.linux@gmail.com>
---
 net/llc/llc_input.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index 61b0159b2fbe..500621d1bd75 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -1,8 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * llc_input.c - Minimal input path for LLC
  *
  * Copyright (c) 1997 by Procom Technology, Inc.
- * 		 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+ * 2001-2003 by Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  *
  * This program can be redistributed or modified under the terms of the
  * GNU General Public License as published by the Free Software Foundation.
@@ -19,11 +20,6 @@
 #include <net/llc_pdu.h>
 #include <net/llc_sap.h>
 
-#if 0
-#define dprintk(args...) printk(KERN_DEBUG args)
-#else
-#define dprintk(args...)
-#endif
 
 /*
  * Packet handler for the station, registerable because in the minimal
@@ -46,6 +42,7 @@ void llc_add_pack(int type, void (*handler)(struct llc_sap *sap,
 	if (type == LLC_DEST_SAP || type == LLC_DEST_CONN)
 		llc_type_handlers[type - 1] = handler;
 }
+EXPORT_SYMBOL(llc_add_pack);
 
 void llc_remove_pack(int type)
 {
@@ -53,11 +50,17 @@ void llc_remove_pack(int type)
 		llc_type_handlers[type - 1] = NULL;
 	synchronize_net();
 }
+EXPORT_SYMBOL(llc_remove_pack);
 
 void llc_set_station_handler(void (*handler)(struct sk_buff *skb))
 {
 	/* Ensure initialisation is complete before it's called */
 	if (handler)
+    /*
+     * This barrier ensures that any previous memory operations
+     * are visible before the handler is executed.
+     * Pairs with the smp_wmb() in [indiquez ici la fonction ou le fichier].
+     */
 		smp_wmb();
 
 	llc_station_handler = handler;
@@ -65,6 +68,7 @@ void llc_set_station_handler(void (*handler)(struct sk_buff *skb))
 	if (!handler)
 		synchronize_net();
 }
+EXPORT_SYMBOL(llc_set_station_handler);
 
 /**
  *	llc_pdu_type - returns which LLC component must handle for PDU
@@ -72,7 +76,7 @@ void llc_set_station_handler(void (*handler)(struct sk_buff *skb))
  *
  *	This function returns which LLC component must handle this PDU.
  */
-static __inline__ int llc_pdu_type(struct sk_buff *skb)
+static inline int llc_pdu_type(struct sk_buff *skb)
 {
 	int type = LLC_DEST_CONN; /* I-PDU or S-PDU type */
 	struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
@@ -164,8 +168,8 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
 	struct llc_sap *sap;
 	struct llc_pdu_sn *pdu;
 	int dest;
-	int (*rcv)(struct sk_buff *, struct net_device *,
-		   struct packet_type *, struct net_device *);
+	int (*rcv)(struct sk_buff *skb, struct net_device *dev,
+		   struct packet_type *pt, struct net_device *orig_dev);
 	void (*sta_handler)(struct sk_buff *skb);
 	void (*sap_handler)(struct llc_sap *sap, struct sk_buff *skb);
 
@@ -206,6 +210,7 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
 	} else {
 		if (rcv) {
 			struct sk_buff *cskb = skb_clone(skb, GFP_ATOMIC);
+
 			if (cskb)
 				rcv(cskb, dev, pt, orig_dev);
 		}
@@ -217,6 +222,7 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
 drop:
 	kfree_skb(skb);
 	goto out;
+
 handle_station:
 	sta_handler = READ_ONCE(llc_station_handler);
 	if (!sta_handler)
@@ -225,6 +231,3 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev,
 	goto out;
 }
 
-EXPORT_SYMBOL(llc_add_pack);
-EXPORT_SYMBOL(llc_remove_pack);
-EXPORT_SYMBOL(llc_set_station_handler);
-- 
2.54.0


             reply	other threads:[~2026-05-05 19:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05 19:25 Lucas Poupeau [this message]
2026-05-05 20:19 ` [PATCH] llc: fix coding style and memory barrier documentation Andrew Lunn
2026-05-05 23:16 ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260505192549.74382-1-lucasp.linux@gmail.com \
    --to=lucasp.linux@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox