Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Invert logic around nested pmf(9) registrations for ...
details: https://anonhg.NetBSD.org/src/rev/5cdbe58f0cbc
branches: trunk
changeset: 747207:5cdbe58f0cbc
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Sep 05 14:44:59 2009 +0000
description:
Invert logic around nested pmf(9) registrations for readability.
diffstat:
sys/dev/cardbus/if_ath_cardbus.c | 12 ++++++------
sys/dev/cardbus/if_fxp_cardbus.c | 10 +++++-----
sys/dev/cardbus/if_rtk_cardbus.c | 10 +++++-----
sys/dev/cardbus/if_rtw_cardbus.c | 12 ++++++------
sys/dev/pcmcia/if_an_pcmcia.c | 10 +++++-----
sys/dev/pcmcia/if_ne_pcmcia.c | 11 +++++------
sys/dev/pcmcia/if_ray.c | 10 +++++-----
sys/dev/pcmcia/if_wi_pcmcia.c | 10 +++++-----
8 files changed, 42 insertions(+), 43 deletions(-)
diffs (268 lines):
diff -r f5d909286b90 -r 5cdbe58f0cbc sys/dev/cardbus/if_ath_cardbus.c
--- a/sys/dev/cardbus/if_ath_cardbus.c Sat Sep 05 14:19:30 2009 +0000
+++ b/sys/dev/cardbus/if_ath_cardbus.c Sat Sep 05 14:44:59 2009 +0000
@@ -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@localhost>.
@@ -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 @@
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
diff -r f5d909286b90 -r 5cdbe58f0cbc sys/dev/cardbus/if_fxp_cardbus.c
--- a/sys/dev/cardbus/if_fxp_cardbus.c Sat Sep 05 14:19:30 2009 +0000
+++ b/sys/dev/cardbus/if_fxp_cardbus.c Sat Sep 05 14:44:59 2009 +0000
@@ -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_attach(sc);
fxp_disable(sc);
- if (!pmf_device_register(self, NULL, NULL))
+ 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");
- else
- pmf_class_network_register(self, &sc->sc_ethercom.ec_if);
}
static void
diff -r f5d909286b90 -r 5cdbe58f0cbc sys/dev/cardbus/if_rtk_cardbus.c
--- a/sys/dev/cardbus/if_rtk_cardbus.c Sat Sep 05 14:19:30 2009 +0000
+++ b/sys/dev/cardbus/if_rtk_cardbus.c Sat Sep 05 14:44:59 2009 +0000
@@ -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_attach(sc);
- if (!pmf_device_register(self, NULL, NULL))
+ 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");
- else
- pmf_class_network_register(self, &sc->ethercom.ec_if);
/*
* Power down the socket.
diff -r f5d909286b90 -r 5cdbe58f0cbc sys/dev/cardbus/if_rtw_cardbus.c
--- a/sys/dev/cardbus/if_rtw_cardbus.c Sat Sep 05 14:19:30 2009 +0000
+++ b/sys/dev/cardbus/if_rtw_cardbus.c Sat Sep 05 14:44:59 2009 +0000
@@ -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_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
diff -r f5d909286b90 -r 5cdbe58f0cbc sys/dev/pcmcia/if_an_pcmcia.c
--- a/sys/dev/pcmcia/if_an_pcmcia.c Sat Sep 05 14:19:30 2009 +0000
+++ b/sys/dev/pcmcia/if_an_pcmcia.c Sat Sep 05 14:44:59 2009 +0000
@@ -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 @@
goto fail2;
}
- if (!pmf_device_register(self, NULL, NULL))
+ 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");
- else
- pmf_class_network_register(self, &sc->sc_if);
an_pcmcia_disable(sc);
sc->sc_enabled = 0;
diff -r f5d909286b90 -r 5cdbe58f0cbc sys/dev/pcmcia/if_ne_pcmcia.c
--- a/sys/dev/pcmcia/if_ne_pcmcia.c Sat Sep 05 14:19:30 2009 +0000
+++ b/sys/dev/pcmcia/if_ne_pcmcia.c Sat Sep 05 14:44:59 2009 +0000
@@ -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 @@
"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);
diff -r f5d909286b90 -r 5cdbe58f0cbc sys/dev/pcmcia/if_ray.c
--- a/sys/dev/pcmcia/if_ray.c Sat Sep 05 14:19:30 2009 +0000
+++ b/sys/dev/pcmcia/if_ray.c Sat Sep 05 14:44:59 2009 +0000
@@ -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 @@
else
ifmedia_set(&sc->sc_media, IFM_INFRA);
- if (!pmf_device_register(self, NULL, NULL))
+ if (pmf_device_register(self, NULL, NULL))
+ pmf_class_network_register(self, ifp);
+ else
aprint_error_dev(self, "couldn't establish power handler\n");
- else
- pmf_class_network_register(self, ifp);
/* The attach is successful. */
sc->sc_attached = 1;
diff -r f5d909286b90 -r 5cdbe58f0cbc sys/dev/pcmcia/if_wi_pcmcia.c
--- a/sys/dev/pcmcia/if_wi_pcmcia.c Sat Sep 05 14:19:30 2009 +0000
+++ b/sys/dev/pcmcia/if_wi_pcmcia.c Sat Sep 05 14:44:59 2009 +0000
@@ -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 @@
goto fail2;
}
- if (!pmf_device_register(self, NULL, NULL))
+ 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");
- else
- pmf_class_network_register(self, &sc->sc_if);
wi_pcmcia_disable(sc);
psc->sc_state = WI_PCMCIA_ATTACHED;
Home |
Main Index |
Thread Index |
Old Index