Received: from eggs.gnu.org ([140.186.70.92]:50113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpEbS-0004Lo-Sq for qemu-devel@nongnu.org; Fri, 05 Aug 2011 03:13:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QpEbS-0007lF-1g for qemu-devel@nongnu.org; Fri, 05 Aug 2011 03:13:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpEbR-0007l8-Of for qemu-devel@nongnu.org; Fri, 05 Aug 2011 03:13:54 -0400 From: Markus Armbruster References: <1312376904-16115-1-git-send-email-armbru@redhat.com> <1312376904-16115-21-git-send-email-armbru@redhat.com> <20110804144841.481b935c@doriath> Date: Fri, 05 Aug 2011 09:13:45 +0200 In-Reply-To: <20110804144841.481b935c@doriath> (Luiz Capitulino's message of "Thu, 4 Aug 2011 14:48:41 -0300") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH v2 20/45] ide: Provide IDEDeviceInfo method exit() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: kwolf@redhat.com, quintela@redhat.com, stefano.stabellini@eu.citrix.com, qemu-devel@nongnu.org, hare@suse.de, amit.shah@redhat.com, hch@lst.de Luiz Capitulino writes: > On Wed, 3 Aug 2011 15:07:59 +0200 > Markus Armbruster wrote: > >> >> Signed-off-by: Markus Armbruster >> --- >> hw/ide/internal.h | 1 + >> hw/ide/qdev.c | 12 ++++++++++++ >> 2 files changed, 13 insertions(+), 0 deletions(-) >> >> diff --git a/hw/ide/internal.h b/hw/ide/internal.h >> index 3e56b45..0b0b8a7 100644 >> --- a/hw/ide/internal.h >> +++ b/hw/ide/internal.h >> @@ -529,6 +529,7 @@ typedef int (*ide_qdev_initfn)(IDEDevice *dev); >> struct IDEDeviceInfo { >> DeviceInfo qdev; >> ide_qdev_initfn init; >> + ide_qdev_initfn exit; >> }; >> >> #define BM_STATUS_DMAING 0x01 >> diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c >> index 6bd8d20..3b7b306 100644 >> --- a/hw/ide/qdev.c >> +++ b/hw/ide/qdev.c >> @@ -91,9 +91,21 @@ err: >> return -1; >> } >> >> +static int ide_qdev_exit(DeviceState *qdev) >> +{ >> + IDEDevice *dev = DO_UPCAST(IDEDevice, qdev, qdev); >> + IDEDeviceInfo *info = DO_UPCAST(IDEDeviceInfo, qdev, qdev->info); >> + >> + if (info->exit) { >> + return info->exit(dev); >> + } >> + return 0; > > return info->exit ? info->exit(dev) : 0; Matter of taste. I'll consider it when I respin. > >> +} >> + >> static void ide_qdev_register(IDEDeviceInfo *info) >> { >> info->qdev.init = ide_qdev_init; >> + info->qdev.exit = ide_qdev_exit; >> info->qdev.bus_info = &ide_bus_info; >> qdev_register(&info->qdev); >> }