[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211019082211.ngkkkxlfcrsvfaxg@vireshk-i7>
Date: Tue, 19 Oct 2021 13:52:11 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Vincent Whitchurch <vincent.whitchurch@...s.com>
Cc: wsa@...nel.org, jie.deng@...el.com,
virtualization@...ts.linux-foundation.org,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel@...s.com
Subject: Re: [PATCH 2/2] i2c: virtio: fix completion handling
On 19-10-21, 09:46, Vincent Whitchurch wrote:
> static void virtio_i2c_msg_done(struct virtqueue *vq)
> {
> - struct virtio_i2c *vi = vq->vdev->priv;
> + struct virtio_i2c_req *req;
> + unsigned int len;
>
> - complete(&vi->completion);
> + while ((req = virtqueue_get_buf(vq, &len)))
> + complete(&req->completion);
Instead of adding a completion for each request and using only the
last one, maybe we can do this instead here:
while ((req = virtqueue_get_buf(vq, &len))) {
if (req->out_hdr.flags == cpu_to_le32(VIRTIO_I2C_FLAGS_FAIL_NEXT))
complete(&vi->completion);
}
Since we already know which is the last one, we can also check at this
point if buffers for all other requests are received or not.
--
viresh
Powered by blists - more mailing lists