Module Name: src Committed By: pgoyette Date: Wed Jun 14 05:01:35 UTC 2017
Modified Files: src/sys/dev/isa: pcppi.c pcppivar.h spkr_pcppi.c Log Message: 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.) To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/dev/isa/pcppi.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/isa/pcppivar.h cvs rdiff -u -r1.10 -r1.11 src/sys/dev/isa/spkr_pcppi.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/isa/pcppi.c diff -u src/sys/dev/isa/pcppi.c:1.44 src/sys/dev/isa/pcppi.c:1.45 --- src/sys/dev/isa/pcppi.c:1.44 Sun May 17 05:20:37 2015 +++ src/sys/dev/isa/pcppi.c Wed Jun 14 05:01:35 2017 @@ -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 @@ pcppi_rescan(device_t self, const char * return 0; pa.pa_cookie = sc; + pa.pa_bell_func = pcppi_bell; config_search_loc(pcppisearch, sc->sc_dv, "pcppi", NULL, &pa); return 0; Index: src/sys/dev/isa/pcppivar.h diff -u src/sys/dev/isa/pcppivar.h:1.11 src/sys/dev/isa/pcppivar.h:1.12 --- src/sys/dev/isa/pcppivar.h:1.11 Wed Nov 23 23:07:32 2011 +++ src/sys/dev/isa/pcppivar.h Wed Jun 14 05:01:35 2017 @@ -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 @@ typedef void *pcppi_tag_t; struct pcppi_attach_args { pcppi_tag_t pa_cookie; + void (*pa_bell_func)(pcppi_tag_t, int, int, int); }; struct pcppi_softc { Index: src/sys/dev/isa/spkr_pcppi.c diff -u src/sys/dev/isa/spkr_pcppi.c:1.10 src/sys/dev/isa/spkr_pcppi.c:1.11 --- src/sys/dev/isa/spkr_pcppi.c:1.10 Sun Jun 11 21:54:22 2017 +++ src/sys/dev/isa/spkr_pcppi.c Wed Jun 14 05:01:35 2017 @@ -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 (e...@snark.thyrsus.com) @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c 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 @@ spkr_pcppi_tone(device_t self, u_int xhz 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 @@ spkr_pcppi_attach(device_t parent, devic 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");