[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210517090836.533-4-xieyongji@bytedance.com>
Date: Mon, 17 May 2021 17:08:22 +0800
From: Xie Yongji <xieyongji@...edance.com>
To: mst@...hat.com, jasowang@...hat.com, stefanha@...hat.com
Cc: amit@...nel.org, arei.gonglei@...wei.com, airlied@...ux.ie,
kraxel@...hat.com, dan.j.williams@...el.com,
johannes@...solutions.net, ohad@...ery.com,
bjorn.andersson@...aro.org, david@...hat.com, vgoyal@...hat.com,
miklos@...redi.hu, sgarzare@...hat.com,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH 03/17] virtio_console: Remove unused used length
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@...edance.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
Powered by blists - more mailing lists