From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCHv2] qemu-kvm/vhost: fix up irqfd support Date: Wed, 06 Oct 2010 11:24:24 -0600 Message-ID: <1286385864.3020.26.camel@x201> References: <20101006145650.GA10968@redhat.com> <1286383724.3020.8.camel@x201> <20101006170222.GB13486@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, avi@redhat.com, mtosatti@redhat.com, Juan Quintela , Amit Shah , kvm@vger.kernel.org To: "Michael S. Tsirkin" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1025 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753412Ab0JFRY2 (ORCPT ); Wed, 6 Oct 2010 13:24:28 -0400 In-Reply-To: <20101006170222.GB13486@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, 2010-10-06 at 19:02 +0200, Michael S. Tsirkin wrote: > On Wed, Oct 06, 2010 at 10:48:44AM -0600, Alex Williamson wrote: > > > -int msix_unset_mask_notifier(PCIDevice *dev, unsigned vector) > > > +static int msix_unset_mask_notifier_for_vector(PCIDevice *dev, unsigned vector) > > > { > > > int r = 0; > > > - void *opaque; > > > if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector]) > > > return 0; > > > > > > - opaque = dev->msix_mask_notifier_opaque[vector]; > > > - > > > assert(dev->msix_mask_notifier); > > > - assert(opaque); > > > > > > /* Mask the old notifier unless it is already masked. */ > > > if (!msix_is_masked(dev, vector)) { > > > - r = dev->msix_mask_notifier(dev, vector, opaque, true); > > > + r = dev->msix_mask_notifier(dev, vector, true); > > > if (r < 0) { > > > return r; > > > } > > > } > > > - dev->msix_mask_notifier_opaque[vector] = NULL; > > > + return r; > > > +} > > > > The above need to be combined to a single function now since the only > > difference is s/true/false. > > > > Alex > > This is the way it was in the past, and it turned out to be very > confusing to read since both variables: mask and assign are bool but > polarity is reversed. > > Unrolled it seems easier to grok. You could always keep the functions as separate wrapper callers of the common function so you only need to keep true = unset, false = set straight in one place. Thanks, Alex