Received: from [140.186.70.92] (port=48786 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORLZz-0007YN-CA for qemu-devel@nongnu.org; Wed, 23 Jun 2010 04:45:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ORLZt-0008Qz-Pv for qemu-devel@nongnu.org; Wed, 23 Jun 2010 04:45:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22566) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORLZt-0008QC-JJ for qemu-devel@nongnu.org; Wed, 23 Jun 2010 04:45:01 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH v4 01/23] qdev: Rework qtree path abbreviations References: <37ada83704ec5cccacbd9411fe4034c8140d860d.1276641524.git.jan.kiszka@web.de> Date: Wed, 23 Jun 2010 10:44:47 +0200 In-Reply-To: <37ada83704ec5cccacbd9411fe4034c8140d860d.1276641524.git.jan.kiszka@web.de> (Jan Kiszka's message of "Wed, 16 Jun 2010 00:38:25 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Anthony Liguori , Juan Quintela , Jan Kiszka , qemu-devel@nongnu.org, Luiz Capitulino , Blue Swirl , Avi Kivity , Gerd Hoffmann [cc: kraxel] Jan Kiszka writes: > From: Jan Kiszka > > Path abbreviations suffer from the inconsistency that bus names can only > be omitted at the end of a path. Drop this special rule, and also remove > the now obsolete QERR_DEVICE_MULTIPLE_BUSSES. > > Signed-off-by: Jan Kiszka Affects only -device and device_add option bus. I support this. > --- > hw/qdev.c | 22 ++++------------------ > qerror.c | 4 ---- > qerror.h | 3 --- > 3 files changed, 4 insertions(+), 25 deletions(-) > > diff --git a/hw/qdev.c b/hw/qdev.c > index 61f999c..7c4f039 100644 > --- a/hw/qdev.c > +++ b/hw/qdev.c > @@ -608,32 +608,18 @@ static BusState *qbus_find(const char *path) > } > return NULL; > } > + if (dev->num_child_bus == 0) { > + qerror_report(QERR_DEVICE_NO_BUS, elem); > + return NULL; > + } I'd kill this check as well. The QERR_BUS_NOT_FOUND further down suffices. > > assert(path[pos] == '/' || !path[pos]); > while (path[pos] == '/') { > pos++; > } > - if (path[pos] == '\0') { > - /* last specified element is a device. If it has exactly > - * one child bus accept it nevertheless */ > - switch (dev->num_child_bus) { > - case 0: > - qerror_report(QERR_DEVICE_NO_BUS, elem); > - return NULL; > - case 1: > - return QLIST_FIRST(&dev->child_bus); > - default: > - qerror_report(QERR_DEVICE_MULTIPLE_BUSSES, elem); > - if (!monitor_cur_is_qmp()) { > - qbus_list_bus(dev); > - } > - return NULL; > - } > - } > > /* find bus */ > if (sscanf(path+pos, "%127[^/]%n", elem, &len) != 1) { > - assert(0); > elem[0] = len = 0; > } > pos += len; [...]