Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163276547
D47965.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D47965.diff
View Options
diff --git a/sys/dev/sound/pci/csa.c b/sys/dev/sound/pci/csa.c
--- a/sys/dev/sound/pci/csa.c
+++ b/sys/dev/sound/pci/csa.c
@@ -317,26 +317,16 @@
scp = device_get_softc(dev);
resp = &scp->res;
- if (scp->midi != NULL) {
- err = device_delete_child(dev, scp->midi);
- if (err != 0)
- return err;
- scp->midi = NULL;
- }
-
- if (scp->pcm != NULL) {
- err = device_delete_child(dev, scp->pcm);
- if (err != 0)
- return err;
- scp->pcm = NULL;
- }
+ err = bus_generic_detach(dev);
+ if (err != 0)
+ return err;
bus_teardown_intr(dev, resp->irq, scp->ih);
bus_release_resource(dev, SYS_RES_IRQ, resp->irq_rid, resp->irq);
bus_release_resource(dev, SYS_RES_MEMORY, resp->mem_rid, resp->mem);
bus_release_resource(dev, SYS_RES_MEMORY, resp->io_rid, resp->io);
- return bus_generic_detach(dev);
+ return (0);
}
static int
diff --git a/sys/dev/sound/pci/emu10kx.c b/sys/dev/sound/pci/emu10kx.c
--- a/sys/dev/sound/pci/emu10kx.c
+++ b/sys/dev/sound/pci/emu10kx.c
@@ -3354,36 +3354,13 @@
emu_pci_detach(device_t dev)
{
struct emu_sc_info *sc;
- int devcount, i;
- device_t *childlist;
int r = 0;
sc = device_get_softc(dev);
- for (i = 0; i < RT_COUNT; i++) {
- if (sc->pcm[i] != NULL) {
- r = device_delete_child(dev, sc->pcm[i]);
- if (r) return (r);
- }
- }
-
- if (sc->midi[0] != NULL) {
- r = device_delete_child(dev, sc->midi[0]);
- if (r) return (r);
- }
-
- if (sc->midi[1] != NULL) {
- r = device_delete_child(dev, sc->midi[1]);
- if (r) return (r);
- }
-
- if (device_get_children(dev, &childlist, &devcount) == 0)
- for (i = 0; i < devcount - 1; i++) {
- device_printf(dev, "removing stale child %d (unit %d)\n", i, device_get_unit(childlist[i]));
- device_delete_child(dev, childlist[i]);
- }
- if (childlist != NULL)
- free(childlist, M_TEMP);
+ r = bus_generic_detach(dev);
+ if (r != 0)
+ return (r);
r = emu10kx_dev_uninit(sc);
if (r)
@@ -3403,7 +3380,7 @@
mtx_destroy(&sc->rw);
mtx_destroy(&sc->lock);
- return (bus_generic_detach(dev));
+ return (0);
}
/* add suspend, resume */
static device_method_t emu_methods[] = {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jul 22, 4:09 PM (11 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35371448
Default Alt Text
D47965.diff (2 KB)
Attached To
Mode
D47965: csa/emu10kx: Simplify deleting child devices
Attached
Detach File
Event Timeline
Log In to Comment