Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Invert logic around nested pmf(9) registrations ...
details: https://anonhg.NetBSD.org/src/rev/3af44020b4a0
branches: trunk
changeset: 747205:3af44020b4a0
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Sep 05 14:13:50 2009 +0000
description:
Invert logic around nested pmf(9) registrations for readability.
XXX: should these pmf(9) calls be moved into MI attach functions
XXX: using function pointers for suspend and resume passed via softc?
diffstat:
sys/dev/pci/if_an_pci.c | 10 +++++-----
sys/dev/pci/if_ath_pci.c | 11 +++++------
sys/dev/pci/if_fxp_pci.c | 10 +++++-----
sys/dev/pci/if_gem_pci.c | 12 ++++++------
sys/dev/pci/if_rtk_pci.c | 10 +++++-----
sys/dev/pci/if_rtw_pci.c | 14 ++++++--------
sys/dev/pci/if_wi_pci.c | 10 +++++-----
7 files changed, 37 insertions(+), 40 deletions(-)
diffs (233 lines):
diff -r 9d92f26698ae -r 3af44020b4a0 sys/dev/pci/if_an_pci.c
--- a/sys/dev/pci/if_an_pci.c Sat Sep 05 14:09:55 2009 +0000
+++ b/sys/dev/pci/if_an_pci.c Sat Sep 05 14:13:50 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_an_pci.c,v 1.29 2009/05/06 10:34:32 cegger Exp $ */
+/* $NetBSD: if_an_pci.c,v 1.30 2009/09/05 14:13:50 tsutsui Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_an_pci.c,v 1.29 2009/05/06 10:34:32 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_an_pci.c,v 1.30 2009/09/05 14:13:50 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -168,8 +168,8 @@
bus_space_unmap(sc->sc_iot, sc->sc_ioh, iosize);
}
- if (!pmf_device_register(self, NULL, NULL))
- aprint_error_dev(self, "couldn't establish power handler\n");
+ if (pmf_device_register(self, NULL, NULL))
+ pmf_class_network_register(self, &sc->sc_if);
else
- pmf_class_network_register(self, &sc->sc_if);
+ aprint_error_dev(self, "couldn't establish power handler\n");
}
diff -r 9d92f26698ae -r 3af44020b4a0 sys/dev/pci/if_ath_pci.c
--- a/sys/dev/pci/if_ath_pci.c Sat Sep 05 14:09:55 2009 +0000
+++ b/sys/dev/pci/if_ath_pci.c Sat Sep 05 14:13:50 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ath_pci.c,v 1.33 2009/05/06 09:25:15 cegger Exp $ */
+/* $NetBSD: if_ath_pci.c,v 1.34 2009/09/05 14:13:50 tsutsui Exp $ */
/*-
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -41,7 +41,7 @@
__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath_pci.c,v 1.11 2005/01/18 18:08:16 sam Exp $");
#endif
#ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: if_ath_pci.c,v 1.33 2009/05/06 09:25:15 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ath_pci.c,v 1.34 2009/09/05 14:13:50 tsutsui Exp $");
#endif
/*
@@ -260,12 +260,11 @@
if (ath_attach(PCI_PRODUCT(pa->pa_id), sc) != 0)
goto bad3;
- if (!pmf_device_register(self, ath_pci_suspend, ath_pci_resume))
- aprint_error_dev(self, "couldn't establish power handler\n");
- else {
+ if (pmf_device_register(self, ath_pci_suspend, ath_pci_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");
return;
bad3:
ATH_LOCK_DESTROY(sc);
diff -r 9d92f26698ae -r 3af44020b4a0 sys/dev/pci/if_fxp_pci.c
--- a/sys/dev/pci/if_fxp_pci.c Sat Sep 05 14:09:55 2009 +0000
+++ b/sys/dev/pci/if_fxp_pci.c Sat Sep 05 14:13:50 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_fxp_pci.c,v 1.69 2009/04/17 15:37:43 tsutsui Exp $ */
+/* $NetBSD: if_fxp_pci.c,v 1.70 2009/09/05 14:13:50 tsutsui Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_fxp_pci.c,v 1.69 2009/04/17 15:37:43 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_fxp_pci.c,v 1.70 2009/09/05 14:13:50 tsutsui Exp $");
#include "rnd.h"
@@ -482,10 +482,10 @@
fxp_disable(sc);
/* Add a suspend hook to restore PCI config state */
- if (!pmf_device_register(self, NULL, fxp_pci_resume))
+ if (pmf_device_register(self, NULL, fxp_pci_resume))
+ 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 int
diff -r 9d92f26698ae -r 3af44020b4a0 sys/dev/pci/if_gem_pci.c
--- a/sys/dev/pci/if_gem_pci.c Sat Sep 05 14:09:55 2009 +0000
+++ b/sys/dev/pci/if_gem_pci.c Sat Sep 05 14:13:50 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gem_pci.c,v 1.36 2009/07/27 18:10:53 dyoung Exp $ */
+/* $NetBSD: if_gem_pci.c,v 1.37 2009/09/05 14:13:50 tsutsui Exp $ */
/*
*
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gem_pci.c,v 1.36 2009/07/27 18:10:53 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gem_pci.c,v 1.37 2009/09/05 14:13:50 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -399,12 +399,12 @@
/* Finish off the attach. */
gem_attach(sc, enaddr);
- if (!pmf_device_register1(sc->sc_dev, gem_pci_suspend, gem_pci_resume,
- gem_shutdown)) {
+ if (pmf_device_register1(sc->sc_dev,
+ gem_pci_suspend, gem_pci_resume, gem_shutdown))
+ pmf_class_network_register(sc->sc_dev, &sc->sc_ethercom.ec_if);
+ else
aprint_error_dev(sc->sc_dev,
"could not establish power handlers\n");
- } else
- pmf_class_network_register(sc->sc_dev, &sc->sc_ethercom.ec_if);
}
static bool
diff -r 9d92f26698ae -r 3af44020b4a0 sys/dev/pci/if_rtk_pci.c
--- a/sys/dev/pci/if_rtk_pci.c Sat Sep 05 14:09:55 2009 +0000
+++ b/sys/dev/pci/if_rtk_pci.c Sat Sep 05 14:13:50 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rtk_pci.c,v 1.38 2009/05/06 09:25:16 cegger Exp $ */
+/* $NetBSD: if_rtk_pci.c,v 1.39 2009/09/05 14:13:50 tsutsui Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rtk_pci.c,v 1.38 2009/05/06 09:25:16 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rtk_pci.c,v 1.39 2009/09/05 14:13:50 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -225,10 +225,10 @@
sc->sc_dmat = pa->pa_dmat;
sc->sc_flags |= RTK_ENABLED;
- 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);
rtk_attach(sc);
}
diff -r 9d92f26698ae -r 3af44020b4a0 sys/dev/pci/if_rtw_pci.c
--- a/sys/dev/pci/if_rtw_pci.c Sat Sep 05 14:09:55 2009 +0000
+++ b/sys/dev/pci/if_rtw_pci.c Sat Sep 05 14:13:50 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_rtw_pci.c,v 1.13 2009/05/06 09:25:16 cegger Exp $ */
+/* $NetBSD: if_rtw_pci.c,v 1.14 2009/09/05 14:13:50 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rtw_pci.c,v 1.13 2009/05/06 09:25:16 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rtw_pci.c,v 1.14 2009/09/05 14:13:50 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -251,17 +251,15 @@
*/
rtw_attach(sc);
- if (!pmf_device_register(sc->sc_dev, rtw_pci_suspend,
- rtw_pci_resume)) {
- aprint_error_dev(sc->sc_dev,
- "couldn't establish power handler\n");
- } else {
+ if (pmf_device_register(sc->sc_dev, rtw_pci_suspend, rtw_pci_resume)) {
pmf_class_network_register(self, &sc->sc_if);
/*
* Power down the socket.
*/
pmf_device_suspend_self(self);
- }
+ } else
+ aprint_error_dev(sc->sc_dev,
+ "couldn't establish power handler\n");
}
static int
diff -r 9d92f26698ae -r 3af44020b4a0 sys/dev/pci/if_wi_pci.c
--- a/sys/dev/pci/if_wi_pci.c Sat Sep 05 14:09:55 2009 +0000
+++ b/sys/dev/pci/if_wi_pci.c Sat Sep 05 14:13:50 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wi_pci.c,v 1.48 2009/05/12 08:23:01 cegger Exp $ */
+/* $NetBSD: if_wi_pci.c,v 1.49 2009/09/05 14:13:50 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wi_pci.c,v 1.48 2009/05/12 08:23:01 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wi_pci.c,v 1.49 2009/09/05 14:13:50 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -373,8 +373,8 @@
if (!wpp->wpp_chip)
sc->sc_reset = wi_pci_reset;
- if (!pmf_device_register(self, NULL, NULL))
- aprint_error_dev(self, "couldn't establish power handler\n");
+ if (pmf_device_register(self, NULL, NULL))
+ pmf_class_network_register(self, &sc->sc_if);
else
- pmf_class_network_register(self, &sc->sc_if);
+ aprint_error_dev(self, "couldn't establish power handler\n");
}
Home |
Main Index |
Thread Index |
Old Index