From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbsSj-0005bC-U6 for qemu-devel@nongnu.org; Wed, 29 Jun 2011 06:57:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QbsSi-0004Ag-DC for qemu-devel@nongnu.org; Wed, 29 Jun 2011 06:57:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37243) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QbsSh-0004AY-Ve for qemu-devel@nongnu.org; Wed, 29 Jun 2011 06:57:40 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5TAvdSB000946 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 29 Jun 2011 06:57:39 -0400 Message-ID: <4E0B0520.7040303@redhat.com> Date: Wed, 29 Jun 2011 12:57:36 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <1308943978-6152-1-git-send-email-hdegoede@redhat.com> <1308943978-6152-11-git-send-email-hdegoede@redhat.com> In-Reply-To: <1308943978-6152-11-git-send-email-hdegoede@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 10/11] usb-uhci: Add support for being a companion controller List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hans de Goede Cc: qemu-devel@nongnu.org Hi, > + if (s->masterbus) { > + USBPort *ports[NB_PORTS]; > + for(i = 0; i< NB_PORTS; i++) { > + s->ports[i].port.ops =&uhci_port_ops; > + s->ports[i].port.opaque = s; > + s->ports[i].port.index = i; > + s->ports[i].port.speedmask = > + USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL; > + usb_port_location(&s->ports[i].port, NULL, i+1); > + ports[i] =&s->ports[i].port; > + } > + if (usb_bus_register_companion(s->masterbus, ports, NB_PORTS, > + s->firstport) != 0) { > + return -1; > + } > + } else { > + usb_bus_new(&s->bus,&uhci_bus_ops,&s->dev.qdev); > + for(i = 0; i< NB_PORTS; i++) { > + usb_register_port(&s->bus,&s->ports[i].port, s, i,&uhci_port_ops, > + USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL); > + usb_port_location(&s->ports[i].port, NULL, i+1); > + } This looks like we'll want a usb_register_companion_port() function which looks like usb_register_port() but accepts masterbus & portindex instead of a USBBus pointer. Then register the companion ports one by one, so that the code path for the companion case looks almost identical to the non-companion case. Otherwise the whole patchset looks very good. cheers, Gerd