* [PATCH] llc: fix coding style and memory barrier documentation
@ 2026-05-05 19:25 Lucas Poupeau
2026-05-05 20:19 ` Andrew Lunn
2026-05-05 23:16 ` Jakub Kicinski
0 siblings, 2 replies; 3+ messages in thread
From: Lucas Poupeau @ 2026-05-05 19:25 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni; +Cc: horms, netdev, linux-kernel, Lucas Poupeau
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] llc: fix coding style and memory barrier documentation
2026-05-05 19:25 [PATCH] llc: fix coding style and memory barrier documentation Lucas Poupeau
@ 2026-05-05 20:19 ` Andrew Lunn
2026-05-05 23:16 ` Jakub Kicinski
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2026-05-05 20:19 UTC (permalink / raw)
To: Lucas Poupeau; +Cc: davem, edumazet, kuba, pabeni, horms, netdev, linux-kernel
On Tue, May 05, 2026 at 09:25:49PM +0200, Lucas Poupeau wrote:
> 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>
Please take a read of
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
The Subject line needs to indicate what tree it is for.
Please also break this patch up. One patch per type of fix. You are
aiming for patches which are obviously correct. Such patches are
generally small, and have good commit messages.
> -#if 0
> -#define dprintk(args...) printk(KERN_DEBUG args)
> -#else
> -#define dprintk(args...)
> -#endif
It is not obvious why this is correct. Is dprintk() not actually used
in this file? That would be something you would say in the commit
message.
> + /*
> + * 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].
> + */
Please do specify the function here. Otherwise the comment is useless.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] llc: fix coding style and memory barrier documentation
2026-05-05 19:25 [PATCH] llc: fix coding style and memory barrier documentation Lucas Poupeau
2026-05-05 20:19 ` Andrew Lunn
@ 2026-05-05 23:16 ` Jakub Kicinski
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2026-05-05 23:16 UTC (permalink / raw)
To: Lucas Poupeau; +Cc: davem, edumazet, pabeni, horms, netdev, linux-kernel
On Tue, 5 May 2026 21:25:49 +0200 Lucas Poupeau wrote:
> Fix multiple style issues reported by checkpatch.pl to improve code
> maintainability and compliance with kernel standards.
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-05 23:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 19:25 [PATCH] llc: fix coding style and memory barrier documentation Lucas Poupeau
2026-05-05 20:19 ` Andrew Lunn
2026-05-05 23:16 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox