Invert logic around nested pmf(9) registrations for readability.

This commit is contained in:
tsutsui 2009-09-05 14:44:59 +00:00
parent 41f548bed9
commit edeaa5dd16
8 changed files with 42 additions and 43 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ath_cardbus.c,v 1.33 2009/05/12 12:11:17 cegger Exp $ */
/* $NetBSD: if_ath_cardbus.c,v 1.34 2009/09/05 14:50:10 tsutsui Exp $ */
/*
* Copyright (c) 2003
* Ichiro FUKUHARA <ichiro@ichiro.org>.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ath_cardbus.c,v 1.33 2009/05/12 12:11:17 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ath_cardbus.c,v 1.34 2009/09/05 14:50:10 tsutsui Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@ -215,12 +215,12 @@ ath_cardbus_attach(device_t parent, device_t self, void *aux)
if (ath_attach(PCI_PRODUCT(ca->ca_id), sc) != 0)
return;
if (!pmf_device_register(self, ath_cardbus_suspend, ath_cardbus_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
else {
if (pmf_device_register(self,
ath_cardbus_suspend, ath_cardbus_resume)) {
pmf_class_network_register(self, &sc->sc_if);
pmf_device_suspend_self(self);
}
} else
aprint_error_dev(self, "couldn't establish power handler\n");
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_fxp_cardbus.c,v 1.39 2009/05/12 14:17:31 cegger Exp $ */
/* $NetBSD: if_fxp_cardbus.c,v 1.40 2009/09/05 14:50:10 tsutsui Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_fxp_cardbus.c,v 1.39 2009/05/12 14:17:31 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_fxp_cardbus.c,v 1.40 2009/09/05 14:50:10 tsutsui Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@ -183,10 +183,10 @@ fxp_cardbus_attach(device_t parent, device_t self,
fxp_attach(sc);
fxp_disable(sc);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, NULL, NULL))
pmf_class_network_register(self, &sc->sc_ethercom.ec_if);
else
aprint_error_dev(self, "couldn't establish power handler\n");
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_rtk_cardbus.c,v 1.37 2008/06/24 19:44:52 drochner Exp $ */
/* $NetBSD: if_rtk_cardbus.c,v 1.38 2009/09/05 14:50:10 tsutsui Exp $ */
/*
* Copyright (c) 2000 Masanori Kanaoka
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_rtk_cardbus.c,v 1.37 2008/06/24 19:44:52 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_rtk_cardbus.c,v 1.38 2009/09/05 14:50:10 tsutsui Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@ -246,10 +246,10 @@ rtk_cardbus_attach(device_t parent, device_t self, void *aux)
rtk_attach(sc);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, NULL, NULL))
pmf_class_network_register(self, &sc->ethercom.ec_if);
else
aprint_error_dev(self, "couldn't establish power handler\n");
/*
* Power down the socket.

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_rtw_cardbus.c,v 1.29 2009/05/12 12:11:17 cegger Exp $ */
/* $NetBSD: if_rtw_cardbus.c,v 1.30 2009/09/05 14:50:10 tsutsui Exp $ */
/*-
* Copyright (c) 2004, 2005 David Young. All rights reserved.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_rtw_cardbus.c,v 1.29 2009/05/12 12:11:17 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_rtw_cardbus.c,v 1.30 2009/09/05 14:50:10 tsutsui Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@ -296,15 +296,15 @@ rtw_cardbus_attach(device_t parent, device_t self, void *aux)
RTW_WRITE(regs, RTW_FEMR, 0);
RTW_WRITE(regs, RTW_FER, RTW_READ(regs, RTW_FER));
if (!pmf_device_register(self, rtw_cardbus_suspend, rtw_cardbus_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
else {
if (pmf_device_register(self,
rtw_cardbus_suspend, rtw_cardbus_resume)) {
pmf_class_network_register(self, &sc->sc_if);
/*
* Power down the socket.
*/
pmf_device_suspend_self(self);
}
} else
aprint_error_dev(self, "couldn't establish power handler\n");
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_an_pcmcia.c,v 1.39 2009/05/12 14:42:18 cegger Exp $ */
/* $NetBSD: if_an_pcmcia.c,v 1.40 2009/09/05 14:44:59 tsutsui Exp $ */
/*-
* Copyright (c) 2000, 2004 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_an_pcmcia.c,v 1.39 2009/05/12 14:42:18 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_an_pcmcia.c,v 1.40 2009/09/05 14:44:59 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -155,10 +155,10 @@ an_pcmcia_attach(struct device *parent, device_t self,
goto fail2;
}
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, NULL, NULL))
pmf_class_network_register(self, &sc->sc_if);
else
aprint_error_dev(self, "couldn't establish power handler\n");
an_pcmcia_disable(sc);
sc->sc_enabled = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ne_pcmcia.c,v 1.156 2009/04/05 03:37:07 uwe Exp $ */
/* $NetBSD: if_ne_pcmcia.c,v 1.157 2009/09/05 14:44:59 tsutsui Exp $ */
/*
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ne_pcmcia.c,v 1.156 2009/04/05 03:37:07 uwe Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ne_pcmcia.c,v 1.157 2009/09/05 14:44:59 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -741,13 +741,12 @@ found:
"WARNING: unable to establish power hook\n");
/* pmf(9) power hooks */
if (!pmf_device_register(self, ne2000_suspend, ne2000_resume))
aprint_error_dev(self, "unable to establish power handler\n");
else {
if (pmf_device_register(self, ne2000_suspend, ne2000_resume)) {
#if 0 /* XXX: notyet: if_stop is NULL! */
pmf_class_network_register(self, &dsc->sc_ec.ec_if);
#endif
}
} else
aprint_error_dev(self, "unable to establish power handler\n");
psc->sc_state = NE_PCMCIA_ATTACHED;
ne_pcmcia_disable(dsc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ray.c,v 1.75 2009/05/12 14:42:18 cegger Exp $ */
/* $NetBSD: if_ray.c,v 1.76 2009/09/05 14:44:59 tsutsui Exp $ */
/*
* Copyright (c) 2000 Christian E. Hopps
@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.75 2009/05/12 14:42:18 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ray.c,v 1.76 2009/09/05 14:44:59 tsutsui Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@ -602,10 +602,10 @@ ray_attach(device_t parent, device_t self, void *aux)
else
ifmedia_set(&sc->sc_media, IFM_INFRA);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, NULL, NULL))
pmf_class_network_register(self, ifp);
else
aprint_error_dev(self, "couldn't establish power handler\n");
/* The attach is successful. */
sc->sc_attached = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_wi_pcmcia.c,v 1.84 2009/05/12 14:42:18 cegger Exp $ */
/* $NetBSD: if_wi_pcmcia.c,v 1.85 2009/09/05 14:44:59 tsutsui Exp $ */
/*-
* Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_wi_pcmcia.c,v 1.84 2009/05/12 14:42:18 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_wi_pcmcia.c,v 1.85 2009/09/05 14:44:59 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -376,10 +376,10 @@ wi_pcmcia_attach(struct device *parent, device_t self,
goto fail2;
}
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, NULL, NULL))
pmf_class_network_register(self, &sc->sc_if);
else
aprint_error_dev(self, "couldn't establish power handler\n");
wi_pcmcia_disable(sc);
psc->sc_state = WI_PCMCIA_ATTACHED;