Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/isa Instead of directly referencing a parent device'...
details: https://anonhg.NetBSD.org/src/rev/8384390cdd7a
branches: trunk
changeset: 354369:8384390cdd7a
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Wed Jun 14 05:01:35 2017 +0000
description:
Instead of directly referencing a parent device's code (ie, pcppi_bell()
routine), let the parent device pass a pointer to the code (in the aux
config data). This allows us to load the spkr module without requiring
the pcppi parent device to exist. (The spkr device can also have an
audio as parent.)
diffstat:
sys/dev/isa/pcppi.c | 5 +++--
sys/dev/isa/pcppivar.h | 3 ++-
sys/dev/isa/spkr_pcppi.c | 8 +++++---
3 files changed, 10 insertions(+), 6 deletions(-)
diffs (86 lines):
diff -r 23bf86f0757a -r 8384390cdd7a sys/dev/isa/pcppi.c
--- a/sys/dev/isa/pcppi.c Wed Jun 14 02:33:37 2017 +0000
+++ b/sys/dev/isa/pcppi.c Wed Jun 14 05:01:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.44 2015/05/17 05:20:37 pgoyette Exp $ */
+/* $NetBSD: pcppi.c,v 1.45 2017/06/14 05:01:35 pgoyette Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.44 2015/05/17 05:20:37 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.45 2017/06/14 05:01:35 pgoyette Exp $");
#include "attimer.h"
@@ -246,6 +246,7 @@
return 0;
pa.pa_cookie = sc;
+ pa.pa_bell_func = pcppi_bell;
config_search_loc(pcppisearch, sc->sc_dv, "pcppi", NULL, &pa);
return 0;
diff -r 23bf86f0757a -r 8384390cdd7a sys/dev/isa/pcppivar.h
--- a/sys/dev/isa/pcppivar.h Wed Jun 14 02:33:37 2017 +0000
+++ b/sys/dev/isa/pcppivar.h Wed Jun 14 05:01:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppivar.h,v 1.11 2011/11/23 23:07:32 jmcneill Exp $ */
+/* $NetBSD: pcppivar.h,v 1.12 2017/06/14 05:01:35 pgoyette Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -34,6 +34,7 @@
struct pcppi_attach_args {
pcppi_tag_t pa_cookie;
+ void (*pa_bell_func)(pcppi_tag_t, int, int, int);
};
struct pcppi_softc {
diff -r 23bf86f0757a -r 8384390cdd7a sys/dev/isa/spkr_pcppi.c
--- a/sys/dev/isa/spkr_pcppi.c Wed Jun 14 02:33:37 2017 +0000
+++ b/sys/dev/isa/spkr_pcppi.c Wed Jun 14 05:01:35 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spkr_pcppi.c,v 1.10 2017/06/11 21:54:22 pgoyette Exp $ */
+/* $NetBSD: spkr_pcppi.c,v 1.11 2017/06/14 05:01:35 pgoyette Exp $ */
/*
* Copyright (c) 1990 Eric S. Raymond (esr%snark.thyrsus.com@localhost)
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c,v 1.10 2017/06/11 21:54:22 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c,v 1.11 2017/06/14 05:01:35 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -66,6 +66,7 @@
struct spkr_pcppi_softc {
struct spkr_softc sc_spkr;
pcppi_tag_t sc_pcppicookie;
+ void (*sc_bell_func)(pcppi_tag_t, int, int, int);
};
static int spkr_pcppi_probe(device_t, cfdata_t, void *);
@@ -88,7 +89,7 @@
aprint_debug_dev(self, "%s: %u %u\n", __func__, xhz, ticks);
#endif /* SPKRDEBUG */
struct spkr_pcppi_softc *sc = device_private(self);
- pcppi_bell(sc->sc_pcppicookie, xhz, ticks, PCPPI_BELL_SLEEP);
+ (*sc->sc_bell_func)(sc->sc_pcppicookie, xhz, ticks, PCPPI_BELL_SLEEP);
}
/* rest for given number of ticks */
@@ -123,6 +124,7 @@
aprint_normal(": PC Speaker\n");
sc->sc_pcppicookie = pa->pa_cookie;
+ sc->sc_bell_func = pa->pa_bell_func;
spkr_attach(self, spkr_pcppi_tone, spkr_pcppi_rest);
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
Home |
Main Index |
Thread Index |
Old Index