From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KCyHx-0001EB-8N for qemu-devel@nongnu.org; Sun, 29 Jun 2008 10:54:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KCyHv-0001DN-Q2 for qemu-devel@nongnu.org; Sun, 29 Jun 2008 10:54:00 -0400 Received: from [199.232.76.173] (port=40698 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KCyHv-0001DF-J6 for qemu-devel@nongnu.org; Sun, 29 Jun 2008 10:53:59 -0400 Received: from mail.codesourcery.com ([65.74.133.4]:56057) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KCyHu-0000Pi-UB for qemu-devel@nongnu.org; Sun, 29 Jun 2008 10:53:59 -0400 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH 1/3] Change qemu_set_irq() to return status information. Date: Sun, 29 Jun 2008 15:53:55 +0100 References: <20080629140120.5626.1590.stgit@gleb-debian.qumranet.com.qumranet.com> <486798A9.7060308@qumranet.com> <20080629141852.GD31298@minantech.com> In-Reply-To: <20080629141852.GD31298@minantech.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200806291553.55770.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gleb Natapov > >> The return value is less then zero if interrupt is masked, zero if it > >> is known that interrupt is lost (due to coalescing) or greater then zero > >> if interrupt is delivered or was successfully queued for delivery by > >> interrupt controller. Device emulation can use this info as it pleases. > >> Included patch adds detection of interrupt coalescing into PIC and APIC > >> code for edge triggered interrupts. > > > > Instead of negative/positive/zero, consider returning an enum for > > readability. > > I thought about that, but I sometimes do arithmetics on those values > (when delivering interrupt to multiple CPUs), so result can be more then > 1 sometimes. At minimum you need to document the meaning of these values. Especially as you've now given two contradictory definitions - "greater than zero" isn't something you can do arithmetic with. If you require -1/0/+1 then you have to say that. Paul