Subject: Re: [PATCH 09/28] virtio: console: struct ports for multiple ports per device.

From: Rusty Russell <[email-masked]>
Date: Mon, 30 Nov 2009 12:39:52 +1030

On Sat, 28 Nov 2009 05:20:32 pm Amit Shah wrote:
> @@ -196,7 +216,9 @@ static void virtcons_apply_config(struct virtio_device *dev)
>  		dev->config->get(dev,
>  				 offsetof(struct virtio_console_config, rows),
>  				 &ws.ws_row, sizeof(u16));
> -		hvc_resize(port->hvc, ws);
> +		/* This is the pre-multiport style: we use control messages
> +		 * these days which specify the port.  So this means port 0. */
> +		hvc_resize(find_port_by_vtermno(0)->hvc, ws);
>  	}

We end up doing this in a couple of places; perhaps we should have something
like:
	/*
	 * Before multiple console support, we always had a single console.
	 * Code paths without those features can use this.
	 */
	static struct port *old_style_unique_console(void)
	{
		return find_port_by_vtermno(0);
	}

>  	err = -ENOMEM;
> -	port = add_port(pdrvdata.next_vtermno);
> +	port = kzalloc(sizeof *port, GFP_KERNEL);
>  	if (!port)
>  		goto fail;

I still dislike kzalloc.  I think I've said this before :)

Thanks,
Rusty.