From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agZRA-0003jN-Qh for qemu-devel@nongnu.org; Thu, 17 Mar 2016 11:02:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agZR6-0001Kk-Ns for qemu-devel@nongnu.org; Thu, 17 Mar 2016 11:02:08 -0400 Date: Thu, 17 Mar 2016 15:01:49 +0000 From: Wei Yang Message-ID: <20160317150149.GA1772@vultr.guest> References: <1455152067-19900-1-git-send-email-richard.weiyang@gmail.com> <56E9433C.1040503@msgid.tls.msk.ru> <56E94914.1040803@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56E94914.1040803@redhat.com> Subject: Re: [Qemu-devel] [PATCH] vfio/pci: replace 1 with PCI_CAP_LIST_NEXT to make code self-explain Reply-To: Wei Yang List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-trivial@nongnu.org, alex.williamson@redhat.com, Michael Tokarev , qemu-devel@nongnu.org, Wei Yang On Wed, Mar 16, 2016 at 12:52:52PM +0100, Paolo Bonzini wrote: > > >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 :) Thanks Michael for your comment. By using the macro, audience is more easy to understand it tries to get the position of next capability. > >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. > Thanks Paolo for your reply. :-) >Paolo -- Wei Yang Help you, Help me