Received: from eggs.gnu.org ([2001:4830:134:3::10]:50070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag9ca-0001Fv-Mr for qemu-devel@nongnu.org; Wed, 16 Mar 2016 07:28:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag9cV-0007HW-N6 for qemu-devel@nongnu.org; Wed, 16 Mar 2016 07:28:12 -0400 References: <1455152067-19900-1-git-send-email-richard.weiyang@gmail.com> From: Michael Tokarev Message-ID: <56E9433C.1040503@msgid.tls.msk.ru> Date: Wed, 16 Mar 2016 14:27:56 +0300 MIME-Version: 1.0 In-Reply-To: <1455152067-19900-1-git-send-email-richard.weiyang@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vfio/pci: replace 1 with PCI_CAP_LIST_NEXT to make code self-explain List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wei Yang , alex.williamson@redhat.com Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org 11.02.2016 03:54, Wei Yang wrote: > Use the macro PCI_CAP_LIST_NEXT instead of 1, so that the code would be > more self-explain. > > This patch makes this change and also fixs one typo in comment. > > 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, /mjt