no need to device_pmf_is_registered() before unregister

This commit is contained in:
plunky 2012-04-05 16:31:53 +00:00
parent 5e6662c58c
commit 38c4ee0750
3 changed files with 11 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_cdce.c,v 1.36 2012/02/24 06:48:24 mrg Exp $ */
/* $NetBSD: if_cdce.c,v 1.37 2012/04/05 16:31:53 plunky Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com>
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.36 2012/02/24 06:48:24 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.37 2012/04/05 16:31:53 plunky Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@ -309,8 +309,7 @@ cdce_detach(device_t self, int flags)
struct ifnet *ifp = GET_IFP(sc);
int s;
if (device_pmf_is_registered(self))
pmf_device_deregister(self);
pmf_device_deregister(self);
s = splusb();

View File

@ -1,4 +1,4 @@
/* $NetBSD: ubt.c,v 1.45 2012/03/06 03:35:29 mrg Exp $ */
/* $NetBSD: ubt.c,v 1.46 2012/04/05 16:31:53 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.45 2012/03/06 03:35:29 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.46 2012/04/05 16:31:53 plunky Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -533,8 +533,10 @@ ubt_attach(device_t parent, device_t self, void *aux)
}
sc->sc_ok = 1;
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
return;
}
@ -546,8 +548,7 @@ ubt_detach(device_t self, int flags)
DPRINTF("sc=%p flags=%d\n", sc, flags);
if (device_pmf_is_registered(self))
pmf_device_deregister(self);
pmf_device_deregister(self);
sc->sc_dying = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: uhso.c,v 1.8 2012/03/06 03:35:29 mrg Exp $ */
/* $NetBSD: uhso.c,v 1.9 2012/04/05 16:31:53 plunky Exp $ */
/*-
* Copyright (c) 2009 Iain Hibbert
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.8 2012/03/06 03:35:29 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.9 2012/04/05 16:31:53 plunky Exp $");
#include "opt_inet.h"
@ -537,8 +537,7 @@ uhso_detach(device_t self, int flags)
unsigned int i;
int s;
if (device_pmf_is_registered(self))
pmf_device_deregister(self);
pmf_device_deregister(self);
for (i = 0; i < UHSO_PORT_MAX; i++) {
hp = sc->sc_port[i];