public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Namhyung Kim <namhyung@gmail.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] [SCSI] sd: remove dead code
Date: Tue, 02 Aug 2011 11:29:31 -0500	[thread overview]
Message-ID: <1312302571.11352.10.camel@mulgrave> (raw)
In-Reply-To: <1312257053-2522-2-git-send-email-namhyung@gmail.com>

On Tue, 2011-08-02 at 12:50 +0900, Namhyung Kim wrote:
> As rq_data_dir() only checks a single bit (REQ_WRITE), the result
> can not be anything but READ or WRITE. Thus last ELSE clause is
> not needed at all.

This isn't really dead code, it's future proofing.  Block can handle
bidirectional commands.  It's true that currently the rq_data_dir()
macro is wrong for them.  However, if anyone decided to fix it, we'd
need the check.

James


> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
>  drivers/scsi/sd.c |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 463a324835f4..fbb522add124 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -760,12 +760,9 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
>  		    sd_dif_prepare(rq, block, sdp->sector_size) == -EIO)
>  			goto out;
>  
> -	} else if (rq_data_dir(rq) == READ) {
> +	} else { /* READ */
>  		SCpnt->cmnd[0] = READ_6;
>  		SCpnt->sc_data_direction = DMA_FROM_DEVICE;
> -	} else {
> -		scmd_printk(KERN_ERR, SCpnt, "Unknown command %x\n", rq->cmd_flags);
> -		goto out;
>  	}
>  
>  	SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,



  reply	other threads:[~2011-08-02 16:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02  3:50 [PATCH 1/3] [SCSI] sd: consolidate sector size alignment check in sd_pref_fn Namhyung Kim
2011-08-02  3:50 ` [PATCH 2/3] [SCSI] sd: remove dead code Namhyung Kim
2011-08-02 16:29   ` James Bottomley [this message]
2011-08-02  3:50 ` [PATCH 3/3] [SCSI] sd: update kernel doc comments Namhyung Kim
2011-08-02 16:29 ` [PATCH 1/3] [SCSI] sd: consolidate sector size alignment check in sd_pref_fn James Bottomley
2011-08-03  1:03   ` [PATCH v2] [SCSI] sd: consolidate sector size alignment check in sd_prep_fn Namhyung Kim

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=1312302571.11352.10.camel@mulgrave \
    --to=james.bottomley@hansenpartnership.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=namhyung@gmail.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