git: 96e2a9a40a05 - main - snd_hdsp: Use saved resource IDs on detach

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

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

commit 96e2a9a40a05716a444dc217629374c387efd159
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-11-02 16:17:00 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-11-02 16:17:09 +0000

    snd_hdsp: 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.
    
    This mirrors the corresponding snd_hdspe change.
    
    MFC after:      3 days
    Sponsored by:   BBOX.io
---
 sys/dev/sound/pci/hdsp.c | 10 +++++-----
 sys/dev/sound/pci/hdsp.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/sys/dev/sound/pci/hdsp.c b/sys/dev/sound/pci/hdsp.c
index 3c92eb3e319a..efe7dfcac88c 100644
--- a/sys/dev/sound/pci/hdsp.c
+++ b/sys/dev/sound/pci/hdsp.c
@@ -179,8 +179,8 @@ hdsp_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 ||
@@ -267,7 +267,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);
@@ -1050,9 +1050,9 @@ hdsp_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/hdsp.h b/sys/dev/sound/pci/hdsp.h
index b30845fb4bb9..5b8a826bc161 100644
--- a/sys/dev/sound/pci/hdsp.h
+++ b/sys/dev/sound/pci/hdsp.h
@@ -238,7 +238,7 @@ struct sc_info {
 	bus_space_handle_t	csh;
 
 	struct resource		*irq;
-	int			irqid;
+	int			rid;
 	void			*ih;
 	bus_dma_tag_t		dmat;