virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Amit Shah <amit.shah@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	virtualization@lists.linux-foundation.org
Subject: [PATCH 01/10] virtio_console: drop unused config fields
Date: Tue, 6 Dec 2016 17:40:32 +0200	[thread overview]
Message-ID: <1481038106-24899-2-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1481038106-24899-1-git-send-email-mst@redhat.com>

struct ports_device includes a config field including the whole
virtio_console_config, but only max_nr_ports in there is ever updated or
used. The rest is unused and in fact does not even mirror the
device config. Drop everything except max_nr_ports,
saving some memory.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/char/virtio_console.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 5649234..8b00e79 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -152,8 +152,8 @@ struct ports_device {
 	spinlock_t c_ivq_lock;
 	spinlock_t c_ovq_lock;
 
-	/* The current config space is stored here */
-	struct virtio_console_config config;
+	/* max. number of ports this device can hold */
+	u32 max_nr_ports;
 
 	/* The virtio device we're associated with */
 	struct virtio_device *vdev;
@@ -1649,11 +1649,11 @@ static void handle_control_message(struct virtio_device *vdev,
 			break;
 		}
 		if (virtio32_to_cpu(vdev, cpkt->id) >=
-		    portdev->config.max_nr_ports) {
+		    portdev->max_nr_ports) {
 			dev_warn(&portdev->vdev->dev,
 				"Request for adding port with "
 				"out-of-bound id %u, max. supported id: %u\n",
-				cpkt->id, portdev->config.max_nr_ports - 1);
+				cpkt->id, portdev->max_nr_ports - 1);
 			break;
 		}
 		add_port(portdev, virtio32_to_cpu(vdev, cpkt->id));
@@ -1894,7 +1894,7 @@ static int init_vqs(struct ports_device *portdev)
 	u32 i, j, nr_ports, nr_queues;
 	int err;
 
-	nr_ports = portdev->config.max_nr_ports;
+	nr_ports = portdev->max_nr_ports;
 	nr_queues = use_multiport(portdev) ? (nr_ports + 1) * 2 : 2;
 
 	vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL);
@@ -2047,13 +2047,13 @@ static int virtcons_probe(struct virtio_device *vdev)
 	}
 
 	multiport = false;
-	portdev->config.max_nr_ports = 1;
+	portdev->max_nr_ports = 1;
 
 	/* Don't test MULTIPORT at all if we're rproc: not a valid feature! */
 	if (!is_rproc_serial(vdev) &&
 	    virtio_cread_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT,
 				 struct virtio_console_config, max_nr_ports,
-				 &portdev->config.max_nr_ports) == 0) {
+				 &portdev->max_nr_ports) == 0) {
 		multiport = true;
 	}
 
-- 
MST

  reply	other threads:[~2016-12-06 15:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-06 15:40 [PATCH 00/10] virtio: sparse fixes Michael S. Tsirkin
2016-12-06 15:40 ` Michael S. Tsirkin [this message]
2016-12-07  4:12   ` [PATCH 01/10] virtio_console: drop unused config fields Jason Wang
2016-12-06 15:40 ` [PATCH 02/10] drm/virtio: fix endianness in primary_plane_update Michael S. Tsirkin
2016-12-06 15:40 ` [PATCH 03/10] drm/virtio: fix lock context imbalance Michael S. Tsirkin
2016-12-06 15:40 ` [PATCH 04/10] drm/virtio: annotate virtio_gpu_queue_ctrl_buffer_locked Michael S. Tsirkin
2016-12-06 15:40 ` [PATCH 05/10] vhost: make interval tree static inline Michael S. Tsirkin
2016-12-07  4:16   ` Jason Wang
2016-12-06 15:40 ` [PATCH 06/10] vhost: add missing __user annotations Michael S. Tsirkin
2016-12-06 15:40 ` [PATCH 07/10] vsock/virtio: add a missing __le annotation Michael S. Tsirkin
2016-12-07  4:19   ` Jason Wang
2016-12-07 14:09   ` Stefan Hajnoczi
2016-12-06 15:41 ` [PATCH 08/10] vsock/virtio: mark an internal function static Michael S. Tsirkin
2016-12-06 15:41 ` [PATCH 09/10] vsock/virtio: fix src/dst cid format Michael S. Tsirkin
2016-12-06 15:41 ` [PATCH 10/10] virtio: enable endian checks for sparse builds Michael S. Tsirkin
     [not found] ` <1481038106-24899-3-git-send-email-mst@redhat.com>
2016-12-07  4:13   ` [PATCH 02/10] drm/virtio: fix endianness in primary_plane_update Jason Wang
     [not found] ` <1481038106-24899-4-git-send-email-mst@redhat.com>
2016-12-07  4:13   ` [PATCH 03/10] drm/virtio: fix lock context imbalance Jason Wang
     [not found] ` <1481038106-24899-5-git-send-email-mst@redhat.com>
2016-12-07  4:15   ` [PATCH 04/10] drm/virtio: annotate virtio_gpu_queue_ctrl_buffer_locked Jason Wang
     [not found] ` <1481038106-24899-7-git-send-email-mst@redhat.com>
2016-12-07  4:17   ` [PATCH 06/10] vhost: add missing __user annotations Jason Wang
     [not found] ` <1481038106-24899-9-git-send-email-mst@redhat.com>
2016-12-07  4:21   ` [PATCH 08/10] vsock/virtio: mark an internal function static Jason Wang
2016-12-08 14:25     ` Michael S. Tsirkin
2016-12-12  1:56       ` Jason Wang
2016-12-07 14:09   ` Stefan Hajnoczi
     [not found] ` <1481038106-24899-10-git-send-email-mst@redhat.com>
2016-12-07  4:31   ` [PATCH 09/10] vsock/virtio: fix src/dst cid format Jason Wang
2016-12-07 14:09   ` Stefan Hajnoczi
     [not found]   ` <a0dcb733-ab1c-ac66-2300-fcb90fbacea2@redhat.com>
2016-12-11  2:54     ` Michael S. Tsirkin
     [not found] ` <1481038106-24899-11-git-send-email-mst@redhat.com>
2016-12-07  5:27   ` [PATCH 10/10] virtio: enable endian checks for sparse builds Jason Wang
2016-12-07  6:25   ` Johannes Berg
2016-12-07 13:22     ` Michael S. Tsirkin
2016-12-07  7:30   ` Christoph Hellwig
2016-12-07 14:09   ` Stefan Hajnoczi

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=1481038106-24899-2-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).