The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] nvme: use str_enabled_disabled() for digest mismatch messages
@ 2026-05-04 12:35 Rohit Chavan
  2026-05-07  5:32 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Rohit Chavan @ 2026-05-04 12:35 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme, linux-kernel, Rohit Chavan

Replace open-coded ternary expressions with str_enabled_disabled()
when printing data and header digest mismatch messages in
nvme_tcp_init_connection().

This makes the code more readable and consistent with existing
helpers used for boolean string representation.

No functional change intended.

Signed-off-by: Rohit Chavan <roheetchavan@gmail.com>
---
 drivers/nvme/host/tcp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 243dab830dc8..b3165cd79a31 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -8,6 +8,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/err.h>
+#include <linux/string_choices.h>
 #include <linux/crc32.h>
 #include <linux/nvme-tcp.h>
 #include <linux/nvme-keyring.h>
@@ -1550,8 +1551,8 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue)
 	    (!queue->data_digest && ctrl_ddgst)) {
 		pr_err("queue %d: data digest mismatch host: %s ctrl: %s\n",
 			nvme_tcp_queue_id(queue),
-			queue->data_digest ? "enabled" : "disabled",
-			ctrl_ddgst ? "enabled" : "disabled");
+			str_enabled_disabled(queue->data_digest),
+			str_enabled_disabled(ctrl_ddgst));
 		goto free_icresp;
 	}
 
@@ -1560,8 +1561,8 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue)
 	    (!queue->hdr_digest && ctrl_hdgst)) {
 		pr_err("queue %d: header digest mismatch host: %s ctrl: %s\n",
 			nvme_tcp_queue_id(queue),
-			queue->hdr_digest ? "enabled" : "disabled",
-			ctrl_hdgst ? "enabled" : "disabled");
+			str_enabled_disabled(queue->hdr_digest),
+			str_enabled_disabled(ctrl_hdgst);
 		goto free_icresp;
 	}
 
-- 
2.34.1


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

* Re: [PATCH] nvme: use str_enabled_disabled() for digest mismatch messages
  2026-05-04 12:35 [PATCH] nvme: use str_enabled_disabled() for digest mismatch messages Rohit Chavan
@ 2026-05-07  5:32 ` Christoph Hellwig
  2026-05-08  9:47   ` Rohit Chavan
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2026-05-07  5:32 UTC (permalink / raw)
  To: Rohit Chavan; +Cc: kbusch, axboe, sagi, linux-nvme, linux-kernel

On Mon, May 04, 2026 at 06:05:55PM +0530, Rohit Chavan wrote:
>  		pr_err("queue %d: data digest mismatch host: %s ctrl: %s\n",
>  			nvme_tcp_queue_id(queue),
> -			queue->data_digest ? "enabled" : "disabled",
> -			ctrl_ddgst ? "enabled" : "disabled");
> +			str_enabled_disabled(queue->data_digest),
> +			str_enabled_disabled(ctrl_ddgst));

I can't really see how this is considered an improvement.


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

* Re: [PATCH] nvme: use str_enabled_disabled() for digest mismatch messages
  2026-05-07  5:32 ` Christoph Hellwig
@ 2026-05-08  9:47   ` Rohit Chavan
  2026-05-11  8:14     ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Rohit Chavan @ 2026-05-08  9:47 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: kbusch, axboe, sagi, linux-nvme, linux-kernel

Hi Christoph,

Thank you for the feedback.

My intent was to align the code with the standardized string helpers 
recently introduced in the kernel to reduce open-coding. However, 
I respect your preference for keeping the ternary form in the 
NVMe subsystem.

I will drop this patch.

Thanks,
Rohit

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

* Re: [PATCH] nvme: use str_enabled_disabled() for digest mismatch messages
  2026-05-08  9:47   ` Rohit Chavan
@ 2026-05-11  8:14     ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2026-05-11  8:14 UTC (permalink / raw)
  To: Rohit Chavan
  Cc: Christoph Hellwig, kbusch, axboe, sagi, linux-nvme, linux-kernel

On Fri, May 08, 2026 at 03:17:33PM +0530, Rohit Chavan wrote:
> Hi Christoph,
> 
> Thank you for the feedback.
> 
> My intent was to align the code with the standardized string helpers 
> recently introduced in the kernel to reduce open-coding. However, 
> I respect your preference for keeping the ternary form in the 
> NVMe subsystem.

I guess it's more of a question for the people adding the helpers, but it
should also be in any place converting to it:  what's the point?

The helpers don't reduce the code size, but increase cognitive load.  Not
a good trade-off as far as I can tell, but maybe I'm missing something?


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

end of thread, other threads:[~2026-05-11  8:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04 12:35 [PATCH] nvme: use str_enabled_disabled() for digest mismatch messages Rohit Chavan
2026-05-07  5:32 ` Christoph Hellwig
2026-05-08  9:47   ` Rohit Chavan
2026-05-11  8:14     ` Christoph Hellwig

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