public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Nick Spooner <nicholas.spooner@seagate.com>,
	James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi: sd: Use string_choices to fix Coccinelle warnings
Date: Thu, 23 Apr 2026 16:55:47 -0700	[thread overview]
Message-ID: <2334cec9-c80f-4fe5-a2e9-e35d4dfddbba@acm.org> (raw)
In-Reply-To: <20260423211644.3481898-1-nicholas.spooner@seagate.com>

On 4/23/26 2:16 PM, Nick Spooner wrote:
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index adc3fa55ca2c..dd284647ed64 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -50,6 +50,7 @@
>   #include <linux/rw_hint.h>
>   #include <linux/major.h>
>   #include <linux/mutex.h>
> +#include <linux/string_choices.h>
>   #include <linux/string_helpers.h>
>   #include <linux/slab.h>
>   #include <linux/sed-opal.h>
> @@ -3084,7 +3085,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)
>   		set_disk_ro(sdkp->disk, sdkp->write_prot);
>   		if (sdkp->first_scan || old_wp != sdkp->write_prot) {
>   			sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n",
> -				  sdkp->write_prot ? "on" : "off");
> +				  str_on_off(sdkp->write_prot));
>   			sd_printk(KERN_DEBUG, sdkp, "Mode Sense: %4ph\n", buffer);
>   		}
>   	}
> @@ -3235,8 +3236,8 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer)
>   		    old_rcd != sdkp->RCD || old_dpofua != sdkp->DPOFUA)
>   			sd_printk(KERN_NOTICE, sdkp,
>   				  "Write cache: %s, read cache: %s, %s\n",
> -				  sdkp->WCE ? "enabled" : "disabled",
> -				  sdkp->RCD ? "disabled" : "enabled",
> +				  str_enabled_disabled(sdkp->WCE),
> +				  str_disabled_enabled(sdkp->RCD),
>   				  sdkp->DPOFUA ? "supports DPO and FUA"
>   				  : "doesn't support DPO or FUA");

My opinion is that the sd code is easier to read *without* this patch. 
But that's just my opinion. Maybe there are other opinions.

Bart.



  reply	other threads:[~2026-04-23 23:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 21:16 [PATCH] scsi: sd: Use string_choices to fix Coccinelle warnings Nick Spooner
2026-04-23 23:55 ` Bart Van Assche [this message]
2026-04-27  1:35   ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2334cec9-c80f-4fe5-a2e9-e35d4dfddbba@acm.org \
    --to=bvanassche@acm.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nicholas.spooner@seagate.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox