[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] drivers/pci: Get next capability without passing caps



commit fcc44f8548b89a649003c4348702e04e0c20b205
Author:     Jiqian Chen <Jiqian.Chen@xxxxxxx>
AuthorDate: Wed Apr 23 09:42:08 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Apr 23 09:42:08 2025 +0200

    drivers/pci: Get next capability without passing caps
    
    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>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/drivers/pci/pci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/drivers/pci/pci.c b/xen/drivers/pci/pci.c
index edf5b9f7ae..acf4cebe42 100644
--- a/xen/drivers/pci/pci.c
+++ b/xen/drivers/pci/pci.c
@@ -55,6 +55,11 @@ unsigned int pci_find_next_cap_ttl(pci_sbdf_t sbdf, unsigned 
int pos,
 
         if ( id == 0xff )
             break;
+
+        if ( !n )
+            return pos;
+        ASSERT(caps);
+
         for ( i = 0; i < n; i++ )
         {
             if ( id == caps[i] )
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.