All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xie Yongji <xieyongji@bytedance.com>
To: mst@redhat.com, jasowang@redhat.com, stefanha@redhat.com
Cc: amit@kernel.org, arei.gonglei@huawei.com, airlied@linux.ie,
	kraxel@redhat.com, dan.j.williams@intel.com,
	johannes@sipsolutions.net, ohad@wizery.com,
	bjorn.andersson@linaro.org, david@redhat.com, vgoyal@redhat.com,
	miklos@szeredi.hu, sgarzare@redhat.com,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: [RFC PATCH 03/17] virtio_console: Remove unused used length
Date: Mon, 17 May 2021 17:08:22 +0800	[thread overview]
Message-ID: <20210517090836.533-4-xieyongji@bytedance.com> (raw)
In-Reply-To: <20210517090836.533-1-xieyongji@bytedance.com>

The used length is not used in some cases. Let's drop it
and pass NULL to virtqueue_get_buf() instead.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
---
 drivers/char/virtio_console.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 1836cc56e357..b85abe1eb2d1 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -549,7 +549,6 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id,
 {
 	struct scatterlist sg[1];
 	struct virtqueue *vq;
-	unsigned int len;
 
 	if (!use_multiport(portdev))
 		return 0;
@@ -566,7 +565,7 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id,
 
 	if (virtqueue_add_outbuf(vq, sg, 1, &portdev->cpkt, GFP_ATOMIC) == 0) {
 		virtqueue_kick(vq);
-		while (!virtqueue_get_buf(vq, &len)
+		while (!virtqueue_get_buf(vq, NULL)
 			&& !virtqueue_is_broken(vq))
 			cpu_relax();
 	}
@@ -589,13 +588,12 @@ static ssize_t send_control_msg(struct port *port, unsigned int event,
 static void reclaim_consumed_buffers(struct port *port)
 {
 	struct port_buffer *buf;
-	unsigned int len;
 
 	if (!port->portdev) {
 		/* Device has been unplugged.  vqs are already gone. */
 		return;
 	}
-	while ((buf = virtqueue_get_buf(port->out_vq, &len))) {
+	while ((buf = virtqueue_get_buf(port->out_vq, NULL))) {
 		free_buf(buf, false);
 		port->outvq_full = false;
 	}
@@ -608,7 +606,6 @@ static ssize_t __send_to_port(struct port *port, struct scatterlist *sg,
 	struct virtqueue *out_vq;
 	int err;
 	unsigned long flags;
-	unsigned int len;
 
 	out_vq = port->out_vq;
 
@@ -641,7 +638,7 @@ static ssize_t __send_to_port(struct port *port, struct scatterlist *sg,
 	 * we need to kmalloc a GFP_ATOMIC buffer each time the
 	 * console driver writes something out.
 	 */
-	while (!virtqueue_get_buf(out_vq, &len)
+	while (!virtqueue_get_buf(out_vq, NULL)
 		&& !virtqueue_is_broken(out_vq))
 		cpu_relax();
 done:
@@ -1730,9 +1727,8 @@ static void control_work_handler(struct work_struct *work)
 static void flush_bufs(struct virtqueue *vq, bool can_sleep)
 {
 	struct port_buffer *buf;
-	unsigned int len;
 
-	while ((buf = virtqueue_get_buf(vq, &len)))
+	while ((buf = virtqueue_get_buf(vq, NULL)))
 		free_buf(buf, can_sleep);
 }
 
-- 
2.11.0


  parent reply	other threads:[~2021-05-17  9:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17  9:08 [RFC PATCH 00/17] Add validation for used length Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 01/17] virtio_ring: Avoid reading unneeded " Xie Yongji
2021-05-17  9:11   ` Johannes Berg
2021-05-17  9:11     ` Johannes Berg
2021-05-17  9:41     ` Yongji Xie
2021-05-17  9:08 ` [RFC PATCH 02/17] virtio-blk: Remove unused " Xie Yongji
2021-05-17  9:08 ` Xie Yongji [this message]
2021-05-17  9:08 ` [RFC PATCH 04/17] crypto: virtio - " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 05/17] drm/virtio: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 06/17] caif_virtio: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 07/17] virtio_net: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 08/17] mac80211_hwsim: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 09/17] virtio_pmem: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 10/17] rpmsg: virtio: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 11/17] virtio_scsi: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 12/17] virtio_balloon: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 13/17] virtio_input: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 14/17] virtio_mem: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 15/17] virtiofs: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 16/17] vsock: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 17/17] virtio_ring: Add validation for " Xie Yongji
2021-05-17 23:39   ` Michael S. Tsirkin
2021-05-17 23:39     ` Michael S. Tsirkin
2021-05-25  1:31     ` Jason Wang
2021-05-25  1:31       ` Jason Wang
2021-05-25  5:08       ` Yongji Xie
2021-05-17 23:40 ` [RFC PATCH 00/17] " Michael S. Tsirkin
2021-05-17 23:40   ` Michael S. Tsirkin
2021-05-18  8:29   ` Yongji Xie
2021-05-18  9:52     ` Michael S. Tsirkin
2021-05-18  9:52       ` Michael S. Tsirkin
2021-05-18 12:28       ` Yongji Xie

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=20210517090836.533-4-xieyongji@bytedance.com \
    --to=xieyongji@bytedance.com \
    --cc=airlied@linux.ie \
    --cc=amit@kernel.org \
    --cc=arei.gonglei@huawei.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=johannes@sipsolutions.net \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=mst@redhat.com \
    --cc=ohad@wizery.com \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=vgoyal@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.