Module Name:    src
Committed By:   tsutsui
Date:           Sat Sep  5 14:44:59 UTC 2009

Modified Files:
        src/sys/dev/pcmcia: if_an_pcmcia.c if_ne_pcmcia.c if_ray.c
            if_wi_pcmcia.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pcmcia/if_an_pcmcia.c
cvs rdiff -u -r1.156 -r1.157 src/sys/dev/pcmcia/if_ne_pcmcia.c
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pcmcia/if_ray.c
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pcmcia/if_wi_pcmcia.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/pcmcia/if_an_pcmcia.c
diff -u src/sys/dev/pcmcia/if_an_pcmcia.c:1.39 src/sys/dev/pcmcia/if_an_pcmcia.c:1.40
--- src/sys/dev/pcmcia/if_an_pcmcia.c:1.39	Tue May 12 14:42:18 2009
+++ src/sys/dev/pcmcia/if_an_pcmcia.c	Sat Sep  5 14:44:59 2009
@@ -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))
-		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;

Index: src/sys/dev/pcmcia/if_ne_pcmcia.c
diff -u src/sys/dev/pcmcia/if_ne_pcmcia.c:1.156 src/sys/dev/pcmcia/if_ne_pcmcia.c:1.157
--- src/sys/dev/pcmcia/if_ne_pcmcia.c:1.156	Sun Apr  5 03:37:07 2009
+++ src/sys/dev/pcmcia/if_ne_pcmcia.c	Sat Sep  5 14:44:59 2009
@@ -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);

Index: src/sys/dev/pcmcia/if_ray.c
diff -u src/sys/dev/pcmcia/if_ray.c:1.75 src/sys/dev/pcmcia/if_ray.c:1.76
--- src/sys/dev/pcmcia/if_ray.c:1.75	Tue May 12 14:42:18 2009
+++ src/sys/dev/pcmcia/if_ray.c	Sat Sep  5 14:44:59 2009
@@ -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))
-		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;

Index: src/sys/dev/pcmcia/if_wi_pcmcia.c
diff -u src/sys/dev/pcmcia/if_wi_pcmcia.c:1.84 src/sys/dev/pcmcia/if_wi_pcmcia.c:1.85
--- src/sys/dev/pcmcia/if_wi_pcmcia.c:1.84	Tue May 12 14:42:18 2009
+++ src/sys/dev/pcmcia/if_wi_pcmcia.c	Sat Sep  5 14:44:59 2009
@@ -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))
-		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;

Reply via email to