qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Michael Tokarev <mjt@tls.msk.ru>,
	Wei Yang <richard.weiyang@gmail.com>,
	alex.williamson@redhat.com
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] vfio/pci: replace 1 with PCI_CAP_LIST_NEXT to make code self-explain
Date: Wed, 16 Mar 2016 12:52:52 +0100	[thread overview]
Message-ID: <56E94914.1040803@redhat.com> (raw)
In-Reply-To: <56E9433C.1040503@msgid.tls.msk.ru>



On 16/03/2016 12:27, Michael Tokarev wrote:
>> >      for (tmp = pdev->config[PCI_CAPABILITY_LIST]; tmp;
>> > -         tmp = pdev->config[tmp + 1]) {
>> > +         tmp = pdev->config[tmp + PCI_CAP_LIST_NEXT]) {
>> > -    next = pdev->config[pos + 1];
>> > +    next = pdev->config[pos + PCI_CAP_LIST_NEXT];
> Hmm. I'm not sure the new version is better, to me "+1" reads
> easier than the new symbolic constant variant.
> 
> If it were something like pdev->config[PCI_CAP_LIST_NEXT], that'd be
> nice, but not "pos + PCI_CAP_LIST_NEXT".
> 
> But again, I'm not pci config space expert and don't understand
> the basics :)

Each capability is a node of a linked list, and the position of the next
capability is at offset 1 inside the capability (here it is at offset 1
from the tmp or pos base).  I think the patch is an improvement.

Paolo

  reply	other threads:[~2016-03-16 11:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11  0:54 [Qemu-devel] [PATCH] vfio/pci: replace 1 with PCI_CAP_LIST_NEXT to make code self-explain Wei Yang
2016-03-16 11:27 ` Michael Tokarev
2016-03-16 11:52   ` Paolo Bonzini [this message]
2016-03-17 15:01     ` Wei Yang

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=56E94914.1040803@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=richard.weiyang@gmail.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).