Skip to contentSkip to conversation

net: Use str_yes_no() helper function

PATCH In review Thorsten Blum 2 participants 2 messages Oct 26, 2024 – Oct 28, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: Use str_yes_no() helper function

Remove hard-coded strings by using the str_yes_no() helper function.

---
Changes in v2:
- Use str_yes_no() instead of str_no_yes() as suggested by Willem de Bruijn
- Link to v1: https://lore.kernel.org/r/[email protected]/

---
 net/core/sock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/sock.c +2 -2
index 039be95c40cf..f753f87d0715 100644
@@ -4140,7 +4140,7 @@ static long sock_prot_memory_allocated(struct proto *proto)
 static const char *sock_prot_memory_pressure(struct proto *proto)
 {
 	return proto->memory_pressure != NULL ?
-	proto_memory_pressure(proto) ? "yes" : "no" : "NI";
+		str_yes_no(proto_memory_pressure(proto)) : "NI";
 }
 
 static void proto_seq_printf(struct seq_file *seq, struct proto *proto)
@@ -4154,7 +4154,7 @@ static void proto_seq_printf(struct seq_file *seq, struct proto *proto)
 		   sock_prot_memory_allocated(proto),
 		   sock_prot_memory_pressure(proto),
 		   proto->max_header,
-		   proto->slab == NULL ? "no" : "yes",
+		   str_yes_no(proto->slab),
 		   module_name(proto->owner),
 		   proto_method_implemented(proto->close),
 		   proto_method_implemented(proto->connect),
Signature · 1 line
2.47.0
maintainer
#1 lore raw
Quoted 1 line · On Sat, 26 Oct 2024 17:28:46 +0200 Thorsten Blum wrote:

Remove hard-coded strings by using the str_yes_no() helper function.

Same answer as for:
net: sched: etf: Use str_on_off() helper function in etf_init()
Use of the common string helpers is subjective.
Please try to avoid targeting networking with such cleanups.

Signature · 1 line
pw-bot: reject