Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Invert logic around nested pmf(9) registrations f...



details:   https://anonhg.NetBSD.org/src/rev/f5d909286b90
branches:  trunk
changeset: 747206:f5d909286b90
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Sep 05 14:19:30 2009 +0000

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

diffstat:

 sys/dev/ic/atw.c     |  10 +++++-----
 sys/dev/ic/elinkxl.c |  11 ++++++-----
 sys/dev/ic/rt2560.c  |  11 ++++++-----
 sys/dev/ic/rt2661.c  |  11 ++++++-----
 sys/dev/ic/tulip.c   |  10 +++++-----
 5 files changed, 28 insertions(+), 25 deletions(-)

diffs (164 lines):

diff -r 3af44020b4a0 -r f5d909286b90 sys/dev/ic/atw.c
--- a/sys/dev/ic/atw.c  Sat Sep 05 14:13:50 2009 +0000
+++ b/sys/dev/ic/atw.c  Sat Sep 05 14:19:30 2009 +0000
@@ -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));
diff -r 3af44020b4a0 -r f5d909286b90 sys/dev/ic/elinkxl.c
--- a/sys/dev/ic/elinkxl.c      Sat Sep 05 14:13:50 2009 +0000
+++ b/sys/dev/ic/elinkxl.c      Sat Sep 05 14:19:30 2009 +0000
@@ -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");
+       if (pmf_device_register1(sc->sc_dev, NULL, NULL, ex_shutdown))
+               pmf_class_network_register(sc->sc_dev, &sc->sc_ethercom.ec_if);
        else
-               pmf_class_network_register(sc->sc_dev, &sc->sc_ethercom.ec_if);
+               aprint_error_dev(sc->sc_dev,
+                   "couldn't establish power handler\n");
 
        /* The attach is successful. */
        sc->ex_flags |= EX_FLAGS_ATTACHED;
diff -r 3af44020b4a0 -r f5d909286b90 sys/dev/ic/rt2560.c
--- a/sys/dev/ic/rt2560.c       Sat Sep 05 14:13:50 2009 +0000
+++ b/sys/dev/ic/rt2560.c       Sat Sep 05 14:19:30 2009 +0000
@@ -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");
+       if (pmf_device_register(&sc->sc_dev, NULL, NULL))
+               pmf_class_network_register(&sc->sc_dev, ifp);
        else
-               pmf_class_network_register(&sc->sc_dev, ifp);
+               aprint_error_dev(&sc->sc_dev,
+                   "couldn't establish power handler\n");
 
        return 0;
 
diff -r 3af44020b4a0 -r f5d909286b90 sys/dev/ic/rt2661.c
--- a/sys/dev/ic/rt2661.c       Sat Sep 05 14:13:50 2009 +0000
+++ b/sys/dev/ic/rt2661.c       Sat Sep 05 14:19:30 2009 +0000
@@ -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");
+       if (pmf_device_register(&sc->sc_dev, NULL, NULL))
+               pmf_class_network_register(&sc->sc_dev, ifp);
        else
-               pmf_class_network_register(&sc->sc_dev, ifp);
+               aprint_error_dev(&sc->sc_dev,
+                   "couldn't establish power handler\n");
 
        return 0;
 
diff -r 3af44020b4a0 -r f5d909286b90 sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c        Sat Sep 05 14:13:50 2009 +0000
+++ b/sys/dev/ic/tulip.c        Sat Sep 05 14:19:30 2009 +0000
@@ -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))
+       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);
 
        return 0;
 



Home | Main Index | Thread Index | Old Index