aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mvs/mvs_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/mvs/mvs_pci.c')
-rw-r--r--sys/dev/mvs/mvs_pci.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/dev/mvs/mvs_pci.c b/sys/dev/mvs/mvs_pci.c
index be9351403a0d..f0df709db732 100644
--- a/sys/dev/mvs/mvs_pci.c
+++ b/sys/dev/mvs/mvs_pci.c
@@ -36,8 +36,8 @@
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/sbuf.h>
+#include <sys/stdarg.h>
#include <vm/uma.h>
-#include <machine/stdarg.h>
#include <machine/resource.h>
#include <machine/bus.h>
#include <sys/rman.h>
@@ -77,7 +77,6 @@ static struct {
static int
mvs_probe(device_t dev)
{
- char buf[64];
int i;
uint32_t devid = pci_get_devid(dev);
uint8_t revid = pci_get_revid(dev);
@@ -85,9 +84,8 @@ mvs_probe(device_t dev)
for (i = 0; mvs_ids[i].id != 0; i++) {
if (mvs_ids[i].id == devid &&
mvs_ids[i].rev <= revid) {
- snprintf(buf, sizeof(buf), "%s SATA controller",
+ device_set_descf(dev, "%s SATA controller",
mvs_ids[i].name);
- device_set_desc_copy(dev, buf);
return (BUS_PROBE_DEFAULT);
}
}
@@ -164,13 +162,13 @@ mvs_attach(device_t dev)
}
/* Attach all channels on this controller */
for (unit = 0; unit < ctlr->channels; unit++) {
- child = device_add_child(dev, "mvsch", -1);
+ child = device_add_child(dev, "mvsch", DEVICE_UNIT_ANY);
if (child == NULL)
device_printf(dev, "failed to add channel device\n");
else
device_set_ivars(child, (void *)(intptr_t)unit);
}
- bus_generic_attach(dev);
+ bus_attach_children(dev);
return 0;
}
@@ -178,9 +176,12 @@ static int
mvs_detach(device_t dev)
{
struct mvs_controller *ctlr = device_get_softc(dev);
+ int error;
/* Detach & delete all children */
- device_delete_children(dev);
+ error = bus_generic_detach(dev);
+ if (error != 0)
+ return (error);
/* Free interrupt. */
if (ctlr->irq.r_irq) {