From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753350AbcLGENx (ORCPT ); Tue, 6 Dec 2016 23:13:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49696 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751396AbcLGENv (ORCPT ); Tue, 6 Dec 2016 23:13:51 -0500 Subject: Re: [PATCH 01/10] virtio_console: drop unused config fields To: "Michael S. Tsirkin" , linux-kernel@vger.kernel.org References: <1481038106-24899-1-git-send-email-mst@redhat.com> <1481038106-24899-2-git-send-email-mst@redhat.com> Cc: Arnd Bergmann , Greg Kroah-Hartman , Amit Shah , virtualization@lists.linux-foundation.org From: Jason Wang Message-ID: Date: Wed, 7 Dec 2016 12:12:49 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1481038106-24899-2-git-send-email-mst@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 07 Dec 2016 04:12:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016年12月06日 23:40, Michael S. Tsirkin wrote: > 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 > --- > drivers/char/virtio_console.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) Reviewed-by: Jason Wang > > 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; > } >