Received: from eggs.gnu.org ([2001:4830:134:3::10]:50662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xnkg3-0007s7-19 for qemu-devel@nongnu.org; Mon, 10 Nov 2014 03:50:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xnkfy-00039U-8p for qemu-devel@nongnu.org; Mon, 10 Nov 2014 03:50:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56921) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xnkfy-00039P-0x for qemu-devel@nongnu.org; Mon, 10 Nov 2014 03:50:18 -0500 From: Markus Armbruster References: <1415182311-13799-1-git-send-email-syeon.hwang@samsung.com> <20141105124609.GA4354@redhat.com> <87lhnpn5y1.fsf@blackfin.pond.sub.org> <545A23A7.7090401@redhat.com> <20141105132815.GA4884@redhat.com> <545A3A61.50001@redhat.com> <045901cff969$02203060$06609120$@samsung.com> <20141106092355.GA15186@redhat.com> <077901cffa41$cd7467d0$685d3770$@samsung.com> <87h9ybfo8p.fsf@blackfin.pond.sub.org> <001a01cffcbf$bbc27470$33475d50$@samsung.com> Date: Mon, 10 Nov 2014 09:50:13 +0100 In-Reply-To: <001a01cffcbf$bbc27470$33475d50$@samsung.com> (SeokYeon Hwang's message of "Mon, 10 Nov 2014 17:24:23 +0900") Message-ID: <87sihrzbga.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] pci: fixed mismatch of error-handling between pci_qdev_init() and qdev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: SeokYeon Hwang Cc: 'Paolo Bonzini' , qemu-devel@nongnu.org, "'Michael S. Tsirkin'" SeokYeon Hwang writes: >> -----Original Message----- >> From: Markus Armbruster [mailto:armbru@redhat.com] >> Sent: Friday, November 07, 2014 4:45 PM >> To: SeokYeon Hwang >> Cc: 'Michael S. Tsirkin'; 'Paolo Bonzini'; qemu-devel@nongnu.org >> Subject: Re: [Qemu-devel] [PATCH] pci: fixed mismatch of error-handling >> between pci_qdev_init() and qdev >> >> SeokYeon Hwang writes: >> >> [...] >> > But if 2.2 comes with all "realized" devices, if there is no "init" >> > devices, then this patch isn't needed. >> >> No PCI devices will be converted to realize in 2.2. We'll start the >> conversion early in the 2.3 development cycle. Whether we can finish it >> in the same cycle is uncertain. > > Then... > I think 'pci_qdev_init()' should be fixed because it contains obviously > wrong logic. > I didn't understand why this problem should be ignored now for reasons of it > will be removed in the far future. > (or because all devices that use this function didn't return positive value > as error now.) > > It will be corrected by > 1. return '-1' instead of 'rc'. > 2. check 'rc < 0' instead of 'rc != 0'. (if we can guarantee no pci device > returns positive value as error.) > > What do you think about it ?? > > If I didn't understand the context of this thread, please let me know. > > Thank you very much. I think (2) best matches how we use init() methods elsewhere, e.g. in device_realize(), hda_codec_dev_init(), sysbus_device_init(), i2c_slave_qdev_init(), smbus_device_init(), ide_qdev_init(), ... Changes the meaning of positive return values from PCIDeviceClass init() from failure to success. Could theoretically break some devices and fix others. To make sure it doesn't break any, you'd have to audit them all. I feel that time would be better spent on conversions to realize(). Worries about such breakage could be a reason to do (1) instead. Needs a suitable comment. Michael, got a preference?