git: d33ab9dae2f5 - main - snd_hdspe: Use saved resource IDs on detach

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Mon, 02 Nov 2026 16:14:43 UTC
The branch main has been updated by kbowling:

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

commit d33ab9dae2f5f5421e4cb5a141751924e35eeb2d
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-07-21 03:36:41 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-11-02 16:14:20 +0000

    snd_hdspe: Use saved resource IDs on detach
    
    Release resources with the IDs used to allocate them.
    Rename irqid to rid to reflect that it stores a resource ID.
    
    Reviewed by:    br
    MFC after:      3 days
    Sponsored by:   BBOX.io
    Differential Revision:  https://reviews.freebsd.org/D58373
---
 sys/dev/sound/pci/hdspe.c | 10 +++++-----
 sys/dev/sound/pci/hdspe.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys/dev/sound/pci/hdspe.c b/sys/dev/sound/pci/hdspe.c
index b129083f4b60..55ddbc8a55ac 100644
--- a/sys/dev/sound/pci/hdspe.c
+++ b/sys/dev/sound/pci/hdspe.c
@@ -203,8 +203,8 @@ hdspe_alloc_resources(struct sc_info *sc)
 	sc->csh = rman_get_bushandle(sc->cs);
 
 	/* Allocate interrupt resource. */
-	sc->irqid = 0;
-	sc->irq = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, &sc->irqid,
+	sc->rid = 0;
+	sc->irq = bus_alloc_resource_any(sc->dev, SYS_RES_IRQ, &sc->rid,
 	    RF_ACTIVE | RF_SHAREABLE);
 
 	if (!sc->irq ||
@@ -291,7 +291,7 @@ fail:
 	if (sc->dmat != NULL)
 		bus_dma_tag_destroy(sc->dmat);
 	if (sc->irq != NULL)
-		bus_release_resource(sc->dev, SYS_RES_IRQ, sc->irqid, sc->irq);
+		bus_release_resource(sc->dev, SYS_RES_IRQ, sc->rid, sc->irq);
 	if (sc->cs != NULL)
 		bus_release_resource(sc->dev, SYS_RES_MEMORY, sc->csid, sc->cs);
 	return (ENXIO);
@@ -957,9 +957,9 @@ hdspe_detach(device_t dev)
 	if (sc->dmat)
 		bus_dma_tag_destroy(sc->dmat);
 	if (sc->irq)
-		bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
+		bus_release_resource(dev, SYS_RES_IRQ, sc->rid, sc->irq);
 	if (sc->cs)
-		bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(0), sc->cs);
+		bus_release_resource(dev, SYS_RES_MEMORY, sc->csid, sc->cs);
 	cv_destroy(&sc->pcm_cv);
 	mtx_destroy(&sc->lock);
 
diff --git a/sys/dev/sound/pci/hdspe.h b/sys/dev/sound/pci/hdspe.h
index 05c88594d585..04a404c6c03f 100644
--- a/sys/dev/sound/pci/hdspe.h
+++ b/sys/dev/sound/pci/hdspe.h
@@ -232,7 +232,7 @@ struct sc_info {
 	bus_space_handle_t	csh;
 
 	struct resource		*irq;
-	int			irqid;
+	int			rid;
 	void			*ih;
 	bus_dma_tag_t		dmat;