public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: batman-adv: constify and move broadcast addr definition
@ 2025-04-08 15:53 Matthias Schiffer
  2025-04-09  8:10 ` Sven Eckelmann
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Schiffer @ 2025-04-08 15:53 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli,
	Sven Eckelmann
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, b.a.t.m.a.n, netdev, linux-kernel,
	Matthias Schiffer

The variable is used only once and is read-only. Make it a const local
variable.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
---
 net/batman-adv/main.c | 2 --
 net/batman-adv/main.h | 1 -
 net/batman-adv/send.c | 4 +++-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index a08132888a3d..e41f816f0887 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -69,8 +69,6 @@ unsigned int batadv_hardif_generation;
 static int (*batadv_rx_handler[256])(struct sk_buff *skb,
 				     struct batadv_hard_iface *recv_if);
 
-unsigned char batadv_broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-
 struct workqueue_struct *batadv_event_workqueue;
 
 static void batadv_recv_handler_init(void);
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index 67af435ee04e..bfe90a888af4 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -235,7 +235,6 @@ static inline int batadv_print_vid(unsigned short vid)
 extern struct list_head batadv_hardif_list;
 extern unsigned int batadv_hardif_generation;
 
-extern unsigned char batadv_broadcast_addr[];
 extern struct workqueue_struct *batadv_event_workqueue;
 
 int batadv_mesh_init(struct net_device *mesh_iface);
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index 735ac8077821..90356b622a48 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -124,7 +124,9 @@ int batadv_send_skb_packet(struct sk_buff *skb,
 int batadv_send_broadcast_skb(struct sk_buff *skb,
 			      struct batadv_hard_iface *hard_iface)
 {
-	return batadv_send_skb_packet(skb, hard_iface, batadv_broadcast_addr);
+	const u8 broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+	return batadv_send_skb_packet(skb, hard_iface, broadcast_addr);
 }
 
 /**
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: batman-adv: constify and move broadcast addr definition
  2025-04-08 15:53 [PATCH net-next] net: batman-adv: constify and move broadcast addr definition Matthias Schiffer
@ 2025-04-09  8:10 ` Sven Eckelmann
  2025-04-09 15:44   ` Matthias Schiffer
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Eckelmann @ 2025-04-09  8:10 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli,
	Matthias Schiffer
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, b.a.t.m.a.n, netdev, linux-kernel,
	Matthias Schiffer

[-- Attachment #1: Type: text/plain, Size: 243 bytes --]

On Tuesday, 8 April 2025 17:53:36 CEST Matthias Schiffer wrote:
> +       const u8 broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

Should most likely be "static const u8 ..."

(checkpatch STATIC_CONST_CHAR_ARRAY)

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: batman-adv: constify and move broadcast addr definition
  2025-04-09  8:10 ` Sven Eckelmann
@ 2025-04-09 15:44   ` Matthias Schiffer
  0 siblings, 0 replies; 3+ messages in thread
From: Matthias Schiffer @ 2025-04-09 15:44 UTC (permalink / raw)
  To: Sven Eckelmann, Marek Lindner, Simon Wunderlich,
	Antonio Quartulli
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, b.a.t.m.a.n, netdev, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 465 bytes --]

On 09/04/2025 10:10, Sven Eckelmann wrote:
> On Tuesday, 8 April 2025 17:53:36 CEST Matthias Schiffer wrote:
>> +       const u8 broadcast_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
> 
> Should most likely be "static const u8 ..."
> 
> (checkpatch STATIC_CONST_CHAR_ARRAY)
> 
> Kind regards,
> 	Sven

Thanks, will send a v2. The checkpatch check only looks for strings, not 
arrays defined with { }, so it didn't trigger for me.

Best,
Matthias

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-09 15:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 15:53 [PATCH net-next] net: batman-adv: constify and move broadcast addr definition Matthias Schiffer
2025-04-09  8:10 ` Sven Eckelmann
2025-04-09 15:44   ` Matthias Schiffer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox