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

This commit is contained in:
tsutsui 2009-09-05 14:09:55 +00:00
parent a232c54de6
commit 64cbab9fdb
15 changed files with 75 additions and 75 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_age.c,v 1.32 2009/08/05 15:29:51 cegger Exp $ */
/* $NetBSD: if_age.c,v 1.33 2009/09/05 14:09:55 tsutsui Exp $ */
/* $OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $ */
/*-
@ -31,7 +31,7 @@
/* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.32 2009/08/05 15:29:51 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.33 2009/09/05 14:09:55 tsutsui Exp $");
#include "bpfilter.h"
#include "vlan.h"
@ -290,10 +290,10 @@ age_attach(device_t parent, device_t self, void *aux)
if_attach(ifp);
ether_ifattach(ifp, sc->sc_enaddr);
if (!pmf_device_register(self, NULL, age_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, NULL, age_resume))
pmf_class_network_register(self, ifp);
else
aprint_error_dev(self, "couldn't establish power handler\n");
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ale.c,v 1.7 2009/08/18 06:02:36 cegger Exp $ */
/* $NetBSD: if_ale.c,v 1.8 2009/09/05 14:09:55 tsutsui Exp $ */
/*-
* Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org>
@ -32,7 +32,7 @@
/* Driver for Atheros AR8121/AR8113/AR8114 PCIe Ethernet. */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.7 2009/08/18 06:02:36 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ale.c,v 1.8 2009/09/05 14:09:55 tsutsui Exp $");
#include "bpfilter.h"
#include "vlan.h"
@ -581,10 +581,10 @@ ale_attach(device_t parent, device_t self, void *aux)
if_attach(ifp);
ether_ifattach(ifp, sc->ale_eaddr);
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");
return;
fail:

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bce.c,v 1.26 2009/07/16 20:14:17 jakllsch Exp $ */
/* $NetBSD: if_bce.c,v 1.27 2009/09/05 14:09:55 tsutsui Exp $ */
/*
* Copyright (c) 2003 Clifford Wright. All rights reserved.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.26 2009/07/16 20:14:17 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.27 2009/09/05 14:09:55 tsutsui Exp $");
#include "bpfilter.h"
#include "vlan.h"
@ -472,10 +472,10 @@ bce_attach(device_t parent, device_t self, void *aux)
#endif
callout_init(&sc->bce_timeout, 0);
if (!pmf_device_register(self, NULL, bce_resume)) {
aprint_error_dev(self, "couldn't establish power handler\n");
} else
if (pmf_device_register(self, NULL, bce_resume))
pmf_class_network_register(self, ifp);
else
aprint_error_dev(self, "couldn't establish power handler\n");
}
/* handle media, and ethernet requests */

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bge.c,v 1.167 2009/07/25 13:52:47 msaitoh Exp $ */
/* $NetBSD: if_bge.c,v 1.168 2009/09/05 14:09:55 tsutsui Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.167 2009/07/25 13:52:47 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.168 2009/09/05 14:09:55 tsutsui Exp $");
#include "bpfilter.h"
#include "vlan.h"
@ -2647,10 +2647,10 @@ bge_attach(device_t parent, device_t self, void *aux)
DPRINTFN(5, ("callout_init\n"));
callout_init(&sc->bge_timeout, 0);
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");
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bnx.c,v 1.27 2009/05/05 10:21:22 cegger Exp $ */
/* $NetBSD: if_bnx.c,v 1.28 2009/09/05 14:09:55 tsutsui Exp $ */
/* $OpenBSD: if_bnx.c,v 1.43 2007/01/30 03:21:10 krw Exp $ */
/*-
@ -35,7 +35,7 @@
#if 0
__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
#endif
__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.27 2009/05/05 10:21:22 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.28 2009/09/05 14:09:55 tsutsui Exp $");
/*
* The following controllers are supported by this driver:
@ -699,10 +699,10 @@ bnx_attach(device_t parent, device_t self, void *aux)
callout_init(&sc->bnx_timeout, 0);
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");
/* Print some important debugging info. */
DBRUN(BNX_INFO, bnx_dump_driver_state(sc));

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ipw.c,v 1.48 2009/05/12 08:23:00 cegger Exp $ */
/* $NetBSD: if_ipw.c,v 1.49 2009/09/05 14:09:55 tsutsui Exp $ */
/* FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp */
/*-
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.48 2009/05/12 08:23:00 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.49 2009/09/05 14:09:55 tsutsui Exp $");
/*-
* Intel(R) PRO/Wireless 2100 MiniPCI driver
@ -327,10 +327,10 @@ ipw_attach(device_t parent, device_t self, void *aux)
*/
sc->dwelltime = 100;
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");
ieee80211_announce(ic);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_iwi.c,v 1.81 2009/05/06 09:25:15 cegger Exp $ */
/* $NetBSD: if_iwi.c,v 1.82 2009/09/05 14:09:55 tsutsui Exp $ */
/*-
* Copyright (c) 2004, 2005
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.81 2009/05/06 09:25:15 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.82 2009/09/05 14:09:55 tsutsui Exp $");
/*-
* Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@ -429,10 +429,10 @@ iwi_attach(device_t parent, device_t self, void *aux)
iwi_sysctlattach(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, ifp);
else
aprint_error_dev(self, "couldn't establish power handler\n");
ieee80211_announce(ic);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_iwn.c,v 1.31 2009/05/12 08:23:00 cegger Exp $ */
/* $NetBSD: if_iwn.c,v 1.32 2009/09/05 14:09:55 tsutsui Exp $ */
/*-
* Copyright (c) 2007
@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.31 2009/05/12 08:23:00 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.32 2009/09/05 14:09:55 tsutsui Exp $");
/*
@ -408,10 +408,10 @@ iwn_attach(device_t parent __unused, device_t self, void *aux)
sc->amrr.amrr_min_success_threshold = 1;
sc->amrr.amrr_max_success_threshold = 15;
if (!pmf_device_register(self, NULL, iwn_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, NULL, iwn_resume))
pmf_class_network_register(self, ifp);
else
aprint_error_dev(self, "couldn't establish power handler\n");
iwn_radiotap_attach(sc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_lii.c,v 1.6 2009/04/26 06:56:46 cegger Exp $ */
/* $NetBSD: if_lii.c,v 1.7 2009/09/05 14:09:55 tsutsui Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.6 2009/04/26 06:56:46 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.7 2009/09/05 14:09:55 tsutsui Exp $");
#include "bpfilter.h"
@ -340,10 +340,10 @@ lii_attach(device_t parent, device_t self, void *aux)
if_attach(ifp);
ether_ifattach(ifp, eaddr);
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");
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_msk.c,v 1.27 2009/05/12 08:23:00 cegger Exp $ */
/* $NetBSD: if_msk.c,v 1.28 2009/09/05 14:09:55 tsutsui Exp $ */
/* $OpenBSD: if_msk.c,v 1.42 2007/01/17 02:43:02 krw Exp $ */
/*
@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.27 2009/05/12 08:23:00 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.28 2009/09/05 14:09:55 tsutsui Exp $");
#include "bpfilter.h"
#include "rnd.h"
@ -1118,10 +1118,10 @@ msk_attach(device_t parent, device_t self, void *aux)
if_attach(ifp);
ether_ifattach(ifp, sc_if->sk_enaddr);
if (!pmf_device_register(self, NULL, msk_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, NULL, msk_resume))
pmf_class_network_register(self, ifp);
else
aprint_error_dev(self, "couldn't establish power handler\n");
#if NRND > 0
rnd_attach_source(&sc->rnd_source, device_xname(&sc->sk_dev),

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_nfe.c,v 1.45 2009/06/14 06:24:14 cegger Exp $ */
/* $NetBSD: if_nfe.c,v 1.46 2009/09/05 14:09:55 tsutsui Exp $ */
/* $OpenBSD: if_nfe.c,v 1.77 2008/02/05 16:52:50 brad Exp $ */
/*-
@ -21,7 +21,7 @@
/* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.45 2009/06/14 06:24:14 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.46 2009/09/05 14:09:55 tsutsui Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@ -412,10 +412,10 @@ nfe_attach(device_t parent, device_t self, void *aux)
callout_init(&sc->sc_tick_ch, 0);
callout_setfunc(&sc->sc_tick_ch, nfe_tick, sc);
if (!pmf_device_register(self, NULL, nfe_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, NULL, nfe_resume))
pmf_class_network_register(self, ifp);
else
aprint_error_dev(self, "couldn't establish power handler\n");
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_sip.c,v 1.140 2009/05/05 21:34:13 dyoung Exp $ */
/* $NetBSD: if_sip.c,v 1.141 2009/09/05 14:09:55 tsutsui Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.140 2009/05/05 21:34:13 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.141 2009/09/05 14:09:55 tsutsui Exp $");
#include "bpfilter.h"
#include "rnd.h"
@ -1369,10 +1369,10 @@ sipcom_attach(device_t parent, device_t self, void *aux)
}
#endif /* SIP_EVENT_COUNTERS */
if (!pmf_device_register(self, sipcom_suspend, sipcom_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, sipcom_suspend, sipcom_resume))
pmf_class_network_register(self, ifp);
else
aprint_error_dev(self, "couldn't establish power handler\n");
}
static inline void

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_sk.c,v 1.60 2009/04/23 09:18:25 kefren Exp $ */
/* $NetBSD: if_sk.c,v 1.61 2009/09/05 14:09:55 tsutsui Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -115,7 +115,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.60 2009/04/23 09:18:25 kefren Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.61 2009/09/05 14:09:55 tsutsui Exp $");
#include "bpfilter.h"
#include "rnd.h"
@ -1462,10 +1462,10 @@ sk_attach(device_t parent, device_t self, void *aux)
RND_TYPE_NET, 0);
#endif
if (!pmf_device_register(self, NULL, sk_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, NULL, sk_resume))
pmf_class_network_register(self, ifp);
else
aprint_error_dev(self, "couldn't establish power handler\n");
DPRINTFN(2, ("sk_attach: end\n"));

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_wm.c,v 1.179 2009/08/06 03:03:46 msaitoh Exp $ */
/* $NetBSD: if_wm.c,v 1.180 2009/09/05 14:09:55 tsutsui Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.179 2009/08/06 03:03:46 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.180 2009/09/05 14:09:55 tsutsui Exp $");
#include "bpfilter.h"
#include "rnd.h"
@ -1679,10 +1679,10 @@ wm_attach(device_t parent, device_t self, void *aux)
NULL, xname, "rx_macctl");
#endif /* WM_EVENT_COUNTERS */
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");
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_wpi.c,v 1.42 2009/05/06 09:25:16 cegger Exp $ */
/* $NetBSD: if_wpi.c,v 1.43 2009/09/05 14:09:55 tsutsui Exp $ */
/*-
* Copyright (c) 2006, 2007
@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.42 2009/05/06 09:25:16 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.43 2009/09/05 14:09:55 tsutsui Exp $");
/*
* Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@ -360,10 +360,10 @@ wpi_attach(device_t parent __unused, device_t self, void *aux)
wpi_sysctlattach(sc);
if (!pmf_device_register(self, NULL, wpi_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
else
if (pmf_device_register(self, NULL, wpi_resume))
pmf_class_network_register(self, ifp);
else
aprint_error_dev(self, "couldn't establish power handler\n");
#if NBPFILTER > 0
bpfattach2(ifp, DLT_IEEE802_11_RADIO,