From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42566 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OnXHh-0001DI-PS for qemu-devel@nongnu.org; Mon, 23 Aug 2010 09:42:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OnX3i-0007nx-BZ for qemu-devel@nongnu.org; Mon, 23 Aug 2010 09:27:31 -0400 Received: from mail-yx0-f173.google.com ([209.85.213.173]:51099) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnX3i-0007nr-7M for qemu-devel@nongnu.org; Mon, 23 Aug 2010 09:27:30 -0400 Received: by yxn35 with SMTP id 35so2265000yxn.4 for ; Mon, 23 Aug 2010 06:27:29 -0700 (PDT) Message-ID: <4C72773F.20405@codemonkey.ws> Date: Mon, 23 Aug 2010 08:27:27 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <20100803161914.15514.59304.stgit@localhost6.localdomain6> <1282308092.3860.0.camel@x201> <4C6EA5C9.8080700@codemonkey.ws> <4C6EC5AA.6050502@codemonkey.ws> <4C725AA4.2020905@redhat.com> In-Reply-To: <4C725AA4.2020905@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] qdev: Reset hotplugged devices List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Alex Williamson , glommer@redhat.com, Markus Armbruster , qemu-devel@nongnu.org On 08/23/2010 06:25 AM, Paolo Bonzini wrote: > On 08/20/2010 08:12 PM, Anthony Liguori wrote: >> +/* Returns false to terminate walk; true to continue */ >> +typedef int (qdev_walkerfn)(DeviceState *dev, void *opaque); >> + > > Since you're introducing qbus_walk_children, I suggest a different > interface: qdev_walkerfn should return 0 to walk children, -1 to skip > walking children, and anything else to terminate walk. If anything > ever returns x > 0, qbus_walk_children returns that x, else > qbus_walk_children returns 0. This interface is inspired by a similar > one in GCC and it works well. Good suggestion. Regards, Anthony Liguori > If you don't want to introduce the full complication, removing the "-1 > to skip walking children" part would still give the same flexibility > WRT to the return values, which is the important part. > > Paolo