mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
virtio_console: drop unused config fields
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> Reviewed-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
c60923cb9c
commit
7328fa64aa
1 changed files with 7 additions and 7 deletions
|
@ -152,8 +152,8 @@ struct ports_device {
|
||||||
spinlock_t c_ivq_lock;
|
spinlock_t c_ivq_lock;
|
||||||
spinlock_t c_ovq_lock;
|
spinlock_t c_ovq_lock;
|
||||||
|
|
||||||
/* The current config space is stored here */
|
/* max. number of ports this device can hold */
|
||||||
struct virtio_console_config config;
|
u32 max_nr_ports;
|
||||||
|
|
||||||
/* The virtio device we're associated with */
|
/* The virtio device we're associated with */
|
||||||
struct virtio_device *vdev;
|
struct virtio_device *vdev;
|
||||||
|
@ -1649,11 +1649,11 @@ static void handle_control_message(struct virtio_device *vdev,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (virtio32_to_cpu(vdev, cpkt->id) >=
|
if (virtio32_to_cpu(vdev, cpkt->id) >=
|
||||||
portdev->config.max_nr_ports) {
|
portdev->max_nr_ports) {
|
||||||
dev_warn(&portdev->vdev->dev,
|
dev_warn(&portdev->vdev->dev,
|
||||||
"Request for adding port with "
|
"Request for adding port with "
|
||||||
"out-of-bound id %u, max. supported id: %u\n",
|
"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;
|
break;
|
||||||
}
|
}
|
||||||
add_port(portdev, virtio32_to_cpu(vdev, cpkt->id));
|
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;
|
u32 i, j, nr_ports, nr_queues;
|
||||||
int err;
|
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;
|
nr_queues = use_multiport(portdev) ? (nr_ports + 1) * 2 : 2;
|
||||||
|
|
||||||
vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL);
|
vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL);
|
||||||
|
@ -2047,13 +2047,13 @@ static int virtcons_probe(struct virtio_device *vdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
multiport = false;
|
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! */
|
/* Don't test MULTIPORT at all if we're rproc: not a valid feature! */
|
||||||
if (!is_rproc_serial(vdev) &&
|
if (!is_rproc_serial(vdev) &&
|
||||||
virtio_cread_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT,
|
virtio_cread_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT,
|
||||||
struct virtio_console_config, max_nr_ports,
|
struct virtio_console_config, max_nr_ports,
|
||||||
&portdev->config.max_nr_ports) == 0) {
|
&portdev->max_nr_ports) == 0) {
|
||||||
multiport = true;
|
multiport = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue