Source-Changes-HG archive

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

[src/trunk]: src/sys/dev move the pmf_device_register() for midi.c and midi_p...



details:   https://anonhg.NetBSD.org/src/rev/1fedc268e85a
branches:  trunk
changeset: 778581:1fedc268e85a
user:      plunky <plunky%NetBSD.org@localhost>
date:      Thu Apr 05 20:13:34 2012 +0000

description:
move the pmf_device_register() for midi.c and midi_pcppi.c to midi_attach()
for symmetry, since it is removed in midi detach code

and don't need to call device_pmf_is_registered() before registering it

diffstat:

 sys/dev/isa/midi_pcppi.c |   8 ++------
 sys/dev/midi.c           |  11 +++++------
 2 files changed, 7 insertions(+), 12 deletions(-)

diffs (68 lines):

diff -r b5cb116bc596 -r 1fedc268e85a sys/dev/isa/midi_pcppi.c
--- a/sys/dev/isa/midi_pcppi.c  Thu Apr 05 20:12:09 2012 +0000
+++ b/sys/dev/isa/midi_pcppi.c  Thu Apr 05 20:13:34 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: midi_pcppi.c,v 1.24 2011/11/23 23:07:32 jmcneill Exp $ */
+/*     $NetBSD: midi_pcppi.c,v 1.25 2012/04/05 20:13:35 plunky Exp $   */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: midi_pcppi.c,v 1.24 2011/11/23 23:07:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: midi_pcppi.c,v 1.25 2012/04/05 20:13:35 plunky Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -106,10 +106,6 @@
 
        midisyn_attach(&sc->sc_mididev, ms);
        midi_attach(&sc->sc_mididev, parent);
-        if (!device_pmf_is_registered(self))
-               if (!pmf_device_register(self, NULL, NULL))
-                       aprint_error_dev(self,
-                           "couldn't establish power handler\n"); 
 }
 
 static int
diff -r b5cb116bc596 -r 1fedc268e85a sys/dev/midi.c
--- a/sys/dev/midi.c    Thu Apr 05 20:12:09 2012 +0000
+++ b/sys/dev/midi.c    Thu Apr 05 20:13:34 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: midi.c,v 1.75 2012/01/10 17:53:51 njoly Exp $  */
+/*     $NetBSD: midi.c,v 1.76 2012/04/05 20:13:34 plunky Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.75 2012/01/10 17:53:51 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: midi.c,v 1.76 2012/04/05 20:13:34 plunky Exp $");
 
 #include "midi.h"
 #include "sequencer.h"
@@ -166,10 +166,6 @@
        sc->hw_if = hwp;
        sc->hw_hdl = hdlp;
        midi_attach(sc, parent);
-        if (!device_pmf_is_registered(self))
-               if (!pmf_device_register(self, NULL, NULL))
-                       aprint_error_dev(self,
-                           "couldn't establish power handler\n"); 
 }
 
 static int
@@ -296,6 +292,9 @@
        
        aprint_naive("\n");
        aprint_normal(": %s\n", mi.name);
+
+       if (!pmf_device_register(sc->dev, NULL, NULL))
+               aprint_error_dev(sc->dev, "couldn't establish power handler\n"); 
 }
 
 void



Home | Main Index | Thread Index | Old Index