From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40698 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Omprb-0007n2-Pb for qemu-devel@nongnu.org; Sat, 21 Aug 2010 11:20:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OmprW-0001G6-Ik for qemu-devel@nongnu.org; Sat, 21 Aug 2010 11:20:07 -0400 Received: from mail-iw0-f173.google.com ([209.85.214.173]:49616) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmprW-0001Eq-Es for qemu-devel@nongnu.org; Sat, 21 Aug 2010 11:20:02 -0400 Received: by iwn38 with SMTP id 38so240983iwn.4 for ; Sat, 21 Aug 2010 08:20:01 -0700 (PDT) Message-ID: <4C6FEE95.4080109@codemonkey.ws> Date: Sat, 21 Aug 2010 10:19:49 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] qdev: Reset hotplugged devices References: <20100803161914.15514.59304.stgit@localhost6.localdomain6> <1282308092.3860.0.camel@x201> <4C6EA5C9.8080700@codemonkey.ws> <4C6EC5AA.6050502@codemonkey.ws> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Alex Williamson , glommer@redhat.com, qemu-devel@nongnu.org On 08/21/2010 05:07 AM, Markus Armbruster wrote: >> diff --git a/vl.c b/vl.c >> index b3e3676..5de1688 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -2968,6 +2968,9 @@ int main(int argc, char **argv, char **envp) >> } >> >> qemu_system_reset(); >> + >> + qemu_register_reset((void *)qbus_reset_all, sysbus_get_default()); >> + >> > This is inconsistent with qdev_create(). qdev_create() uses null. > > I agree with the N.B. in your commit message: the root of the tree > should be explicit. Implicit is too much magic. But you create a > second kind of magic. I don't object to how that works, only to having > two different kinds. > > I'd suggest you either make your qemu_reset_all() work like existing > qdev_create(), i.e. null means root. Or change qdev_create() to work > like your qemu_reset_all(), i.e. use sysbus_get_default() instead of > null. > I'm getting rid of the NULL crap too although it's lower on my qdev TODO.. sysbus_get_default() is a heck of a lot easier to grep for though than NULL so I'd prefer to use this for now. Regards, Anthony Liguori >> if (loadvm) { >> if (load_vmstate(loadvm)< 0) { >> autostart = 0; >>