use device_lookup to get device
This commit is contained in:
parent
61f21080d9
commit
f90facf2e6
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lkminit_vnd.c,v 1.8 2008/05/29 14:51:27 mrg Exp $ */
|
||||
/* $NetBSD: lkminit_vnd.c,v 1.9 2008/06/13 14:18:14 cegger Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Matthew R. Green
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lkminit_vnd.c,v 1.8 2008/05/29 14:51:27 mrg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lkminit_vnd.c,v 1.9 2008/06/13 14:18:14 cegger Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -57,6 +57,7 @@ static int
|
||||
vnd_lkm(struct lkm_table *lkmtp, int cmd)
|
||||
{
|
||||
int error = 0, i;
|
||||
device_t dev;
|
||||
|
||||
if (cmd == LKM_E_LOAD) {
|
||||
error = config_cfdriver_attach(&vnd_cd);
|
||||
@ -69,8 +70,9 @@ vnd_lkm(struct lkm_table *lkmtp, int cmd)
|
||||
vndattach(0);
|
||||
} else if (cmd == LKM_E_UNLOAD) {
|
||||
for (i = 0; i < vnd_cd.cd_ndevs; i++)
|
||||
if (vnd_cd.cd_devs[i] != NULL &&
|
||||
(error = vnd_destroy(vnd_cd.cd_devs[i])) != 0)
|
||||
dev = device_lookup(&vnd_cd, i);
|
||||
if (dev != NULL &&
|
||||
(error = vnd_destroy(dev)) != 0)
|
||||
return 0;
|
||||
|
||||
if ((error = config_cfattach_detach(vnd_cd.cd_name,
|
||||
|
Loading…
Reference in New Issue
Block a user