aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorNathan Whitehorn <nwhitehorn@FreeBSD.org>2017-08-12 22:13:06 +0000
committerNathan Whitehorn <nwhitehorn@FreeBSD.org>2017-08-12 22:13:06 +0000
commitc670f31f19918c5201e8b0f692ee59113c710854 (patch)
treefe171c301e6c25aad7bb9a0607dd15259884c6ca /sys/dev
parent7a6fd8dc6b5441ad781fd6a3a966e362fb187378 (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/nvme/nvme.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c
index 8196ff78c854..8acd6be0d7f7 100644
--- a/sys/dev/nvme/nvme.c
+++ b/sys/dev/nvme/nvme.c
@@ -58,6 +58,7 @@ MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocations");
static int nvme_probe(device_t);
static int nvme_attach(device_t);
static int nvme_detach(device_t);
+static int nvme_shutdown(device_t);
static int nvme_modevent(module_t mod, int type, void *arg);
static devclass_t nvme_devclass;
@@ -67,6 +68,7 @@ static device_method_t nvme_pci_methods[] = {
DEVMETHOD(device_probe, nvme_probe),
DEVMETHOD(device_attach, nvme_attach),
DEVMETHOD(device_detach, nvme_detach),
+ DEVMETHOD(device_shutdown, nvme_shutdown),
{ 0, 0 }
};
@@ -179,22 +181,15 @@ nvme_unload(void)
{
}
-static void
-nvme_shutdown(void)
+static int
+nvme_shutdown(device_t dev)
{
- device_t *devlist;
struct nvme_controller *ctrlr;
- int dev, devcount;
-
- if (devclass_get_devices(nvme_devclass, &devlist, &devcount))
- return;
- for (dev = 0; dev < devcount; dev++) {
- ctrlr = DEVICE2SOFTC(devlist[dev]);
- nvme_ctrlr_shutdown(ctrlr);
- }
+ ctrlr = DEVICE2SOFTC(dev);
+ nvme_ctrlr_shutdown(ctrlr);
- free(devlist, M_TEMP);
+ return (0);
}
static int
@@ -208,9 +203,6 @@ nvme_modevent(module_t mod, int type, void *arg)
case MOD_UNLOAD:
nvme_unload();
break;
- case MOD_SHUTDOWN:
- nvme_shutdown();
- break;
default:
break;
}