From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:41711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpNXy-0005Xs-4r for qemu-devel@nongnu.org; Fri, 05 Aug 2011 12:46:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QpNXw-0000bF-5u for qemu-devel@nongnu.org; Fri, 05 Aug 2011 12:46:54 -0400 Received: from mail-yi0-f45.google.com ([209.85.218.45]:38025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpNXw-0000Zv-37 for qemu-devel@nongnu.org; Fri, 05 Aug 2011 12:46:52 -0400 Received: by yih10 with SMTP id 10so517137yih.4 for ; Fri, 05 Aug 2011 09:46:51 -0700 (PDT) Message-ID: <4E3C1E77.20101@codemonkey.ws> Date: Fri, 05 Aug 2011 11:46:47 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <223cb297ff4e241918cf991d3f0e65b63d12e7a8.1312250299.git.yamahata@valinux.co.jp> In-Reply-To: <223cb297ff4e241918cf991d3f0e65b63d12e7a8.1312250299.git.yamahata@valinux.co.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qdev: Eliminate duplicate reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Isaku Yamahata Cc: qemu-devel@nongnu.org On 08/01/2011 08:59 PM, Isaku Yamahata wrote: > qbus_reset_all_fn was registered twice, so a lot of device reset > functions were also called twice when QEMU started. > Which was introduced by 80376c3fc2c38fdd45354e4b0eb45031f35587ed > This patch fixes it by making the main_system_bus creation not register > reset handler. > > Cc: Stefan Weil > Signed-off-by: Isaku Yamahata > Tested-by: Stefan Weil Applied. Thanks. Regards, Anthony Liguori > --- > hw/qdev.c | 14 ++++++++++++-- > 1 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/hw/qdev.c b/hw/qdev.c > index b4ea8e1..6819537 100644 > --- a/hw/qdev.c > +++ b/hw/qdev.c > @@ -36,6 +36,7 @@ static bool qdev_hot_removed = false; > > /* This is a nasty hack to allow passing a NULL bus to qdev_create. */ > static BusState *main_system_bus; > +static void main_system_bus_create(void); > > DeviceInfo *device_info_list; > > @@ -328,8 +329,7 @@ static int qdev_reset_one(DeviceState *dev, void *opaque) > BusState *sysbus_get_default(void) > { > if (!main_system_bus) { > - main_system_bus = qbus_create(&system_bus_info, NULL, > - "main-system-bus"); > + main_system_bus_create(); > } > return main_system_bus; > } > @@ -784,6 +784,16 @@ BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name) > return bus; > } > > +static void main_system_bus_create(void) > +{ > + /* assign main_system_bus before qbus_create_inplace() > + * in order to make "if (bus != main_system_bus)" work */ > + main_system_bus = qemu_mallocz(system_bus_info.size); > + main_system_bus->qdev_allocated = 1; > + qbus_create_inplace(main_system_bus,&system_bus_info, NULL, > + "main-system-bus"); > +} > + > void qbus_free(BusState *bus) > { > DeviceState *dev;