Module Name:    src
Committed By:   tsutsui
Date:           Sat Sep  5 14:19:30 UTC 2009

Modified Files:
        src/sys/dev/ic: atw.c elinkxl.c rt2560.c rt2661.c tulip.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/dev/ic/atw.c
cvs rdiff -u -r1.107 -r1.108 src/sys/dev/ic/elinkxl.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/rt2560.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/rt2661.c
cvs rdiff -u -r1.171 -r1.172 src/sys/dev/ic/tulip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/atw.c
diff -u src/sys/dev/ic/atw.c:1.143 src/sys/dev/ic/atw.c:1.144
--- src/sys/dev/ic/atw.c:1.143	Tue May 26 23:57:34 2009
+++ src/sys/dev/ic/atw.c	Sat Sep  5 14:19:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: atw.c,v 1.143 2009/05/26 23:57:34 dyoung Exp $  */
+/*	$NetBSD: atw.c,v 1.144 2009/09/05 14:19:30 tsutsui Exp $  */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.143 2009/05/26 23:57:34 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.144 2009/09/05 14:19:30 tsutsui Exp $");
 
 #include "bpfilter.h"
 
@@ -858,11 +858,11 @@
 	    sizeof(struct ieee80211_frame) + 64, &sc->sc_radiobpf);
 #endif
 
-	if (!pmf_device_register1(sc->sc_dev, NULL, NULL, atw_shutdown)) {
+	if (pmf_device_register1(sc->sc_dev, NULL, NULL, atw_shutdown))
+		pmf_class_network_register(sc->sc_dev, &sc->sc_if);
+	else
 		aprint_error_dev(sc->sc_dev,
 		    "couldn't establish power handler\n");
-	} else
-		pmf_class_network_register(sc->sc_dev, &sc->sc_if);
 
 	memset(&sc->sc_rxtapu, 0, sizeof(sc->sc_rxtapu));
 	sc->sc_rxtap.ar_ihdr.it_len = htole16(sizeof(sc->sc_rxtapu));

Index: src/sys/dev/ic/elinkxl.c
diff -u src/sys/dev/ic/elinkxl.c:1.107 src/sys/dev/ic/elinkxl.c:1.108
--- src/sys/dev/ic/elinkxl.c:1.107	Wed Dec  3 15:36:11 2008
+++ src/sys/dev/ic/elinkxl.c	Sat Sep  5 14:19:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elinkxl.c,v 1.107 2008/12/03 15:36:11 tsutsui Exp $	*/
+/*	$NetBSD: elinkxl.c,v 1.108 2009/09/05 14:19:30 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.107 2008/12/03 15:36:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.108 2009/09/05 14:19:30 tsutsui Exp $");
 
 #include "bpfilter.h"
 #include "rnd.h"
@@ -448,10 +448,11 @@
 			  RND_TYPE_NET, 0);
 #endif
 
-	if (!pmf_device_register1(sc->sc_dev, NULL, NULL, ex_shutdown))
-		aprint_error_dev(sc->sc_dev, "couldn't establish power handler\n");
-	else
+	if (pmf_device_register1(sc->sc_dev, NULL, NULL, ex_shutdown))
 		pmf_class_network_register(sc->sc_dev, &sc->sc_ethercom.ec_if);
+	else
+		aprint_error_dev(sc->sc_dev,
+		    "couldn't establish power handler\n");
 
 	/* The attach is successful. */
 	sc->ex_flags |= EX_FLAGS_ATTACHED;

Index: src/sys/dev/ic/rt2560.c
diff -u src/sys/dev/ic/rt2560.c:1.20 src/sys/dev/ic/rt2560.c:1.21
--- src/sys/dev/ic/rt2560.c:1.20	Fri Nov  7 00:20:02 2008
+++ src/sys/dev/ic/rt2560.c	Sat Sep  5 14:19:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rt2560.c,v 1.20 2008/11/07 00:20:02 dyoung Exp $	*/
+/*	$NetBSD: rt2560.c,v 1.21 2009/09/05 14:19:30 tsutsui Exp $	*/
 /*	$OpenBSD: rt2560.c,v 1.15 2006/04/20 20:31:12 miod Exp $  */
 /*	$FreeBSD: rt2560.c,v 1.3 2006/03/21 21:15:43 damien Exp $*/
 
@@ -24,7 +24,7 @@
  * http://www.ralinktech.com/
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.20 2008/11/07 00:20:02 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.21 2009/09/05 14:19:30 tsutsui Exp $");
 
 #include "bpfilter.h"
 
@@ -484,10 +484,11 @@
 
 	ieee80211_announce(ic);
 
-	if (!pmf_device_register(&sc->sc_dev, NULL, NULL))
-		aprint_error_dev(&sc->sc_dev, "couldn't establish power handler\n");
-	else
+	if (pmf_device_register(&sc->sc_dev, NULL, NULL))
 		pmf_class_network_register(&sc->sc_dev, ifp);
+	else
+		aprint_error_dev(&sc->sc_dev,
+		    "couldn't establish power handler\n");
 
 	return 0;
 

Index: src/sys/dev/ic/rt2661.c
diff -u src/sys/dev/ic/rt2661.c:1.25 src/sys/dev/ic/rt2661.c:1.26
--- src/sys/dev/ic/rt2661.c:1.25	Fri Nov  7 00:20:03 2008
+++ src/sys/dev/ic/rt2661.c	Sat Sep  5 14:19:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rt2661.c,v 1.25 2008/11/07 00:20:03 dyoung Exp $	*/
+/*	$NetBSD: rt2661.c,v 1.26 2009/09/05 14:19:30 tsutsui Exp $	*/
 /*	$OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $	*/
 /*	$FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $	*/
 
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.25 2008/11/07 00:20:03 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.26 2009/09/05 14:19:30 tsutsui Exp $");
 
 #include "bpfilter.h"
 
@@ -368,10 +368,11 @@
 
 	ieee80211_announce(ic);
 
-	if (!pmf_device_register(&sc->sc_dev, NULL, NULL))
-		aprint_error_dev(&sc->sc_dev, "couldn't establish power handler\n");
-	else
+	if (pmf_device_register(&sc->sc_dev, NULL, NULL))
 		pmf_class_network_register(&sc->sc_dev, ifp);
+	else
+		aprint_error_dev(&sc->sc_dev,
+		    "couldn't establish power handler\n");
 
 	return 0;
 

Index: src/sys/dev/ic/tulip.c
diff -u src/sys/dev/ic/tulip.c:1.171 src/sys/dev/ic/tulip.c:1.172
--- src/sys/dev/ic/tulip.c:1.171	Tue Sep  1 21:46:52 2009
+++ src/sys/dev/ic/tulip.c	Sat Sep  5 14:19:30 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tulip.c,v 1.171 2009/09/01 21:46:52 jmcneill Exp $	*/
+/*	$NetBSD: tulip.c,v 1.172 2009/09/05 14:19:30 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.171 2009/09/01 21:46:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.172 2009/09/05 14:19:30 tsutsui Exp $");
 
 #include "bpfilter.h"
 
@@ -535,10 +535,10 @@
 	    RND_TYPE_NET, 0);
 #endif
 
-	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 0;
 

Reply via email to