batman-adv: Use string choice helper to print booleans

The commit ea4692c75e ("lib/string_helpers: Consolidate string helpers
implementation") introduced common helpers to print string representations
of boolean helpers. These are supposed to be used instead of open coded
versions.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
This commit is contained in:
Sven Eckelmann 2024-10-06 19:00:01 +02:00 committed by Simon Wunderlich
parent 4436df4788
commit 5c956d11cf
2 changed files with 6 additions and 6 deletions

View File

@ -36,6 +36,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/string_choices.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <net/genetlink.h> #include <net/genetlink.h>
@ -371,8 +372,7 @@ static void batadv_iv_ogm_send_to_if(struct batadv_forw_packet *forw_packet,
batadv_ogm_packet->orig, batadv_ogm_packet->orig,
ntohl(batadv_ogm_packet->seqno), ntohl(batadv_ogm_packet->seqno),
batadv_ogm_packet->tq, batadv_ogm_packet->ttl, batadv_ogm_packet->tq, batadv_ogm_packet->ttl,
((batadv_ogm_packet->flags & BATADV_DIRECTLINK) ? str_on_off(batadv_ogm_packet->flags & BATADV_DIRECTLINK),
"on" : "off"),
hard_iface->net_dev->name, hard_iface->net_dev->name,
hard_iface->net_dev->dev_addr); hard_iface->net_dev->dev_addr);

View File

@ -33,6 +33,7 @@
#include <linux/sprintf.h> #include <linux/sprintf.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/string_choices.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <net/arp.h> #include <net/arp.h>
#include <net/genetlink.h> #include <net/genetlink.h>
@ -1946,16 +1947,15 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
claim = batadv_claim_hash_find(bat_priv, &search_claim); claim = batadv_claim_hash_find(bat_priv, &search_claim);
if (!claim) { if (!claim) {
bool local = batadv_is_my_client(bat_priv, ethhdr->h_source, vid);
/* possible optimization: race for a claim */ /* possible optimization: race for a claim */
/* No claim exists yet, claim it for us! /* No claim exists yet, claim it for us!
*/ */
batadv_dbg(BATADV_DBG_BLA, bat_priv, batadv_dbg(BATADV_DBG_BLA, bat_priv,
"%s(): Unclaimed MAC %pM found. Claim it. Local: %s\n", "%s(): Unclaimed MAC %pM found. Claim it. Local: %s\n",
__func__, ethhdr->h_source, __func__, ethhdr->h_source, str_yes_no(local));
batadv_is_my_client(bat_priv,
ethhdr->h_source, vid) ?
"yes" : "no");
batadv_handle_claim(bat_priv, primary_if, batadv_handle_claim(bat_priv, primary_if,
primary_if->net_dev->dev_addr, primary_if->net_dev->dev_addr,
ethhdr->h_source, vid); ethhdr->h_source, vid);