From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D228A3D349D for ; Tue, 5 May 2026 19:25:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778009155; cv=none; b=ZW+o2xLAXjTUwezFyK9BR+ckbDvTSNJr1QIK1LbramAIiSlg586KeUQzodC/hO0rFvrEPUHEeh5aq8ubruXL0hiLWYCP3Yoi/+xPT5H+PjPXxAsfttwUJnY62YhwEkCV+obTmxrSrTTE75irQl/ndO2/T6DcbpjeLinSSzx9wHw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778009155; c=relaxed/simple; bh=unBc1izWQJseF9wJ3T2Q53dX1S/hGOrqtWiG9Y2//f8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QELY2unO8nSBYTDlg7tix6zHIdFPIvAZFM/I/wimmcSBsobgxcwIfBKk0/+FmkHG2cuZ5ugv7xzp/gEbfsJdP9r1pHpQuE8UE5CVvOcVq30XWdeCMyyPJRT+QJVA1Kx1rB5MAcIlAi3kTENJ2GRpjCL+jEqjqcAefD6oMNYsuQo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VSxGIkVY; arc=none smtp.client-ip=209.85.128.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VSxGIkVY" Received: by mail-wm1-f65.google.com with SMTP id 5b1f17b1804b1-48a525dd2b5so7109435e9.2 for ; Tue, 05 May 2026 12:25:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778009152; x=1778613952; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rw0vHPpNopaX1nqR86+8y1EaQp5vpOse0ZUubitLk/c=; b=VSxGIkVYHscls+Guqlo597A3cyPgniakbNFJwVtJEEr0C61hBoKfFG4LFFbUYfGkxA Oq9DY8NaXEEMmOrx/D95uWLrjdM+FDD/EDEIM+2n6UKZZ9ndalbWCua5P3MffYUBdmqT Ss9MziyOrHmKhz/HQ+8Ir1oyPwLY1QWw7RWkbqFcARBULa4OtR9G4oUc8o/m6nzmNUvG +ZPvI964SBOeg1ShMOGWCPZYovIIJl+QbUG2bnhCaw+DrFuuJnb+/6tJ/liuMRzS6GEX 21uMp2a8lPwPNSUTJofDtK5LOppSESm1WfPzsZ42V4gVEXLaoMIf9dYOSZjBrd04hTxJ bs1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778009152; x=1778613952; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rw0vHPpNopaX1nqR86+8y1EaQp5vpOse0ZUubitLk/c=; b=ch2NnR/eowM4bW4e598auG7LF2LSQd6Bpt3FFzssoCx7T7mABZxVEhANWEELIyLQOM 1GANu/3qqff0gtLdYcas3cMoVhhj8Wooa3pKDWjS0ULY2VTqKIBEKSnSHd3qN9lvlMaf pED+/gGX1LP6tqrHU2yYtB+Zr174PCPkmLGeda18a8VGrFyO3xisa1Wff8B348QzxVuD 0w5WL/DLGfunYd/TN602OgVccYAhk7aVdBOsP+/Oci1mv95S+7Q6k+gTcq1Er8SojBlU RV/WaZ+ip1ZVSeM6ZOmzz/Ka+Sdp1szhcyDZeSKQNvnVTwEqB3o0+VBIxKX0t6NWv1kM FVKw== X-Forwarded-Encrypted: i=1; AFNElJ/63HsLRVQGadAPL26GnUx5tqVrg/E7EswALKE6jXNMGyFZG8n0enD82HOTrJ8/evOsZSuJfSxejLKJ+M8=@vger.kernel.org X-Gm-Message-State: AOJu0YxDVZfyQ9+Lx8PI6xneR1x3xZ7ApECWBJsJDZI1SVaXegEiYqZF wBJFI0P7kA+u7aewb41HL+y/wyozCQbqlZqtOSQrgC5hDlnihiNqLKlL X-Gm-Gg: AeBDievdjw/YYEprI/JwxXuBiUTIi0wLN/LfIDpADyGoWUr3p26gV7d+cTTrYZWuMJx H2OlKoA6ju3KX/q9Yz5uvGxbo3sL1RHKbM2F9zQ3fN7kr2TBjAgyImRzmtlAJwri3tsVJQOWE/D 7LqQrg9PBu5/jnIcts6oBi2Rp8oDoOxd6zvkt+3jObD2x7e8oOmj3GhtUXcc8199xg4pER3R9dO TAUsTsW8Z0ypLR+63pB0yl0UgPnWdi5lEXZarNcTilWgJMx7tnbCm/C7d7S850J+MLL6hxQxYnW iOqO3NeozHA4L+5pGFw0mTvPwTTggN7mDnf6HcMS/WxxkgCPJfyWvemFZOP6IEKZBy4ji4n3MoM Sk0TbAevpZDy5Ug4aKkKliXBNjq/XmAxITM5CPUcaaF3ovX3qVRnVOs2Qiuzq9PlhgOXwZk0ewx doFpdTKn1KQUNwfFYqJ0Lk X-Received: by 2002:a05:600c:c494:b0:489:1c1f:35e5 with SMTP id 5b1f17b1804b1-48e51f395f6mr3696525e9.6.1778009151995; Tue, 05 May 2026 12:25:51 -0700 (PDT) Received: from lucas ([2a01:e0a:354:c290:234c:5dad:48b0:9188]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a81b99127sm408695405e9.0.2026.05.05.12.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 12:25:51 -0700 (PDT) From: Lucas Poupeau 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 Subject: [PATCH] llc: fix coding style and memory barrier documentation Date: Tue, 5 May 2026 21:25:49 +0200 Message-ID: <20260505192549.74382-1-lucasp.linux@gmail.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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 + * 2001-2003 by Arnaldo Carvalho de Melo * * 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 #include -#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