Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Simplify device-activation hooks.



details:   https://anonhg.NetBSD.org/src/rev/7a2a9651b386
branches:  trunk
changeset: 749743:7a2a9651b386
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Sun Dec 06 23:14:05 2009 +0000

description:
Simplify device-activation hooks.

diffstat:

 sys/dev/pci/ifpci.c    |  18 ++++++------------
 sys/dev/pci/ifpci2.c   |  18 ++++++------------
 sys/dev/pci/isic_pci.c |  16 +++++-----------
 3 files changed, 17 insertions(+), 35 deletions(-)

diffs (147 lines):

diff -r f482522b771a -r 7a2a9651b386 sys/dev/pci/ifpci.c
--- a/sys/dev/pci/ifpci.c       Sun Dec 06 23:05:39 2009 +0000
+++ b/sys/dev/pci/ifpci.c       Sun Dec 06 23:14:05 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ifpci.c,v 1.29 2009/11/26 15:17:10 njoly Exp $     */
+/* $NetBSD: ifpci.c,v 1.30 2009/12/06 23:14:05 dyoung Exp $    */
 /*
  *   Copyright (c) 1999 Gary Jennejohn. All rights reserved.
  *
@@ -36,14 +36,14 @@
  *     Fritz!Card PCI driver
  *     ------------------------------------------------
  *
- *     $Id: ifpci.c,v 1.29 2009/11/26 15:17:10 njoly Exp $
+ *     $Id: ifpci.c,v 1.30 2009/12/06 23:14:05 dyoung Exp $
  *
  *      last edit-date: [Fri Jan  5 11:38:58 2001]
  *
  *---------------------------------------------------------------------------*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ifpci.c,v 1.29 2009/11/26 15:17:10 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ifpci.c,v 1.30 2009/12/06 23:14:05 dyoung Exp $");
 
 
 #include <sys/param.h>
@@ -412,23 +412,17 @@
 ifpci_activate(device_t self, enum devact act)
 {
        struct ifpci_softc *psc = device_private(self);
-       int error = 0, s;
 
-       s = splnet();
        switch (act) {
-       case DVACT_ACTIVATE:
-               error = EOPNOTSUPP;
-               break;
-
        case DVACT_DEACTIVATE:
                psc->sc_isic.sc_intr_valid = ISIC_INTR_DYING;
                isdn_layer2_status_ind(&psc->sc_isic.sc_l2, psc->sc_isic.sc_l3token, STI_ATTACH, 0);
                isdn_detach_isdnif(psc->sc_isic.sc_l3token);
                psc->sc_isic.sc_l3token = NULL;
-               break;
+               return 0;
+       default:
+               return EOPNOTSUPP;
        }
-       splx(s);
-       return (error);
 }
 
 /*---------------------------------------------------------------------------*
diff -r f482522b771a -r 7a2a9651b386 sys/dev/pci/ifpci2.c
--- a/sys/dev/pci/ifpci2.c      Sun Dec 06 23:05:39 2009 +0000
+++ b/sys/dev/pci/ifpci2.c      Sun Dec 06 23:14:05 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ifpci2.c,v 1.18 2009/11/26 15:17:10 njoly Exp $    */
+/* $NetBSD: ifpci2.c,v 1.19 2009/12/06 23:14:05 dyoung Exp $   */
 /*
  *   Copyright (c) 1999 Gary Jennejohn. All rights reserved.
  *
@@ -36,14 +36,14 @@
  *     Fritz!Card PCI driver
  *     ------------------------------------------------
  *
- *     $Id: ifpci2.c,v 1.18 2009/11/26 15:17:10 njoly Exp $
+ *     $Id: ifpci2.c,v 1.19 2009/12/06 23:14:05 dyoung Exp $
  *
  *      last edit-date: [Fri Jan  5 11:38:58 2001]
  *
  *---------------------------------------------------------------------------*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ifpci2.c,v 1.18 2009/11/26 15:17:10 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ifpci2.c,v 1.19 2009/12/06 23:14:05 dyoung Exp $");
 
 
 #include <sys/param.h>
@@ -371,23 +371,17 @@
 ifpci2_activate(device_t self, enum devact act)
 {
        struct ifpci_softc *psc = device_private(self);
-       int error = 0, s;
 
-       s = splnet();
        switch (act) {
-       case DVACT_ACTIVATE:
-               error = EOPNOTSUPP;
-               break;
-
        case DVACT_DEACTIVATE:
                psc->sc_isic.sc_intr_valid = ISIC_INTR_DYING;
                isdn_layer2_status_ind(&psc->sc_isic.sc_l2, psc->sc_isic.sc_l3token, STI_ATTACH, 0);
                isdn_detach_isdnif(psc->sc_isic.sc_l3token);
                psc->sc_isic.sc_l3token = NULL;
-               break;
+               return 0;
+       default:
+               return EOPNOTSUPP;
        }
-       splx(s);
-       return (error);
 }
 
 /*---------------------------------------------------------------------------*
diff -r f482522b771a -r 7a2a9651b386 sys/dev/pci/isic_pci.c
--- a/sys/dev/pci/isic_pci.c    Sun Dec 06 23:05:39 2009 +0000
+++ b/sys/dev/pci/isic_pci.c    Sun Dec 06 23:14:05 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isic_pci.c,v 1.36 2009/11/26 15:17:10 njoly Exp $ */
+/* $NetBSD: isic_pci.c,v 1.37 2009/12/06 23:14:05 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isic_pci.c,v 1.36 2009/11/26 15:17:10 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isic_pci.c,v 1.37 2009/12/06 23:14:05 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/errno.h>
@@ -313,19 +313,13 @@
 isic_pci_activate(device_t self, enum devact act)
 {
        struct pci_isic_softc *psc = device_private(self);
-       int error = 0, s;
 
-       s = splnet();
        switch (act) {
-       case DVACT_ACTIVATE:
-               error = EOPNOTSUPP;
-               break;
-
        case DVACT_DEACTIVATE:
                psc->sc_isic.sc_intr_valid = ISIC_INTR_DYING;
                isic_detach_bri(&psc->sc_isic);
-               break;
+               return 0;
+       default:
+               return EOPNOTSUPP;
        }
-       splx(s);
-       return (error);
 }



Home | Main Index | Thread Index | Old Index