[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 02/11] driver/pci: Get next capability without passing caps
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jiqian Chen <Jiqian.Chen@xxxxxxx>
- Date: Mon, 21 Apr 2025 14:18:54 +0800
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qOOZ7/CpX+4Q9buwrhLclR4GH2J6CoZoWc+RjO8QAwU=; b=wpZEx38frry+EOwd7fZM7aZjupoR+gq1Efltt2M87ccp7umuAYAyntZrAPqzmtO5Yn0x/T58sX52IF1volDr4VUh0rgycBh03XTG3VmEWMNp74Rw2bTt8Goap46lbVZVULnajrN/pbhz+MYCxfisPNT1T04cvw962S6LYkbok+qUwuaYuNBbnHLbuBaM9B+qWu+uLYc/7e6Vto6hXUrBUjUrWZDTc7Cu+9QqVII4g51VFMyTiBRA4ZA8Jpfvyj3NEM6ywPST2ogsPSVRqUGqfP9uqkocQFVqnVTzg7WslSKm9FNA2h2RERQl74TxaUv6d6An+tG3Lc8/N4P7Afk5sA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MX9dQKwPR3BHsG0Ze7MU7iXlZsiAglZXetkZek7JAbIs/qNNvhqCBOfTQMmhZPqWa6CG2mjhCB48CdLF5MtpktpXPUAXtDlRuqU11Uheh4v6ebXvvLIAp4C1B6VaG5v2NU0LIaM951iXnTW+1ATNVo3RlIbM9SOKMuxIB5F1uEjf1rlSWx4qmX8/8RGz1+55JuWXYJIlQyseiFvebaFciMtrshb70YblNLSE+2U5OE2IP47sBs/dTdUXCCrz2RA95YqJg4Jj+ynjB4WhAWT0CL0g5pUUhAtSEmwZMwgQYBpz3ilwMgZ/k+4dk9AqpgF3TBkXK1j1ZGRcL0tQQCu2lw==
- Cc: Huang Rui <ray.huang@xxxxxxx>, Jiqian Chen <Jiqian.Chen@xxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>
- Delivery-date: Mon, 21 Apr 2025 06:19:47 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Modify function pci_find_next_cap_ttl to support returning position
of next capability when size "n" is zero.
That can help caller to get next capability offset if caller just
has a information of current capability offset.
That will be used in a follow-on change.
Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx>
---
cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>
cc: Michal Orzel <michal.orzel@xxxxxxx>
cc: Jan Beulich <jbeulich@xxxxxxxx>
cc: Julien Grall <julien@xxxxxxx>
cc: "Roger Pau Monné" <roger.pau@xxxxxxxxxx>
cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
v2->v3 changes:
* Only check if n == 0 and add assertion for array "caps".
* Not to change pci_find_next_cap_ttl definition.
v1->v2 changes:
new patch.
Best regards,
Jiqian Chen.
---
xen/drivers/pci/pci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/xen/drivers/pci/pci.c b/xen/drivers/pci/pci.c
index edf5b9f7ae9f..804f4e1e6066 100644
--- a/xen/drivers/pci/pci.c
+++ b/xen/drivers/pci/pci.c
@@ -55,6 +55,9 @@ unsigned int pci_find_next_cap_ttl(pci_sbdf_t sbdf, unsigned
int pos,
if ( id == 0xff )
break;
+ if ( n == 0 )
+ return pos;
+ ASSERT(caps);
for ( i = 0; i < n; i++ )
{
if ( id == caps[i] )
--
2.34.1
|