public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: thuth@linux.vnet.ibm.com, linux-scsi@vger.kernel.org,
	rusty@au1.ibm.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	dahi@linux.vnet.ibm.com,
	"James E.J. Bottomley" <JBottomley@parallels.com>,
	pbonzini@redhat.com, David Miller <davem@davemloft.net>
Subject: Re: [PATCH v7 42/46] virtio_scsi: v1.0 support
Date: Mon, 1 Dec 2014 14:54:08 +0200	[thread overview]
Message-ID: <20141201125408.GA18135@redhat.com> (raw)
In-Reply-To: <20141201125305.GC18106@redhat.com>

On Mon, Dec 01, 2014 at 02:53:05PM +0200, Michael S. Tsirkin wrote:
> On Mon, Dec 01, 2014 at 01:50:01PM +0100, Cornelia Huck wrote:
> > On Sun, 30 Nov 2014 17:12:47 +0200
> > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > 
> > > Note: for consistency, and to avoid sparse errors,
> > >   convert all fields, even those no longer in use
> > >   for virtio v1.0.
> > > 
> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > Acked-by: Paolo Bonzini <pbonzini@redhat.com>
> > > ---
> > >  include/linux/virtio_scsi.h | 32 +++++++++++++++-------------
> > >  drivers/scsi/virtio_scsi.c  | 51 ++++++++++++++++++++++++++++-----------------
> > >  2 files changed, 49 insertions(+), 34 deletions(-)
> > > 
> > 
> > > @@ -196,10 +196,13 @@ static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf)
> > >  		break;
> > >  	}
> > > 
> > > -	WARN_ON(resp->sense_len > VIRTIO_SCSI_SENSE_SIZE);
> > > +	WARN_ON(virtio32_to_cpu(vscsi->vdev, resp->sense_len) >
> > > +		VIRTIO_SCSI_SENSE_SIZE);
> > 
> > Introduce a local variable for this? Might make this statement and the
> > min_t statement below easier to read.
> 
> I prefer 1:1 code conversions. We can do refactorings on top.
> Since you mention this line as hard to read, I'll just make it > 80
> chars for now, and trivial line splits can come later.
> OK?

Or maybe I'll keep it as is, since Paolo who wrote this code
is happy with it ..

> > >  	if (sc->sense_buffer) {
> > >  		memcpy(sc->sense_buffer, resp->sense,
> > > -		       min_t(u32, resp->sense_len, VIRTIO_SCSI_SENSE_SIZE));
> > > +		       min_t(u32,
> > > +			     virtio32_to_cpu(vscsi->vdev, resp->sense_len),
> > > +			     VIRTIO_SCSI_SENSE_SIZE));
> > >  		if (resp->sense_len)
> > >  			set_driver_byte(sc, DRIVER_SENSE);
> > >  	}
> > 
> > Otherwise looks good to me.

  reply	other threads:[~2014-12-01 12:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1417359787-10138-1-git-send-email-mst@redhat.com>
2014-11-30 15:12 ` [PATCH v7 42/46] virtio_scsi: v1.0 support Michael S. Tsirkin
2014-12-01 12:50   ` Cornelia Huck
2014-12-01 12:53     ` Michael S. Tsirkin
2014-12-01 12:54       ` Michael S. Tsirkin [this message]
2014-12-01 12:55       ` Cornelia Huck

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=20141201125408.GA18135@redhat.com \
    --to=mst@redhat.com \
    --cc=JBottomley@parallels.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dahi@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rusty@au1.ibm.com \
    --cc=thuth@linux.vnet.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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