git: 1154290b4646 - stable/13 - bhyve: Use XHCI_PORTREG_PTR in one place that open-coded it.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 24 Jan 2023 05:43:19 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=1154290b4646ab9ac9686e65c41729fdb078b58f

commit 1154290b4646ab9ac9686e65c41729fdb078b58f
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-11-16 03:19:35 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-01-24 05:13:55 +0000

    bhyve: Use XHCI_PORTREG_PTR in one place that open-coded it.
    
    Reviewed by:    corvink, markj
    Differential Revision:  https://reviews.freebsd.org/D36888
    
    (cherry picked from commit fd104a6ebc35cfc9cadeb981b23200e805a88b3f)
---
 usr.sbin/bhyve/pci_xhci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/bhyve/pci_xhci.c b/usr.sbin/bhyve/pci_xhci.c
index 5502f95c3b46..13fc3a3b1bb4 100644
--- a/usr.sbin/bhyve/pci_xhci.c
+++ b/usr.sbin/bhyve/pci_xhci.c
@@ -2131,6 +2131,7 @@ pci_xhci_rtsregs_write(struct pci_xhci_softc *sc, uint64_t offset,
 static uint64_t
 pci_xhci_portregs_read(struct pci_xhci_softc *sc, uint64_t offset)
 {
+	struct pci_xhci_portregs *portregs;
 	int port;
 	uint32_t *p;
 
@@ -2149,7 +2150,8 @@ pci_xhci_portregs_read(struct pci_xhci_softc *sc, uint64_t offset)
 
 	offset = (offset - 0x3F0) % 0x10;
 
-	p = &sc->portregs[port].portsc;
+	portregs = XHCI_PORTREG_PTR(sc, port);
+	p = &portregs->portsc;
 	p += offset / sizeof(uint32_t);
 
 	DPRINTF(("pci_xhci: portregs read offset 0x%lx port %u -> 0x%x",