qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: kvm@vger.kernel.org, Quintela <quintela@redhat.com>,
	Juan@gnu.org, mtosatti@redhat.com, qemu-devel@nongnu.org,
	avi@redhat.com, Amit Shah <amit.shah@redhat.com>
Subject: [Qemu-devel] Re: [PATCHv2] qemu-kvm/vhost: fix up irqfd support
Date: Wed, 06 Oct 2010 11:24:24 -0600	[thread overview]
Message-ID: <1286385864.3020.26.camel@x201> (raw)
In-Reply-To: <20101006170222.GB13486@redhat.com>

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

  reply	other threads:[~2010-10-06 17:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-06 14:56 [Qemu-devel] [PATCHv2] qemu-kvm/vhost: fix up irqfd support Michael S. Tsirkin
2010-10-06 16:48 ` [Qemu-devel] " Alex Williamson
2010-10-06 17:02   ` Michael S. Tsirkin
2010-10-06 17:24     ` Alex Williamson [this message]
2010-10-06 17:29       ` Michael S. Tsirkin
2010-10-06 21:44       ` Michael S. Tsirkin
2010-10-06 22:05         ` Alex Williamson
2010-10-07  9:57           ` Michael S. Tsirkin
2010-10-07 15:15             ` Alex Williamson
2010-10-07 15:17               ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1286385864.3020.26.camel@x201 \
    --to=alex.williamson@redhat.com \
    --cc=Juan@gnu.org \
    --cc=amit.shah@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).