Subject: Re: merge of freebsd eventhandler
To: Brett Lymn <blymn@baesystems.com.au>
From: Brett Lymn <blymn@baesystems.com.au>
List: tech-kern
Date: 05/25/2006 23:16:20
--1UWUbFP1cBYEclgG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Thu, May 25, 2006 at 10:13:45PM +0930, Brett Lymn wrote:
>
> Attached is a diff and a couple of files that are an import of the
> FreeBSD eventhandler code with some extra extensions to suit NetBSD.
>
Attached is the same diff but ignoring the whitespace differences
(thanks uebayasi :)
--
Brett Lymn
--1UWUbFP1cBYEclgG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="eventq.diff"
? iostat_patch.tar.gz
? sys/arch/i386/compile/GENERIC
? sys/arch/i386/compile/ROVER
? sys/arch/i386/conf/ROVER
? sys/kern/subr_eventhandler.c
? sys/sys/eventhandler.h
Index: share/man/man9/powerhook_establish.9
===================================================================
RCS file: /cvsroot/src/share/man/man9/powerhook_establish.9,v
retrieving revision 1.5
diff -w -u -r1.5 powerhook_establish.9
--- share/man/man9/powerhook_establish.9 9 Dec 2002 13:22:48 -0000 1.5
+++ share/man/man9/powerhook_establish.9 25 May 2006 13:37:43 -0000
@@ -43,7 +43,7 @@
.Nd add or remove a power change hook
.Sh SYNOPSIS
.Ft void *
-.Fn powerhook_establish "void (*fn)(int why, void *a)" "void *arg"
+.Fn powerhook_establish "void (*fn)(void *a, int why)" "void *arg"
.Ft void
.Fn powerhook_disestablish "void *cookie"
.Sh DESCRIPTION
@@ -56,9 +56,9 @@
at power change.
When invoked, the hook function
.Fa fn
-will be passed the new power state as the first argument and
+will be passed
.Fa arg
-as its second argument.
+as the first argument and the new power state as its second argument.
.Pp
The
.Fn powerhook_disestablish
Index: sys/arch/acorn32/acorn32/hydra.c
===================================================================
RCS file: /cvsroot/src/sys/arch/acorn32/acorn32/hydra.c,v
retrieving revision 1.20
diff -w -u -r1.20 hydra.c
Index: sys/arch/hpcarm/dev/sed_saip.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcarm/dev/sed_saip.c,v
retrieving revision 1.18
diff -w -u -r1.18 sed_saip.c
--- sys/arch/hpcarm/dev/sed_saip.c 4 Mar 2006 16:51:56 -0000 1.18
+++ sys/arch/hpcarm/dev/sed_saip.c 25 May 2006 13:37:46 -0000
@@ -76,7 +76,7 @@
static paddr_t sed1356_mmap(void *, off_t, int);
static int sed1356_init(struct hpcfb_fbconf *);
-static void sed1356_power(int, void *);
+static void sed1356_power(void *, int);
static void sed1356_update_powerstate(struct sed1356_softc *, int);
static void sed1356_init_backlight(struct sed1356_softc *, int);
static void sed1356_set_brightness(struct sed1356_softc *, int);
@@ -304,7 +304,7 @@
}
static void
-sed1356_power(int why, void *arg)
+sed1356_power(void *arg, int why)
{
struct sed1356_softc *sc = arg;
Index: sys/arch/hpcmips/dev/ite8181.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcmips/dev/ite8181.c,v
retrieving revision 1.22
diff -w -u -r1.22 ite8181.c
--- sys/arch/hpcmips/dev/ite8181.c 11 Dec 2005 12:17:33 -0000 1.22
+++ sys/arch/hpcmips/dev/ite8181.c 25 May 2006 13:37:46 -0000
@@ -117,7 +117,7 @@
static void ite8181_ema_write_1(struct ite8181_softc *, int, int);
static int ite8181_ema_read_1(struct ite8181_softc *, int);
-static void ite8181_power(int, void *);
+static void ite8181_power(void *, int);
static int ite8181_hardpower(void *, int, long, void *);
static int ite8181_fbinit(struct hpcfb_fbconf *);
static int ite8181_ioctl(void *, u_long, caddr_t, int, struct lwp *);
@@ -445,7 +445,7 @@
}
static void
-ite8181_power(int why, void *arg)
+ite8181_power(void *arg, int why)
{
struct ite8181_softc *sc = arg;
Index: sys/arch/hpcmips/dev/mq200.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcmips/dev/mq200.c,v
retrieving revision 1.25
diff -w -u -r1.25 mq200.c
--- sys/arch/hpcmips/dev/mq200.c 11 Dec 2005 12:17:33 -0000 1.25
+++ sys/arch/hpcmips/dev/mq200.c 25 May 2006 13:37:46 -0000
@@ -62,7 +62,7 @@
/*
* function prototypes
*/
-static void mq200_power(int, void *);
+static void mq200_power(void *, int);
static int mq200_hardpower(void *, int, long, void *);
static int mq200_fbinit(struct hpcfb_fbconf *);
static int mq200_ioctl(void *, u_long, caddr_t, int, struct lwp *);
@@ -262,7 +262,7 @@
}
static void
-mq200_power(int why, void *arg)
+mq200_power(void *arg, int why)
{
struct mq200_softc *sc = arg;
Index: sys/arch/hpcmips/vr/vrpiu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcmips/vr/vrpiu.c,v
retrieving revision 1.35
diff -w -u -r1.35 vrpiu.c
--- sys/arch/hpcmips/vr/vrpiu.c 11 Dec 2005 12:17:35 -0000 1.35
+++ sys/arch/hpcmips/vr/vrpiu.c 25 May 2006 13:37:47 -0000
@@ -123,7 +123,7 @@
static void vrpiu_start_powerstate(void *);
static void vrpiu_calc_powerstate(struct vrpiu_softc *);
static void vrpiu_send_battery_event(struct vrpiu_softc *);
-static void vrpiu_power(int, void *);
+static void vrpiu_power(void *, int);
static u_int scan_interval(u_int data);
/* mra is defined in mra.c */
@@ -824,7 +824,7 @@
}
static void
-vrpiu_power(int why, void *arg)
+vrpiu_power(void *arg, int why)
{
struct vrpiu_softc *sc = arg;
Index: sys/arch/i386/bios/vesafb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/bios/vesafb.c,v
retrieving revision 1.15
diff -w -u -r1.15 vesafb.c
--- sys/arch/i386/bios/vesafb.c 24 Apr 2006 14:14:38 -0000 1.15
+++ sys/arch/i386/bios/vesafb.c 25 May 2006 13:37:47 -0000
@@ -78,7 +78,7 @@
int, long *);
static void vesafb_init(struct vesafb_softc *);
-static void vesafb_powerhook(int, void *);
+static void vesafb_powerhook(void *, int);
static int vesafb_svideo(struct vesafb_softc *, u_int *);
static int vesafb_gvideo(struct vesafb_softc *, u_int *);
@@ -549,7 +549,7 @@
}
static void
-vesafb_powerhook(int why, void *opaque)
+vesafb_powerhook(void *opaque, int why)
{
#if notyet
struct vesafb_softc *sc;
Index: sys/arch/macppc/dev/if_wi_obio.c
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/dev/if_wi_obio.c,v
retrieving revision 1.12
diff -w -u -r1.12 if_wi_obio.c
--- sys/arch/macppc/dev/if_wi_obio.c 11 Dec 2005 12:18:03 -0000 1.12
+++ sys/arch/macppc/dev/if_wi_obio.c 25 May 2006 13:37:48 -0000
@@ -57,7 +57,7 @@
void wi_obio_attach(struct device *, struct device *, void *);
int wi_obio_enable(struct wi_softc *);
void wi_obio_disable(struct wi_softc *);
-void wi_obio_powerhook(int, void *);
+void wi_obio_powerhook(void *, int);
void wi_obio_shutdown(void *);
struct wi_obio_softc {
@@ -179,9 +179,7 @@
}
void
-wi_obio_powerhook(why, arg)
- int why;
- void *arg;
+wi_obio_powerhook(void *arg, int why)
{
struct wi_softc *sc = arg;
Index: sys/arch/mips/atheros/dev/if_ae.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/atheros/dev/if_ae.c,v
retrieving revision 1.2
diff -w -u -r1.2 if_ae.c
--- sys/arch/mips/atheros/dev/if_ae.c 5 May 2006 18:04:41 -0000 1.2
+++ sys/arch/mips/atheros/dev/if_ae.c 25 May 2006 13:37:48 -0000
@@ -180,7 +180,7 @@
static int ae_enable(struct ae_softc *);
static void ae_disable(struct ae_softc *);
-static void ae_power(int, void *);
+static void ae_power(void *, int);
static void ae_filter_setup(struct ae_softc *);
@@ -1545,7 +1545,7 @@
* Power management (suspend/resume) hook.
*/
static void
-ae_power(int why, void *arg)
+ae_power(void *arg, int why)
{
struct ae_softc *sc = arg;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
Index: sys/conf/files
===================================================================
RCS file: /cvsroot/src/sys/conf/files,v
retrieving revision 1.775
diff -w -u -r1.775 files
--- sys/conf/files 18 May 2006 09:05:51 -0000 1.775
+++ sys/conf/files 25 May 2006 13:37:51 -0000
@@ -1256,6 +1256,7 @@
file kern/subr_bufq.c
file kern/subr_devsw.c
file kern/subr_disk.c
+file kern/subr_eventhandler.c
file kern/subr_iostat.c
file kern/subr_evcnt.c
file kern/subr_extent.c
Index: sys/dev/ata/ata.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ata/ata.c,v
retrieving revision 1.74
diff -w -u -r1.74 ata.c
--- sys/dev/ata/ata.c 29 Mar 2006 04:16:48 -0000 1.74
+++ sys/dev/ata/ata.c 25 May 2006 13:37:51 -0000
@@ -105,7 +105,7 @@
extern struct cfdriver atabus_cd;
-static void atabus_powerhook(int, void *);
+static void atabus_powerhook(void *, int);
/*
* atabusprint:
@@ -1429,7 +1429,7 @@
};
static void
-atabus_powerhook(int why, void *hdl)
+atabus_powerhook(void *hdl, int why)
{
struct atabus_softc *sc = (struct atabus_softc *)hdl;
struct ata_channel *chp = sc->sc_chan;
Index: sys/dev/hpc/bivideo.c
===================================================================
RCS file: /cvsroot/src/sys/dev/hpc/bivideo.c,v
retrieving revision 1.22
diff -w -u -r1.22 bivideo.c
--- sys/dev/hpc/bivideo.c 29 Mar 2006 06:37:35 -0000 1.22
+++ sys/dev/hpc/bivideo.c 25 May 2006 13:37:52 -0000
@@ -104,7 +104,7 @@
};
static int bivideo_init(struct hpcfb_fbconf *);
-static void bivideo_power(int, void *);
+static void bivideo_power(void *, int);
static void bivideo_update_powerstate(struct bivideo_softc *, int);
void bivideo_init_backlight(struct bivideo_softc *, int);
void bivideo_init_brightness(struct bivideo_softc *, int);
@@ -334,7 +334,7 @@
}
static void
-bivideo_power(int why, void *arg)
+bivideo_power(void *arg, int why)
{
struct bivideo_softc *sc = arg;
Index: sys/dev/hpc/hpcfb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/hpc/hpcfb.c,v
retrieving revision 1.36
diff -w -u -r1.36 hpcfb.c
--- sys/dev/hpc/hpcfb.c 12 Apr 2006 19:38:23 -0000 1.36
+++ sys/dev/hpc/hpcfb.c 25 May 2006 13:37:52 -0000
@@ -200,7 +200,7 @@
static int hpcfb_show_screen(void *, void *, int,
void (*) (void *, int, int), void *);
static void hpcfb_pollc(void *, int);
-static void hpcfb_power(int, void *);
+static void hpcfb_power(void *, int);
static void hpcfb_cmap_reorder(struct hpcfb_fbconf *,
struct hpcfb_devconfig *);
@@ -633,7 +633,7 @@
}
static void
-hpcfb_power(int why, void *arg)
+hpcfb_power(void *arg, int why)
{
struct hpcfb_softc *sc = arg;
Index: sys/dev/ic/an.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/an.c,v
retrieving revision 1.43
diff -w -u -r1.43 an.c
--- sys/dev/ic/an.c 14 May 2006 21:42:27 -0000 1.43
+++ sys/dev/ic/an.c 25 May 2006 13:37:53 -0000
@@ -449,7 +449,7 @@
}
void
-an_power(int why, void *arg)
+an_power(void *arg, int why)
{
int s;
struct an_softc *sc = arg;
Index: sys/dev/ic/anvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/anvar.h,v
retrieving revision 1.13
diff -w -u -r1.13 anvar.h
--- sys/dev/ic/anvar.h 19 Feb 2006 08:20:02 -0000 1.13
+++ sys/dev/ic/anvar.h 25 May 2006 13:37:53 -0000
@@ -165,7 +165,7 @@
int an_attach(struct an_softc *);
int an_detach(struct an_softc *);
int an_activate(struct device *, enum devact);
-void an_power(int, void *);
+void an_power(void *, int);
void an_shutdown(struct an_softc *);
int an_intr(void *);
Index: sys/dev/ic/ath.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/ath.c,v
retrieving revision 1.72
diff -w -u -r1.72 ath.c
--- sys/dev/ic/ath.c 11 May 2006 22:26:54 -0000 1.72
+++ sys/dev/ic/ath.c 25 May 2006 13:37:54 -0000
@@ -196,7 +196,7 @@
#ifdef __NetBSD__
int ath_enable(struct ath_softc *);
void ath_disable(struct ath_softc *);
-void ath_power(int, void *);
+void ath_power(void *, int);
#endif
#if NBPFILTER > 0
@@ -715,7 +715,7 @@
#ifdef __NetBSD__
void
-ath_power(int why, void *arg)
+ath_power(void *arg, int why)
{
struct ath_softc *sc = arg;
int s;
Index: sys/dev/ic/athvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/athvar.h,v
retrieving revision 1.16
diff -w -u -r1.16 athvar.h
--- sys/dev/ic/athvar.h 2 Apr 2006 05:52:50 -0000 1.16
+++ sys/dev/ic/athvar.h 25 May 2006 13:37:54 -0000
@@ -308,7 +308,7 @@
void ath_resume(struct ath_softc *, int);
void ath_suspend(struct ath_softc *, int);
int ath_activate(struct device *, enum devact);
-void ath_power(int, void *);
+void ath_power(void *, int);
void ath_shutdown(void *);
int ath_intr(void *);
int ath_reset(struct ifnet *);
Index: sys/dev/ic/atw.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/atw.c,v
retrieving revision 1.117
diff -w -u -r1.117 atw.c
--- sys/dev/ic/atw.c 6 Apr 2006 06:08:26 -0000 1.117
+++ sys/dev/ic/atw.c 25 May 2006 13:37:55 -0000
@@ -211,7 +211,7 @@
/* Device (de)activation and power state */
void atw_disable(struct atw_softc *);
int atw_enable(struct atw_softc *);
-void atw_power(int, void *);
+void atw_power(void *, int);
void atw_reset(struct atw_softc *);
void atw_shutdown(void *);
@@ -3803,7 +3803,7 @@
* Power management (suspend/resume) hook.
*/
void
-atw_power(int why, void *arg)
+atw_power(void *arg, int why)
{
struct atw_softc *sc = arg;
struct ifnet *ifp = &sc->sc_if;
Index: sys/dev/ic/atwvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/atwvar.h,v
retrieving revision 1.21
diff -w -u -r1.21 atwvar.h
--- sys/dev/ic/atwvar.h 8 Mar 2006 08:26:50 -0000 1.21
+++ sys/dev/ic/atwvar.h 25 May 2006 13:37:56 -0000
@@ -453,7 +453,7 @@
int atw_detach(struct atw_softc *);
int atw_activate(struct device *, enum devact);
int atw_intr(void *arg);
-void atw_power(int, void *);
+void atw_power(void *, int);
void atw_shutdown(void *);
#endif /* _DEV_IC_ATWVAR_H_ */
Index: sys/dev/ic/awi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/awi.c,v
retrieving revision 1.70
diff -w -u -r1.70 awi.c
--- sys/dev/ic/awi.c 14 Apr 2006 20:33:57 -0000 1.70
+++ sys/dev/ic/awi.c 25 May 2006 13:37:56 -0000
@@ -417,7 +417,7 @@
}
void
-awi_power(int why, void *arg)
+awi_power(void *arg, int why)
{
struct awi_softc *sc = arg;
struct ifnet *ifp = &sc->sc_if;
Index: sys/dev/ic/awivar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/awivar.h,v
retrieving revision 1.22
diff -w -u -r1.22 awivar.h
--- sys/dev/ic/awivar.h 11 Dec 2005 12:21:26 -0000 1.22
+++ sys/dev/ic/awivar.h 25 May 2006 13:37:56 -0000
@@ -154,7 +154,7 @@
int awi_detach(struct awi_softc *);
#ifdef __NetBSD__
int awi_activate(struct device *, enum devact);
-void awi_power(int, void *);
+void awi_power(void *, int);
#endif
void awi_shutdown(void *);
int awi_intr(void *);
Index: sys/dev/ic/cs89x0.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/cs89x0.c,v
retrieving revision 1.19
diff -w -u -r1.19 cs89x0.c
--- sys/dev/ic/cs89x0.c 18 Mar 2006 18:44:16 -0000 1.19
+++ sys/dev/ic/cs89x0.c 25 May 2006 13:37:57 -0000
@@ -289,7 +289,7 @@
static int cs_enable(struct cs_softc *);
static void cs_disable(struct cs_softc *);
static void cs_stop(struct ifnet *, int);
-static void cs_power(int, void *);
+static void cs_power(void *, int);
static int cs_scan_eeprom(struct cs_softc *);
static int cs_read_pktpg_from_eeprom(struct cs_softc *, int, u_int16_t *);
@@ -2219,7 +2219,7 @@
}
static void
-cs_power(int why, void *arg)
+cs_power(void *arg, int why)
{
struct cs_softc *sc = arg;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
Index: sys/dev/ic/elinkxl.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/elinkxl.c,v
retrieving revision 1.88
diff -w -u -r1.88 elinkxl.c
--- sys/dev/ic/elinkxl.c 21 May 2006 23:56:09 -0000 1.88
+++ sys/dev/ic/elinkxl.c 25 May 2006 13:37:57 -0000
@@ -105,7 +105,7 @@
void ex_printstats(struct ex_softc *);
void ex_tick(void *);
-void ex_power(int, void *);
+void ex_power(void *, int);
static int ex_eeprom_busy(struct ex_softc *);
static int ex_add_rxbuf(struct ex_softc *, struct ex_rxdesc *);
@@ -1951,9 +1951,7 @@
}
void
-ex_power(why, arg)
- int why;
- void *arg;
+ex_power(void *arg, int why)
{
struct ex_softc *sc = (void *)arg;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
Index: sys/dev/ic/gem.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/gem.c,v
retrieving revision 1.45
diff -w -u -r1.45 gem.c
--- sys/dev/ic/gem.c 2 Jan 2006 05:46:25 -0000 1.45
+++ sys/dev/ic/gem.c 25 May 2006 13:37:57 -0000
@@ -120,7 +120,7 @@
int gem_eint(struct gem_softc *, u_int);
int gem_rint(struct gem_softc *);
int gem_tint(struct gem_softc *);
-void gem_power(int, void *);
+void gem_power(void *, int);
#ifdef GEM_DEBUG
#define DPRINTF(sc, x) if ((sc)->sc_ethercom.ec_if.if_flags & IFF_DEBUG) \
@@ -2181,9 +2181,7 @@
* Power management (suspend/resume) hook.
*/
void
-gem_power(why, arg)
- int why;
- void *arg;
+gem_power(void *arg, int why)
{
struct gem_softc *sc = arg;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
Index: sys/dev/ic/i82365.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/i82365.c,v
retrieving revision 1.94
diff -w -u -r1.94 i82365.c
--- sys/dev/ic/i82365.c 14 Apr 2006 20:48:53 -0000 1.94
+++ sys/dev/ic/i82365.c 25 May 2006 13:37:58 -0000
@@ -104,7 +104,7 @@
void pcic_event_thread(void *);
void pcic_queue_event(struct pcic_handle *, int);
-void pcic_power(int, void *);
+void pcic_power(void *, int);
static int pcic_wait_ready(struct pcic_handle *);
static void pcic_delay(struct pcic_handle *, int, const char *);
@@ -350,9 +350,7 @@
}
void
-pcic_power(why, arg)
- int why;
- void *arg;
+pcic_power(void *arg, int why)
{
struct pcic_handle *h = (struct pcic_handle *)arg;
struct pcic_softc *sc = (struct pcic_softc *)h->ph_parent;
Index: sys/dev/ic/i82557.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/i82557.c,v
retrieving revision 1.97
diff -w -u -r1.97 i82557.c
--- sys/dev/ic/i82557.c 20 Feb 2006 16:50:37 -0000 1.97
+++ sys/dev/ic/i82557.c 25 May 2006 13:37:59 -0000
@@ -208,7 +208,7 @@
void fxp_load_ucode(struct fxp_softc *);
void fxp_shutdown(void *);
-void fxp_power(int, void *);
+void fxp_power(void *, int);
int fxp_copy_small = 0;
@@ -557,7 +557,7 @@
* clobber kernel memory at the wrong time.
*/
void
-fxp_power(int why, void *arg)
+fxp_power(void *arg, int why)
{
struct fxp_softc *sc = arg;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
Index: sys/dev/ic/rtl8169.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/rtl8169.c,v
retrieving revision 1.23
diff -w -u -r1.23 rtl8169.c
--- sys/dev/ic/rtl8169.c 16 May 2006 22:39:24 -0000 1.23
+++ sys/dev/ic/rtl8169.c 25 May 2006 13:37:59 -0000
@@ -170,7 +170,7 @@
static void re_shutdown(void *);
static int re_enable(struct rtk_softc *);
static void re_disable(struct rtk_softc *);
-static void re_power(int, void *);
+static void re_power(void *, int);
static int re_ifmedia_upd(struct ifnet *);
static void re_ifmedia_sts(struct ifnet *, struct ifmediareq *);
@@ -983,7 +983,7 @@
* Power management (suspend/resume) hook.
*/
void
-re_power(int why, void *arg)
+re_power(void *arg, int why)
{
struct rtk_softc *sc = (void *) arg;
struct ifnet *ifp = &sc->ethercom.ec_if;
Index: sys/dev/ic/rtl81x9.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/rtl81x9.c,v
retrieving revision 1.52
diff -w -u -r1.52 rtl81x9.c
--- sys/dev/ic/rtl81x9.c 8 Dec 2005 18:06:42 -0000 1.52
+++ sys/dev/ic/rtl81x9.c 25 May 2006 13:38:00 -0000
@@ -157,7 +157,7 @@
STATIC int rtk_enable (struct rtk_softc *);
STATIC void rtk_disable (struct rtk_softc *);
-STATIC void rtk_power (int, void *);
+STATIC void rtk_power (void *, int);
STATIC int rtk_list_tx_init(struct rtk_softc *);
@@ -942,9 +942,7 @@
* Power management (suspend/resume) hook.
*/
void
-rtk_power(why, arg)
- int why;
- void *arg;
+rtk_power(void *arg, int why)
{
struct rtk_softc *sc = (void *) arg;
struct ifnet *ifp = &sc->ethercom.ec_if;
Index: sys/dev/ic/rtw.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/rtw.c,v
retrieving revision 1.73
diff -w -u -r1.73 rtw.c
--- sys/dev/ic/rtw.c 14 May 2006 05:42:43 -0000 1.73
+++ sys/dev/ic/rtw.c 25 May 2006 13:38:00 -0000
@@ -3730,7 +3730,7 @@
}
void
-rtw_power(int why, void *arg)
+rtw_power(void *arg, int why)
{
struct rtw_softc *sc = arg;
struct ifnet *ifp = &sc->sc_if;
Index: sys/dev/ic/rtwvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/rtwvar.h,v
retrieving revision 1.29
diff -w -u -r1.29 rtwvar.h
--- sys/dev/ic/rtwvar.h 14 May 2006 04:08:09 -0000 1.29
+++ sys/dev/ic/rtwvar.h 25 May 2006 13:38:00 -0000
@@ -504,7 +504,7 @@
int rtw_enable(struct rtw_softc *);
int rtw_activate(struct device *, enum devact);
-void rtw_power(int, void *);
+void rtw_power(void *, int);
void rtw_shutdown(void *);
const char *rtw_pwrstate_string(enum rtw_pwrstate);
Index: sys/dev/ic/tulip.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/tulip.c,v
retrieving revision 1.144
diff -w -u -r1.144 tulip.c
--- sys/dev/ic/tulip.c 14 May 2006 21:42:27 -0000 1.144
+++ sys/dev/ic/tulip.c 25 May 2006 13:38:02 -0000
@@ -110,7 +110,7 @@
static int tlp_enable(struct tulip_softc *);
static void tlp_disable(struct tulip_softc *);
-static void tlp_power(int, void *);
+static void tlp_power(void *, int);
static void tlp_filter_setup(struct tulip_softc *);
static void tlp_winb_filter_setup(struct tulip_softc *);
@@ -2038,7 +2038,7 @@
* Power management (suspend/resume) hook.
*/
static void
-tlp_power(int why, void *arg)
+tlp_power(void *arg, int why)
{
struct tulip_softc *sc = arg;
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
@@ -6248,4 +6248,3 @@
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
}
}
-
Index: sys/dev/ieee1394/fwohci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ieee1394/fwohci.c,v
retrieving revision 1.99
diff -w -u -r1.99 fwohci.c
--- sys/dev/ieee1394/fwohci.c 3 May 2006 00:37:44 -0000 1.99
+++ sys/dev/ieee1394/fwohci.c 25 May 2006 13:38:03 -0000
@@ -233,7 +233,7 @@
static void fwohci_complete(void *, int);
#endif
#if defined(__NetBSD__)
-static void fwohci_power(int, void *);
+static void fwohci_power(void *, int);
int fwohci_print(void *, const char *);
#endif
@@ -1827,7 +1827,7 @@
#if defined(__NetBSD__)
static void
-fwohci_power(int why, void *arg)
+fwohci_power(void *arg, int why)
{
struct fwohci_softc *sc = arg;
int s;
Index: sys/dev/isa/sbdsp.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isa/sbdsp.c,v
retrieving revision 1.122
diff -w -u -r1.122 sbdsp.c
--- sys/dev/isa/sbdsp.c 14 May 2006 21:42:27 -0000 1.122
+++ sys/dev/isa/sbdsp.c 25 May 2006 13:38:04 -0000
@@ -231,7 +231,7 @@
int sbdsp_midi_intr(void *);
-static void sbdsp_powerhook(int, void*);
+static void sbdsp_powerhook(void*, int);
#ifdef AUDIO_DEBUG
void sb_printsc(struct sbdsp_softc *);
@@ -445,7 +445,7 @@
}
static void
-sbdsp_powerhook(int why, void *arg)
+sbdsp_powerhook(void *arg, int why)
{
struct sbdsp_softc *sc;
int i;
@@ -2419,4 +2419,3 @@
}
#endif
-
Index: sys/dev/isa/ym.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isa/ym.c,v
retrieving revision 1.27
diff -w -u -r1.27 ym.c
--- sys/dev/isa/ym.c 24 Dec 2005 20:27:41 -0000 1.27
+++ sys/dev/isa/ym.c 25 May 2006 13:38:04 -0000
@@ -159,7 +159,7 @@
#ifndef AUDIO_NO_POWER_CTL
static void ym_save_codec_regs(struct ym_softc *);
static void ym_restore_codec_regs(struct ym_softc *);
-void ym_power_hook(int, void *);
+void ym_power_hook(void *, int);
int ym_codec_power_ctl(void *, int);
static void ym_chip_powerdown(struct ym_softc *);
static void ym_chip_powerup(struct ym_softc *, int);
@@ -1104,14 +1104,14 @@
}
/*
- * Save and restore the state on suspending / resumning.
+ * Save and restore the state on suspending / resuming.
*
* XXX This is not complete.
* Currently only the parameters, such as output gain, are restored.
* DMA state should also be restored. FIXME.
*/
void
-ym_power_hook(int why, void *v)
+ym_power_hook(void *v, int why)
{
struct ym_softc *sc;
int i, xmax;
Index: sys/dev/pci/agp_i810.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/agp_i810.c,v
retrieving revision 1.30
diff -w -u -r1.30 agp_i810.c
--- sys/dev/pci/agp_i810.c 14 May 2006 21:45:00 -0000 1.30
+++ sys/dev/pci/agp_i810.c 25 May 2006 13:38:04 -0000
@@ -104,7 +104,7 @@
static int agp_i810_free_memory(struct agp_softc *, struct agp_memory *);
static int agp_i810_bind_memory(struct agp_softc *, struct agp_memory *, off_t);
static int agp_i810_unbind_memory(struct agp_softc *, struct agp_memory *);
-static void agp_i810_powerhook(int, void *);
+static void agp_i810_powerhook(void *, int);
static struct agp_methods agp_i810_methods = {
agp_i810_get_aperture,
@@ -756,7 +756,7 @@
}
static void
-agp_i810_powerhook(int why, void *arg)
+agp_i810_powerhook(void *arg, int why)
{
struct agp_softc *sc = (struct agp_softc *)arg;
struct agp_i810_softc *isc = sc->as_chipc;
Index: sys/dev/pci/agp_intel.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/agp_intel.c,v
retrieving revision 1.18
diff -w -u -r1.18 agp_intel.c
--- sys/dev/pci/agp_intel.c 11 Mar 2006 02:35:06 -0000 1.18
+++ sys/dev/pci/agp_intel.c 25 May 2006 13:38:04 -0000
@@ -74,7 +74,7 @@
static int agp_intel_bind_page(struct agp_softc *, off_t, bus_addr_t);
static int agp_intel_unbind_page(struct agp_softc *, off_t);
static void agp_intel_flush_tlb(struct agp_softc *);
-static void agp_intel_powerhook(int, void *);
+static void agp_intel_powerhook(void *, int);
static struct agp_methods agp_intel_methods = {
agp_intel_get_aperture,
@@ -393,7 +393,7 @@
}
static void
-agp_intel_powerhook(int why, void *opaque)
+agp_intel_powerhook(void *opaque, int why)
{
struct agp_softc *sc;
struct agp_intel_softc *isc;
Index: sys/dev/pci/auacer.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/auacer.c,v
retrieving revision 1.11
diff -w -u -r1.11 auacer.c
--- sys/dev/pci/auacer.c 11 Dec 2005 12:22:48 -0000 1.11
+++ sys/dev/pci/auacer.c 25 May 2006 13:38:04 -0000
@@ -194,7 +194,7 @@
struct auacer_dma *);
static int auacer_freemem(struct auacer_softc *, struct auacer_dma *);
-static void auacer_powerhook(int, void *);
+static void auacer_powerhook(void *, int);
static int auacer_set_rate(struct auacer_softc *, int, u_int);
static void auacer_reset(struct auacer_softc *sc);
@@ -1028,7 +1028,7 @@
}
static void
-auacer_powerhook(int why, void *addr)
+auacer_powerhook(void *addr, int why)
{
struct auacer_softc *sc;
Index: sys/dev/pci/auich.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/auich.c,v
retrieving revision 1.107
diff -w -u -r1.107 auich.c
--- sys/dev/pci/auich.c 27 Apr 2006 12:21:39 -0000 1.107
+++ sys/dev/pci/auich.c 25 May 2006 13:38:05 -0000
@@ -287,7 +287,7 @@
struct auich_dma *);
static int auich_freemem(struct auich_softc *, struct auich_dma *);
-static void auich_powerhook(int, void *);
+static void auich_powerhook(void *, int);
static int auich_set_rate(struct auich_softc *, int, u_long);
static int auich_sysctl_verify(SYSCTLFN_ARGS);
static void auich_finish_attach(struct device *);
@@ -755,7 +755,7 @@
sc->sc_audiodev = audio_attach_mi(&auich_hw_if, sc, &sc->sc_dev);
#if notyet
- auich_powerhook(PWR_SUSPEND, sc);
+ auich_powerhook(sc, PWR_SUSPEND);
#endif
return;
@@ -1430,10 +1430,10 @@
switch (state) {
case AUDIOPOWER_OFF:
- auich_powerhook(PWR_SUSPEND, sc);
+ auich_powerhook(sc, PWR_SUSPEND);
break;
case AUDIOPOWER_ON:
- auich_powerhook(PWR_RESUME, sc);
+ auich_powerhook(sc, PWR_RESUME);
break;
default:
aprint_error("%s: unknown power state %d\n",
@@ -1558,7 +1558,7 @@
}
static void
-auich_powerhook(int why, void *addr)
+auich_powerhook(void *addr, int why)
{
struct auich_softc *sc;
const int d0 = PCI_PWR_D0;
Index: sys/dev/pci/auixp.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/auixp.c,v
retrieving revision 1.13
diff -w -u -r1.13 auixp.c
--- sys/dev/pci/auixp.c 14 May 2006 21:45:00 -0000 1.13
+++ sys/dev/pci/auixp.c 25 May 2006 13:38:05 -0000
@@ -168,7 +168,7 @@
/* power management (do we support that already?) */
static int auixp_power(struct auixp_softc *, int);
#if 0
-static void auixp_powerhook(int, void *);
+static void auixp_powerhook(void *, int);
static int auixp_suspend(struct auixp_softc *);
static int auixp_resume(struct auixp_softc *);
#endif
@@ -1798,7 +1798,7 @@
#if 0
static void
-auixp_powerhook(int why, void *hdl)
+auixp_powerhook(void *hdl, int why)
{
struct auixp_softc *sc;
Index: sys/dev/pci/autri.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/autri.c,v
retrieving revision 1.30
diff -w -u -r1.30 autri.c
--- sys/dev/pci/autri.c 8 Mar 2006 23:46:27 -0000 1.30
+++ sys/dev/pci/autri.c 25 May 2006 13:38:06 -0000
@@ -97,7 +97,7 @@
static int autri_reset_codec(void *);
static enum ac97_host_flags autri_flags_codec(void *);
-static void autri_powerhook(int, void *);
+static void autri_powerhook(void *, int);
static int autri_init(void *);
static struct autri_dma *autri_find_dma(struct autri_softc *, void *);
static void autri_setup_channel(struct autri_softc *, int,
@@ -604,7 +604,7 @@
autri_match, autri_attach, NULL, NULL);
static void
-autri_powerhook(int why, void *addr)
+autri_powerhook(void *addr, int why)
{
struct autri_softc *sc;
Index: sys/dev/pci/auvia.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/auvia.c,v
retrieving revision 1.53
diff -w -u -r1.53 auvia.c
--- sys/dev/pci/auvia.c 28 Nov 2005 19:00:49 -0000 1.53
+++ sys/dev/pci/auvia.c 25 May 2006 13:38:06 -0000
@@ -116,7 +116,7 @@
static int auvia_trigger_input(void *, void *, void *, int,
void (*)(void *), void *,
const audio_params_t *);
-static void auvia_powerhook(int, void *);
+static void auvia_powerhook(void *, int);
static int auvia_intr(void *);
CFATTACH_DECL(auvia, sizeof (struct auvia_softc),
@@ -1062,7 +1062,7 @@
}
static void
-auvia_powerhook(int why, void *addr)
+auvia_powerhook(void *addr, int why)
{
struct auvia_softc *sc;
Index: sys/dev/pci/cs4280.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/cs4280.c,v
retrieving revision 1.38
diff -w -u -r1.38 cs4280.c
--- sys/dev/pci/cs4280.c 15 Apr 2006 21:20:47 -0000 1.38
+++ sys/dev/pci/cs4280.c 25 May 2006 13:38:06 -0000
@@ -109,7 +109,7 @@
static enum ac97_host_flags cs4280_flags_codec(void *);
/* For PowerHook */
-static void cs4280_power(int, void *);
+static void cs4280_power(void *, int);
/* Internal functions */
static const struct cs4280_card_t * cs4280_identify_card(struct pci_attach_args *);
@@ -899,7 +899,7 @@
/* Power Hook */
static void
-cs4280_power(int why, void *v)
+cs4280_power(void *v, int why)
{
static uint32_t pctl = 0, pba = 0, pfie = 0, pdtc = 0;
static uint32_t cctl = 0, cba = 0, cie = 0;
Index: sys/dev/pci/cs4281.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/cs4281.c,v
retrieving revision 1.28
diff -w -u -r1.28 cs4281.c
--- sys/dev/pci/cs4281.c 15 Apr 2006 21:20:47 -0000 1.28
+++ sys/dev/pci/cs4281.c 25 May 2006 13:38:07 -0000
@@ -106,7 +106,7 @@
static int cs4281_init(struct cs428x_softc *, int);
/* Power Management */
-static void cs4281_power(int, void *);
+static void cs4281_power(void *, int);
static const struct audio_hw_if cs4281_hw_if = {
NULL, /* open */
@@ -728,7 +728,7 @@
/* Power Hook */
static void
-cs4281_power(int why, void *v)
+cs4281_power(void *v, int why)
{
static uint32_t dba0 = 0, dbc0 = 0, dmr0 = 0, dcr0 = 0;
static uint32_t dba1 = 0, dbc1 = 0, dmr1 = 0, dcr1 = 0;
Index: sys/dev/pci/ehci_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/ehci_pci.c,v
retrieving revision 1.23
diff -w -u -r1.23 ehci_pci.c
--- sys/dev/pci/ehci_pci.c 10 Mar 2006 17:21:20 -0000 1.23
+++ sys/dev/pci/ehci_pci.c 25 May 2006 13:38:07 -0000
@@ -69,7 +69,7 @@
static void ehci_get_ownership(ehci_softc_t *sc, pci_chipset_tag_t pc,
pcitag_t tag);
-static void ehci_pci_powerhook(int, void *);
+static void ehci_pci_powerhook(void *, int);
struct ehci_pci_softc {
ehci_softc_t sc;
@@ -321,7 +321,7 @@
}
static void
-ehci_pci_powerhook(int why, void *opaque)
+ehci_pci_powerhook(void *opaque, int why)
{
struct ehci_pci_softc *sc;
pci_chipset_tag_t pc;
Index: sys/dev/pci/esa.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/esa.c,v
retrieving revision 1.31
diff -w -u -r1.31 esa.c
--- sys/dev/pci/esa.c 11 Dec 2005 12:22:49 -0000 1.31
+++ sys/dev/pci/esa.c 25 May 2006 13:38:07 -0000
@@ -162,7 +162,7 @@
/* power management */
static int esa_power(struct esa_softc *, int);
-static void esa_powerhook(int, void *);
+static void esa_powerhook(void *, int);
static int esa_suspend(struct esa_softc *);
static int esa_resume(struct esa_softc *);
@@ -1649,7 +1649,7 @@
}
static void
-esa_powerhook(int why, void *hdl)
+esa_powerhook(void *hdl, int why)
{
struct esa_softc *sc;
Index: sys/dev/pci/esm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/esm.c,v
retrieving revision 1.34
diff -w -u -r1.34 esm.c
--- sys/dev/pci/esm.c 14 Apr 2006 19:08:30 -0000 1.34
+++ sys/dev/pci/esm.c 25 May 2006 13:38:08 -0000
@@ -147,7 +147,7 @@
struct esm_chinfo *);
/* Power Management */
-void esm_powerhook(int, void *);
+void esm_powerhook(void *, int);
CFATTACH_DECL(esm, sizeof(struct esm_softc),
esm_match, esm_attach, NULL, NULL);
@@ -1716,7 +1716,7 @@
/* Power Hook */
void
-esm_powerhook(int why, void *v)
+esm_powerhook(void *v, int why)
{
struct esm_softc *ess;
Index: sys/dev/pci/if_bge.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_bge.c,v
retrieving revision 1.106
diff -w -u -r1.106 if_bge.c
--- sys/dev/pci/if_bge.c 27 Apr 2006 18:09:54 -0000 1.106
+++ sys/dev/pci/if_bge.c 25 May 2006 13:38:09 -0000
@@ -183,7 +183,7 @@
static int bge_probe(device_t, cfdata_t, void *);
static void bge_attach(device_t, device_t, void *);
-static void bge_powerhook(int, void *);
+static void bge_powerhook(void *, int);
static void bge_release_resources(struct bge_softc *);
static void bge_txeof(struct bge_softc *);
static void bge_rxeof(struct bge_softc *);
@@ -4254,7 +4254,7 @@
}
static void
-bge_powerhook(int why, void *hdl)
+bge_powerhook(void *hdl, int why)
{
struct bge_softc *sc = (struct bge_softc *)hdl;
struct ifnet *ifp = &sc->ethercom.ec_if;
Index: sys/dev/pci/if_fxp_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_fxp_pci.c,v
retrieving revision 1.44
diff -w -u -r1.44 if_fxp_pci.c
--- sys/dev/pci/if_fxp_pci.c 10 Jan 2006 20:31:36 -0000 1.44
+++ sys/dev/pci/if_fxp_pci.c 25 May 2006 13:38:09 -0000
@@ -99,7 +99,7 @@
static void fxp_pci_disable(struct fxp_softc *);
static void fxp_pci_confreg_restore(struct fxp_pci_softc *psc);
-static void fxp_pci_power(int why, void *arg);
+static void fxp_pci_power(void *arg, int why);
CFATTACH_DECL(fxp_pci, sizeof(struct fxp_pci_softc),
fxp_pci_match, fxp_pci_attach, NULL, NULL);
@@ -239,7 +239,7 @@
* on a resume.
*/
static void
-fxp_pci_power(int why, void *arg)
+fxp_pci_power(void *arg, int why)
{
struct fxp_pci_softc *psc = arg;
Index: sys/dev/pci/if_ipw.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_ipw.c,v
retrieving revision 1.25
diff -w -u -r1.25 if_ipw.c
--- sys/dev/pci/if_ipw.c 1 May 2006 20:43:46 -0000 1.25
+++ sys/dev/pci/if_ipw.c 25 May 2006 13:38:09 -0000
@@ -97,7 +97,7 @@
static void ipw_shutdown(void *);
static int ipw_suspend(struct ipw_softc *);
static int ipw_resume(struct ipw_softc *);
-static void ipw_powerhook(int, void *);
+static void ipw_powerhook(void *, int);
static int ipw_media_change(struct ifnet *);
static void ipw_media_status(struct ifnet *, struct ifmediareq *);
@@ -795,7 +795,7 @@
}
static void
-ipw_powerhook(int why, void *arg)
+ipw_powerhook(void *arg, int why)
{
struct ipw_softc *sc = arg;
int s;
Index: sys/dev/pci/if_iwi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_iwi.c,v
retrieving revision 1.48
diff -w -u -r1.48 if_iwi.c
--- sys/dev/pci/if_iwi.c 14 May 2006 21:45:00 -0000 1.48
+++ sys/dev/pci/if_iwi.c 25 May 2006 13:38:10 -0000
@@ -95,7 +95,7 @@
static void iwi_shutdown(void *);
static int iwi_suspend(struct iwi_softc *);
static int iwi_resume(struct iwi_softc *);
-static void iwi_powerhook(int, void *);
+static void iwi_powerhook(void *, int);
static int iwi_alloc_cmd_ring(struct iwi_softc *, struct iwi_cmd_ring *,
int);
@@ -844,7 +844,7 @@
}
static void
-iwi_powerhook(int why, void *arg)
+iwi_powerhook(void *arg, int why)
{
struct iwi_softc *sc = arg;
pci_chipset_tag_t pc = sc->sc_pct;
Index: sys/dev/pci/if_nfe.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_nfe.c,v
retrieving revision 1.3
diff -w -u -r1.3 if_nfe.c
--- sys/dev/pci/if_nfe.c 26 Mar 2006 00:34:14 -0000 1.3
+++ sys/dev/pci/if_nfe.c 25 May 2006 13:38:11 -0000
@@ -75,7 +75,7 @@
int nfe_match(struct device *, struct cfdata *, void *);
void nfe_attach(struct device *, struct device *, void *);
-void nfe_power(int, void *);
+void nfe_power(void *, int);
void nfe_miibus_statchg(struct device *);
int nfe_miibus_readreg(struct device *, int, int);
void nfe_miibus_writereg(struct device *, int, int, int);
@@ -330,7 +330,7 @@
}
void
-nfe_power(int why, void *arg)
+nfe_power(void *arg, int why)
{
struct nfe_softc *sc = arg;
struct ifnet *ifp;
Index: sys/dev/pci/if_rtk_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_rtk_pci.c,v
retrieving revision 1.24
diff -w -u -r1.24 if_rtk_pci.c
--- sys/dev/pci/if_rtk_pci.c 9 Mar 2006 22:17:49 -0000 1.24
+++ sys/dev/pci/if_rtk_pci.c 25 May 2006 13:38:11 -0000
@@ -123,7 +123,7 @@
static int rtk_pci_match(struct device *, struct cfdata *, void *);
static void rtk_pci_attach(struct device *, struct device *, void *);
-static void rtk_pci_powerhook(int, void *);
+static void rtk_pci_powerhook(void *, int);
CFATTACH_DECL(rtk_pci, sizeof(struct rtk_pci_softc),
rtk_pci_match, rtk_pci_attach, NULL, NULL);
@@ -257,7 +257,7 @@
}
static void
-rtk_pci_powerhook(int why, void *arg)
+rtk_pci_powerhook(void *arg, int why)
{
struct rtk_pci_softc *sc = (struct rtk_pci_softc *)arg;
int s;
Index: sys/dev/pci/if_wi_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_wi_pci.c,v
retrieving revision 1.38
diff -w -u -r1.38 if_wi_pci.c
--- sys/dev/pci/if_wi_pci.c 11 Dec 2005 12:22:50 -0000 1.38
+++ sys/dev/pci/if_wi_pci.c 25 May 2006 13:38:11 -0000
@@ -101,7 +101,7 @@
static int wi_pci_enable(struct wi_softc *);
static void wi_pci_disable(struct wi_softc *);
static void wi_pci_reset(struct wi_softc *);
-static void wi_pci_powerhook(int, void *);
+static void wi_pci_powerhook(void *, int);
static const struct wi_pci_product
*wi_pci_lookup(struct pci_attach_args *);
@@ -390,7 +390,7 @@
}
static void
-wi_pci_powerhook(int why, void *arg)
+wi_pci_powerhook(void *arg, int why)
{
struct wi_pci_softc *psc = arg;
struct wi_softc *sc = &psc->psc_wi;
Index: sys/dev/pci/neo.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/neo.c,v
retrieving revision 1.31
diff -w -u -r1.31 neo.c
--- sys/dev/pci/neo.c 25 Feb 2006 02:28:58 -0000 1.31
+++ sys/dev/pci/neo.c 25 May 2006 13:38:11 -0000
@@ -207,7 +207,7 @@
static size_t neo_round_buffersize(void *, int, size_t);
static paddr_t neo_mappage(void *, void *, off_t, int);
static int neo_get_props(void *);
-static void neo_power(int, void *);
+static void neo_power(void *, int);
CFATTACH_DECL(neo, sizeof(struct neo_softc),
neo_match, neo_attach, NULL, NULL);
@@ -551,7 +551,7 @@
}
static void
-neo_power(int why, void *addr)
+neo_power(void *addr, int why)
{
struct neo_softc *sc;
Index: sys/dev/pci/pccbb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/pccbb.c,v
retrieving revision 1.128
diff -w -u -r1.128 pccbb.c
--- sys/dev/pci/pccbb.c 5 Apr 2006 22:16:42 -0000 1.128
+++ sys/dev/pci/pccbb.c 25 May 2006 13:38:12 -0000
@@ -191,7 +191,7 @@
static void pccbb_pcmcia_do_io_map(struct pcic_handle *, int);
static void pccbb_pcmcia_do_mem_map(struct pcic_handle *, int);
-static void pccbb_powerhook(int, void *);
+static void pccbb_powerhook(void *, int);
/* bus-space allocation and deallocation functions */
#if rbus
@@ -3398,9 +3398,7 @@
#endif /* rbus */
static void
-pccbb_powerhook(why, arg)
- int why;
- void *arg;
+pccbb_powerhook(void *arg, int why)
{
struct pccbb_softc *sc = arg;
pcireg_t reg;
Index: sys/dev/pci/piixide.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/piixide.c,v
retrieving revision 1.26
diff -w -u -r1.26 piixide.c
--- sys/dev/pci/piixide.c 19 May 2006 01:27:00 -0000 1.26
+++ sys/dev/pci/piixide.c 25 May 2006 13:38:12 -0000
@@ -49,7 +49,7 @@
static u_int32_t piix_setup_sidetim_timings(u_int8_t, u_int8_t, u_int8_t);
static void piixsata_chip_map(struct pciide_softc*, struct pci_attach_args *);
-static void piixide_powerhook(int, void *);
+static void piixide_powerhook(void *, int);
static int piixide_match(struct device *, struct cfdata *, void *);
static void piixide_attach(struct device *, struct device *, void *);
@@ -223,7 +223,7 @@
}
static void
-piixide_powerhook(int why, void *hdl)
+piixide_powerhook(void *hdl, int why)
{
struct pciide_softc *sc = (struct pciide_softc *)hdl;
Index: sys/dev/pci/uhci_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/uhci_pci.c,v
retrieving revision 1.31
diff -w -u -r1.31 uhci_pci.c
--- sys/dev/pci/uhci_pci.c 10 Mar 2006 17:21:20 -0000 1.31
+++ sys/dev/pci/uhci_pci.c 25 May 2006 13:38:12 -0000
@@ -62,7 +62,7 @@
#include <dev/usb/uhcireg.h>
#include <dev/usb/uhcivar.h>
-static void uhci_pci_powerhook(int, void *);
+static void uhci_pci_powerhook(void *, int);
struct uhci_pci_softc {
uhci_softc_t sc;
@@ -217,7 +217,7 @@
}
static void
-uhci_pci_powerhook(int why, void *opaque)
+uhci_pci_powerhook(void *opaque, int why)
{
struct uhci_pci_softc *sc;
pci_chipset_tag_t pc;
Index: sys/dev/pci/yds.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/yds.c,v
retrieving revision 1.30
diff -w -u -r1.30 yds.c
--- sys/dev/pci/yds.c 11 Dec 2005 12:22:51 -0000 1.30
+++ sys/dev/pci/yds.c 25 May 2006 13:38:13 -0000
@@ -190,7 +190,7 @@
static struct yds_dma *yds_find_dma(struct yds_softc *, void *);
static int yds_init(struct yds_softc *);
-static void yds_powerhook(int, void *);
+static void yds_powerhook(void *, int);
#ifdef AUDIO_DEBUG
static void yds_dump_play_slot(struct yds_softc *, int);
@@ -676,7 +676,7 @@
}
static void
-yds_powerhook(int why, void *addr)
+yds_powerhook(void *addr, int why)
{
struct yds_softc *sc;
Index: sys/dev/pckbport/pms.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pckbport/pms.c,v
retrieving revision 1.10
diff -w -u -r1.10 pms.c
--- sys/dev/pckbport/pms.c 29 Mar 2006 07:11:08 -0000 1.10
+++ sys/dev/pckbport/pms.c 25 May 2006 13:38:13 -0000
@@ -87,7 +87,7 @@
int pms_ioctl(void *, u_long, caddr_t, int, struct lwp *);
void pms_disable(void *);
#ifndef PMS_DISABLE_POWERHOOK
-void pms_power(int, void *);
+void pms_power(void *, int);
#endif /* !PMS_DISABLE_POWERHOOK */
const struct wsmouse_accessops pms_accessops = {
@@ -334,7 +334,7 @@
#ifndef PMS_DISABLE_POWERHOOK
void
-pms_power(int why, void *v)
+pms_power(void *v, int why)
{
struct pms_softc *sc = v;
Index: sys/dev/pcmcia/if_ray.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pcmcia/if_ray.c,v
retrieving revision 1.60
diff -w -u -r1.60 if_ray.c
--- sys/dev/pcmcia/if_ray.c 14 Apr 2006 17:50:27 -0000 1.60
+++ sys/dev/pcmcia/if_ray.c 25 May 2006 13:38:14 -0000
@@ -310,7 +310,7 @@
static int ray_match(struct device *, struct cfdata *, void *);
static int ray_media_change(struct ifnet *);
static void ray_media_status(struct ifnet *, struct ifmediareq *);
-void ray_power(int, void *);
+void ray_power(void *, int);
static ray_cmd_func_t ray_rccs_intr(struct ray_softc *, bus_size_t);
static void ray_read_region(struct ray_softc *, bus_size_t,void *,size_t);
static void ray_recv(struct ray_softc *, bus_size_t);
@@ -885,9 +885,7 @@
}
void
-ray_power(why, arg)
- int why;
- void *arg;
+ray_power(void *arg, int why)
{
#if 0
struct ray_softc *sc;
Index: sys/dev/pcmcia/if_wi_pcmcia.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pcmcia/if_wi_pcmcia.c,v
retrieving revision 1.68
diff -w -u -r1.68 if_wi_pcmcia.c
--- sys/dev/pcmcia/if_wi_pcmcia.c 11 Dec 2005 12:23:23 -0000 1.68
+++ sys/dev/pcmcia/if_wi_pcmcia.c 25 May 2006 13:38:14 -0000
@@ -79,7 +79,7 @@
static int wi_pcmcia_detach(struct device *, int);
static int wi_pcmcia_enable(struct wi_softc *);
static void wi_pcmcia_disable(struct wi_softc *);
-static void wi_pcmcia_powerhook(int, void *);
+static void wi_pcmcia_powerhook(void *, int);
static void wi_pcmcia_shutdown(void *);
/* support to download firmware for symbol CF card */
@@ -413,9 +413,7 @@
}
static void
-wi_pcmcia_powerhook(why, arg)
- int why;
- void *arg;
+wi_pcmcia_powerhook(void *arg, int why)
{
struct wi_pcmcia_softc *psc = arg;
struct wi_softc *sc = &psc->sc_wi;
Index: sys/dev/sbus/dbri.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sbus/dbri.c,v
retrieving revision 1.4
diff -w -u -r1.4 dbri.c
--- sys/dev/sbus/dbri.c 9 Mar 2006 20:44:18 -0000 1.4
+++ sys/dev/sbus/dbri.c 25 May 2006 13:38:14 -0000
@@ -164,7 +164,7 @@
static paddr_t dbri_mappage(void *, void *, off_t, int);
static void dbri_set_power(struct dbri_softc *, int);
static void dbri_bring_up(struct dbri_softc *);
-static void dbri_powerhook(int, void *);
+static void dbri_powerhook(void *, int);
/* stupid support routines */
static u_int32_t reverse_bytes(u_int32_t, int);
@@ -1823,7 +1823,7 @@
}
static void
-dbri_powerhook(int why, void *cookie)
+dbri_powerhook(void *cookie, int why)
{
struct dbri_softc *sc = cookie;
@@ -1840,4 +1840,3 @@
}
#endif /* NAUDIO > 0 */
-
Index: sys/dev/sbus/p9100.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sbus/p9100.c,v
retrieving revision 1.32
diff -w -u -r1.32 p9100.c
--- sys/dev/sbus/p9100.c 15 Apr 2006 17:48:23 -0000 1.32
+++ sys/dev/sbus/p9100.c 25 May 2006 13:38:15 -0000
@@ -237,7 +237,7 @@
static int p9100_intr(void *);
/* power management stuff */
-static void p9100_power_hook(int, void *);
+static void p9100_power_hook(void *, int);
static void p9100_set_extvga(void *, int);
@@ -940,7 +940,7 @@
}
static void
-p9100_power_hook(int why, void *cookie)
+p9100_power_hook(void *cookie, int why)
{
struct p9100_softc *sc = cookie;
Index: sys/dev/usb/ehci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ehci.c,v
retrieving revision 1.109
diff -w -u -r1.109 ehci.c
--- sys/dev/usb/ehci.c 14 Apr 2006 17:27:08 -0000 1.109
+++ sys/dev/usb/ehci.c 25 May 2006 13:38:15 -0000
@@ -128,7 +128,7 @@
};
Static void ehci_shutdown(void *);
-Static void ehci_power(int, void *);
+Static void ehci_power(void *, int);
Static usbd_status ehci_open(usbd_pipe_handle);
Static void ehci_poll(struct usbd_bus *);
@@ -998,7 +998,7 @@
* are almost suspended anyway.
*/
void
-ehci_power(int why, void *v)
+ehci_power(void *v, int why)
{
ehci_softc_t *sc = v;
u_int32_t cmd, hcr;
Index: sys/dev/usb/ohci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ohci.c,v
retrieving revision 1.174
diff -w -u -r1.174 ohci.c
--- sys/dev/usb/ohci.c 12 May 2006 01:25:00 -0000 1.174
+++ sys/dev/usb/ohci.c 25 May 2006 13:38:16 -0000
@@ -137,7 +137,7 @@
ohci_soft_td_t *, ohci_soft_td_t **);
Static void ohci_shutdown(void *v);
-Static void ohci_power(int, void *);
+Static void ohci_power(void *, int);
Static usbd_status ohci_open(usbd_pipe_handle);
Static void ohci_poll(struct usbd_bus *);
Static void ohci_softintr(void *);
@@ -1025,7 +1025,7 @@
* are almost suspended anyway.
*/
void
-ohci_power(int why, void *v)
+ohci_power(void *v, int why)
{
ohci_softc_t *sc = v;
u_int32_t ctl;
Index: sys/dev/usb/uhci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/uhci.c,v
retrieving revision 1.196
diff -w -u -r1.196 uhci.c
--- sys/dev/usb/uhci.c 12 May 2006 01:25:00 -0000 1.196
+++ sys/dev/usb/uhci.c 25 May 2006 13:38:17 -0000
@@ -166,7 +166,7 @@
Static usbd_status uhci_portreset(uhci_softc_t*, int);
Static void uhci_reset(uhci_softc_t *);
Static void uhci_shutdown(void *v);
-Static void uhci_power(int, void *);
+Static void uhci_power(void *, int);
Static usbd_status uhci_run(uhci_softc_t *, int run);
Static uhci_soft_td_t *uhci_alloc_std(uhci_softc_t *);
Static void uhci_free_std(uhci_softc_t *, uhci_soft_td_t *);
@@ -741,7 +741,7 @@
* are almost suspended anyway.
*/
void
-uhci_power(int why, void *v)
+uhci_power(void *v, int why)
{
uhci_softc_t *sc = v;
int cmd;
Index: sys/kern/init_main.c
===================================================================
RCS file: /cvsroot/src/sys/kern/init_main.c,v
retrieving revision 1.266
diff -w -u -r1.266 init_main.c
--- sys/kern/init_main.c 14 May 2006 21:15:11 -0000 1.266
+++ sys/kern/init_main.c 25 May 2006 13:38:18 -0000
@@ -111,6 +111,7 @@
#include <sys/user.h>
#include <sys/sysctl.h>
#include <sys/event.h>
+#include <sys/eventhandler.h>
#include <sys/mbuf.h>
#ifdef FAST_IPSEC
#include <netipsec/ipsec.h>
@@ -220,6 +221,9 @@
KERNEL_LOCK_INIT();
+ /* init the eventhandler queue early so subsystems can set up hooks */
+ eventhandler_init();
+
uvm_init();
/* Do machine-dependent initialization. */
Index: sys/kern/kern_sig.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_sig.c,v
retrieving revision 1.220
diff -w -u -r1.220 kern_sig.c
--- sys/kern/kern_sig.c 14 May 2006 21:15:11 -0000 1.220
+++ sys/kern/kern_sig.c 25 May 2006 13:38:18 -0000
@@ -84,7 +84,7 @@
#include <uvm/uvm_extern.h>
static int build_corename(struct proc *, char *, const char *, size_t);
-static void ksiginfo_exithook(struct proc *, void *);
+static void ksiginfo_exithook(void *, struct proc *);
static void ksiginfo_put(struct proc *, const ksiginfo_t *);
static ksiginfo_t *ksiginfo_get(struct proc *, int);
static void kpsignal2(struct proc *, const ksiginfo_t *, int);
@@ -199,7 +199,7 @@
* free all pending ksiginfo on exit
*/
static void
-ksiginfo_exithook(struct proc *p, void *v)
+ksiginfo_exithook(void *v, struct proc *p)
{
int s;
Index: sys/kern/kern_subr.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_subr.c,v
retrieving revision 1.135
diff -w -u -r1.135 kern_subr.c
--- sys/kern/kern_subr.c 28 Mar 2006 17:38:39 -0000 1.135
+++ sys/kern/kern_subr.c 25 May 2006 13:38:18 -0000
@@ -108,6 +108,7 @@
#include <sys/ktrace.h>
#include <sys/ptrace.h>
#include <sys/fcntl.h>
+#include <sys/eventhandler.h>
#include <uvm/uvm_extern.h>
@@ -115,21 +116,13 @@
#include <net/if.h>
+static int mountroot_mask(void *arg);
+
/* XXX these should eventually move to subr_autoconf.c */
static struct device *finddevice(const char *);
static struct device *getdisk(char *, int, int, dev_t *, int);
static struct device *parsedisk(char *, int, int, dev_t *);
-/*
- * A generic linear hook.
- */
-struct hook_desc {
- LIST_ENTRY(hook_desc) hk_list;
- void (*hk_fn)(void *);
- void *hk_arg;
-};
-typedef LIST_HEAD(, hook_desc) hook_list_t;
-
MALLOC_DEFINE(M_IOV, "iov", "large iov's");
void
@@ -442,62 +435,6 @@
}
-static void *
-hook_establish(hook_list_t *list, void (*fn)(void *), void *arg)
-{
- struct hook_desc *hd;
-
- hd = malloc(sizeof(*hd), M_DEVBUF, M_NOWAIT);
- if (hd == NULL)
- return (NULL);
-
- hd->hk_fn = fn;
- hd->hk_arg = arg;
- LIST_INSERT_HEAD(list, hd, hk_list);
-
- return (hd);
-}
-
-static void
-hook_disestablish(hook_list_t *list, void *vhook)
-{
-#ifdef DIAGNOSTIC
- struct hook_desc *hd;
-
- LIST_FOREACH(hd, list, hk_list) {
- if (hd == vhook)
- break;
- }
-
- if (hd == NULL)
- panic("hook_disestablish: hook %p not established", vhook);
-#endif
- LIST_REMOVE((struct hook_desc *)vhook, hk_list);
- free(vhook, M_DEVBUF);
-}
-
-static void
-hook_destroy(hook_list_t *list)
-{
- struct hook_desc *hd;
-
- while ((hd = LIST_FIRST(list)) != NULL) {
- LIST_REMOVE(hd, hk_list);
- free(hd, M_DEVBUF);
- }
-}
-
-static void
-hook_proc_run(hook_list_t *list, struct proc *p)
-{
- struct hook_desc *hd;
-
- for (hd = LIST_FIRST(list); hd != NULL; hd = LIST_NEXT(hd, hk_list)) {
- ((void (*)(struct proc *, void *))*hd->hk_fn)(p,
- hd->hk_arg);
- }
-}
-
/*
* "Shutdown hook" types, functions, and variables.
*
@@ -509,18 +446,22 @@
* it won't be run again.
*/
-static hook_list_t shutdownhook_list;
-void *
-shutdownhook_establish(void (*fn)(void *), void *arg)
+eventhandler_tag
+shutdownhook_establish(shutdown_fn fn, void *arg)
{
- return hook_establish(&shutdownhook_list, fn, arg);
+ eventhandler_tag tag;
+
+ tag = EVENTHANDLER_REGISTER(shutdown, fn, arg,
+ EVENTHANDLER_PRI_ANY);
+ EVENTHANDLER_FLAGS(shutdown, EHL_ONCE);
+ return tag;
}
void
-shutdownhook_disestablish(void *vhook)
+shutdownhook_disestablish(eventhandler_tag tag)
{
- hook_disestablish(&shutdownhook_list, vhook);
+ EVENTHANDLER_DEREGISTER(shutdown, tag);
}
/*
@@ -534,73 +475,62 @@
void
doshutdownhooks(void)
{
- struct hook_desc *dp;
-
- while ((dp = LIST_FIRST(&shutdownhook_list)) != NULL) {
- LIST_REMOVE(dp, hk_list);
- (*dp->hk_fn)(dp->hk_arg);
-#if 0
- /*
- * Don't bother freeing the hook structure,, since we may
- * be rebooting because of a memory corruption problem,
- * and this might only make things worse. It doesn't
- * matter, anyway, since the system is just about to
- * reboot.
- */
- free(dp, M_DEVBUF);
-#endif
- }
+ EVENTHANDLER_INVOKE(shutdown);
}
/*
* "Mountroot hook" types, functions, and variables.
*/
-static hook_list_t mountroothook_list;
-
-void *
-mountroothook_establish(void (*fn)(struct device *), struct device *dev)
+eventhandler_tag
+mountroothook_establish(mountroot_fn fn, struct device *dev)
{
- return hook_establish(&mountroothook_list, (void (*)(void *))fn, dev);
+ eventhandler_tag tag;
+
+ tag = EVENTHANDLER_REGISTER(mountroot_list, fn, (void *) dev,
+ EVENTHANDLER_PRI_ANY);
+ EVENTHANDLER_MASK_FN(mountroot_list, mountroot_mask);
+ return tag;
}
void
-mountroothook_disestablish(void *vhook)
+mountroothook_disestablish(eventhandler_tag tag)
{
- hook_disestablish(&mountroothook_list, vhook);
+ EVENTHANDLER_DEREGISTER(mountroot_list, tag);
}
void
mountroothook_destroy(void)
{
- hook_destroy(&mountroothook_list);
+ EVENTHANDLER_DEREGISTER(mountroot_list, NULL);
}
void
domountroothook(void)
{
- struct hook_desc *hd;
-
- LIST_FOREACH(hd, &mountroothook_list, hk_list) {
- if (hd->hk_arg == (void *)root_device) {
- (*hd->hk_fn)(hd->hk_arg);
- return;
- }
- }
+ EVENTHANDLER_INVOKE(mountroot_list);
}
-static hook_list_t exechook_list;
+static int
+mountroot_mask(void *arg)
+{
+ if (arg == (void *)root_device)
+ return 1;
+ else
+ return 0;
+}
-void *
-exechook_establish(void (*fn)(struct proc *, void *), void *arg)
+eventhandler_tag
+exechook_establish(execlist_fn fn, void *arg)
{
- return hook_establish(&exechook_list, (void (*)(void *))fn, arg);
+ return EVENTHANDLER_REGISTER(process_exec, (void (*)(void *)) fn, arg,
+ EVENTHANDLER_PRI_ANY);
}
void
-exechook_disestablish(void *vhook)
+exechook_disestablish(eventhandler_tag tag)
{
- hook_disestablish(&exechook_list, vhook);
+ EVENTHANDLER_DEREGISTER(process_exec, tag);
}
/*
@@ -609,21 +539,20 @@
void
doexechooks(struct proc *p)
{
- hook_proc_run(&exechook_list, p);
+ EVENTHANDLER_INVOKE(process_exec, p);
}
-static hook_list_t exithook_list;
-
-void *
-exithook_establish(void (*fn)(struct proc *, void *), void *arg)
+eventhandler_tag
+exithook_establish(exitlist_fn fn, void *arg)
{
- return hook_establish(&exithook_list, (void (*)(void *))fn, arg);
+ return EVENTHANDLER_REGISTER(process_exit, (void (*)(void *)) fn, arg,
+ EVENTHANDLER_PRI_ANY);
}
void
-exithook_disestablish(void *vhook)
+exithook_disestablish(eventhandler_tag tag)
{
- hook_disestablish(&exithook_list, vhook);
+ EVENTHANDLER_DEREGISTER(process_exit, tag);
}
/*
@@ -632,21 +561,20 @@
void
doexithooks(struct proc *p)
{
- hook_proc_run(&exithook_list, p);
+ EVENTHANDLER_INVOKE(process_exit, p);
}
-static hook_list_t forkhook_list;
-
-void *
-forkhook_establish(void (*fn)(struct proc *, struct proc *))
+eventhandler_tag
+forkhook_establish(forklist_fn fn)
{
- return hook_establish(&forkhook_list, (void (*)(void *))fn, NULL);
+ return EVENTHANDLER_REGISTER(process_fork, (void (*)(void *)) fn, NULL,
+ EVENTHANDLER_PRI_ANY);
}
void
-forkhook_disestablish(void *vhook)
+forkhook_disestablish(eventhandler_tag tag)
{
- hook_disestablish(&forkhook_list, vhook);
+ EVENTHANDLER_DEREGISTER(process_fork, tag);
}
/*
@@ -655,63 +583,28 @@
void
doforkhooks(struct proc *p2, struct proc *p1)
{
- struct hook_desc *hd;
-
- LIST_FOREACH(hd, &forkhook_list, hk_list) {
- ((void (*)(struct proc *, struct proc *))*hd->hk_fn)
- (p2, p1);
- }
+ EVENTHANDLER_INVOKE(process_fork, p2, p1);
}
/*
* "Power hook" types, functions, and variables.
* The list of power hooks is kept ordered with the last registered hook
- * first.
+ * first. XXXX eventhandler is the reverse of this!
* When running the hooks on power down the hooks are called in reverse
* registration order, when powering up in registration order.
*/
-struct powerhook_desc {
- CIRCLEQ_ENTRY(powerhook_desc) sfd_list;
- void (*sfd_fn)(int, void *);
- void *sfd_arg;
-};
-
-static CIRCLEQ_HEAD(, powerhook_desc) powerhook_list =
- CIRCLEQ_HEAD_INITIALIZER(powerhook_list);
-void *
-powerhook_establish(void (*fn)(int, void *), void *arg)
+eventhandler_tag
+powerhook_establish(powerlist_fn fn, void *arg)
{
- struct powerhook_desc *ndp;
-
- ndp = (struct powerhook_desc *)
- malloc(sizeof(*ndp), M_DEVBUF, M_NOWAIT);
- if (ndp == NULL)
- return (NULL);
-
- ndp->sfd_fn = fn;
- ndp->sfd_arg = arg;
- CIRCLEQ_INSERT_HEAD(&powerhook_list, ndp, sfd_list);
-
- return (ndp);
+ return EVENTHANDLER_REGISTER(power_list, (void (*)(void *)) fn, arg,
+ EVENTHANDLER_PRI_ANY);
}
void
-powerhook_disestablish(void *vhook)
+powerhook_disestablish(eventhandler_tag tag)
{
-#ifdef DIAGNOSTIC
- struct powerhook_desc *dp;
-
- CIRCLEQ_FOREACH(dp, &powerhook_list, sfd_list)
- if (dp == vhook)
- goto found;
- panic("powerhook_disestablish: hook %p not established", vhook);
- found:
-#endif
-
- CIRCLEQ_REMOVE(&powerhook_list, (struct powerhook_desc *)vhook,
- sfd_list);
- free(vhook, M_DEVBUF);
+ EVENTHANDLER_DEREGISTER(power_list, tag);
}
/*
@@ -720,16 +613,10 @@
void
dopowerhooks(int why)
{
- struct powerhook_desc *dp;
-
if (why == PWR_RESUME || why == PWR_SOFTRESUME) {
- CIRCLEQ_FOREACH_REVERSE(dp, &powerhook_list, sfd_list) {
- (*dp->sfd_fn)(why, dp->sfd_arg);
- }
+ EVENTHANDLER_INVOKE(power_list, why);
} else {
- CIRCLEQ_FOREACH(dp, &powerhook_list, sfd_list) {
- (*dp->sfd_fn)(why, dp->sfd_arg);
- }
+ EVENTHANDLER_INVOKE_REVERSE(power_list, why);
}
}
Index: sys/kern/sysv_sem.c
===================================================================
RCS file: /cvsroot/src/sys/kern/sysv_sem.c,v
retrieving revision 1.61
diff -w -u -r1.61 sysv_sem.c
--- sys/kern/sysv_sem.c 14 May 2006 21:15:11 -0000 1.61
+++ sys/kern/sysv_sem.c 25 May 2006 13:38:19 -0000
@@ -819,7 +819,7 @@
*/
/*ARGSUSED*/
void
-semexit(struct proc *p, void *v)
+semexit(void *v, struct proc *p)
{
struct sem_undo *suptr;
struct sem_undo **supptr;
Index: sys/kern/uipc_sem.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_sem.c,v
retrieving revision 1.14
diff -w -u -r1.14 uipc_sem.c
--- sys/kern/uipc_sem.c 14 May 2006 21:15:12 -0000 1.14
+++ sys/kern/uipc_sem.c 25 May 2006 13:38:19 -0000
@@ -752,8 +752,9 @@
return (0);
}
+/* ARGS_USED */
static void
-ksem_forkhook(struct proc *p2, struct proc *p1)
+ksem_forkhook(void *arg, struct proc *p2, struct proc *p1)
{
struct ksem_proc *kp1, *kp2;
struct ksem_ref *ksr, *ksr1;
@@ -782,7 +783,7 @@
}
static void
-ksem_exithook(struct proc *p, void *arg)
+ksem_exithook(void *arg, struct proc *p)
{
struct ksem_proc *kp;
struct ksem_ref *ksr;
Index: sys/miscfs/procfs/procfs.h
===================================================================
RCS file: /cvsroot/src/sys/miscfs/procfs/procfs.h,v
retrieving revision 1.59
diff -w -u -r1.59 procfs.h
--- sys/miscfs/procfs/procfs.h 11 Dec 2005 12:24:51 -0000 1.59
+++ sys/miscfs/procfs/procfs.h 25 May 2006 13:38:19 -0000
@@ -207,7 +207,7 @@
int procfs_domounts(struct lwp *, struct proc *, struct pfsnode *,
struct uio *);
-void procfs_revoke_vnodes(struct proc *, void *);
+void procfs_revoke_vnodes(void *, struct proc *);
void procfs_hashinit(void);
void procfs_hashreinit(void);
void procfs_hashdone(void);
Index: sys/miscfs/procfs/procfs_subr.c
===================================================================
RCS file: /cvsroot/src/sys/miscfs/procfs/procfs_subr.c,v
retrieving revision 1.68
diff -w -u -r1.68 procfs_subr.c
--- sys/miscfs/procfs/procfs_subr.c 1 Mar 2006 12:38:32 -0000 1.68
+++ sys/miscfs/procfs/procfs_subr.c 25 May 2006 13:38:19 -0000
@@ -548,9 +548,7 @@
}
void
-procfs_revoke_vnodes(p, arg)
- struct proc *p;
- void *arg;
+procfs_revoke_vnodes(void *arg, struct proc *p)
{
struct pfsnode *pfs, *pnext;
struct vnode *vp;
Index: sys/nfs/nfs_socket.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_socket.c,v
retrieving revision 1.132
diff -w -u -r1.132 nfs_socket.c
--- sys/nfs/nfs_socket.c 19 May 2006 13:53:11 -0000 1.132
+++ sys/nfs/nfs_socket.c 25 May 2006 13:38:20 -0000
@@ -1757,9 +1757,7 @@
/*ARGSUSED*/
void
-nfs_exit(p, v)
- struct proc *p;
- void *v;
+nfs_exit(void *v, struct proc *p)
{
struct nfsreq *rp;
int s = splsoftnet();
Index: sys/nfs/nfs_var.h
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_var.h,v
retrieving revision 1.61
diff -w -u -r1.61 nfs_var.h
--- sys/nfs/nfs_var.h 19 May 2006 13:53:11 -0000 1.61
+++ sys/nfs/nfs_var.h 25 May 2006 13:38:20 -0000
@@ -217,7 +217,7 @@
void nfs_timer(void *);
int nfs_sigintr(struct nfsmount *, struct nfsreq *, struct lwp *);
int nfs_sndlock(int *, struct nfsreq *);
-void nfs_exit(struct proc *, void *);
+void nfs_exit(void *, struct proc *);
void nfs_sndunlock(int *);
int nfs_rcvlock(struct nfsreq *);
void nfs_rcvunlock(struct nfsmount *);
Index: sys/sys/sem.h
===================================================================
RCS file: /cvsroot/src/sys/sys/sem.h,v
retrieving revision 1.21
diff -w -u -r1.21 sem.h
--- sys/sys/sem.h 11 Dec 2005 12:25:21 -0000 1.21
+++ sys/sys/sem.h 25 May 2006 13:38:21 -0000
@@ -225,7 +225,7 @@
__END_DECLS
#else
void seminit(void);
-void semexit(struct proc *, void *);
+void semexit(void *, struct proc *);
int semctl1(struct proc *, int, int, int, void *, register_t *);
#endif /* !_KERNEL */
Index: sys/sys/systm.h
===================================================================
RCS file: /cvsroot/src/sys/sys/systm.h,v
retrieving revision 1.186
diff -w -u -r1.186 systm.h
--- sys/sys/systm.h 7 Mar 2006 13:18:20 -0000 1.186
+++ sys/sys/systm.h 25 May 2006 13:38:21 -0000
@@ -77,6 +77,7 @@
#ifdef _KERNEL
#include <sys/types.h>
+#include <sys/eventhandler.h>
#endif
struct clockframe;
@@ -303,15 +304,15 @@
* Shutdown hooks. Functions to be run with all interrupts disabled
* immediately before the system is halted or rebooted.
*/
-void *shutdownhook_establish(void (*)(void *), void *);
-void shutdownhook_disestablish(void *);
+eventhandler_tag shutdownhook_establish(shutdown_fn, void *);
+void shutdownhook_disestablish(eventhandler_tag);
void doshutdownhooks(void);
/*
* Power management hooks.
*/
-void *powerhook_establish(void (*)(int, void *), void *);
-void powerhook_disestablish(void *);
+eventhandler_tag powerhook_establish(powerlist_fn, void *);
+void powerhook_disestablish(eventhandler_tag);
void dopowerhooks(int);
#define PWR_RESUME 0
#define PWR_SUSPEND 1
@@ -326,8 +327,8 @@
* selected as the root device.
*/
extern int (*mountroot)(void);
-void *mountroothook_establish(void (*)(struct device *), struct device *);
-void mountroothook_disestablish(void *);
+eventhandler_tag mountroothook_establish(mountroot_fn, struct device *);
+void mountroothook_disestablish(eventhandler_tag);
void mountroothook_destroy(void);
void domountroothook(void);
@@ -335,23 +336,23 @@
* Exec hooks. Subsystems may want to do cleanup when a process
* execs.
*/
-void *exechook_establish(void (*)(struct proc *, void *), void *);
-void exechook_disestablish(void *);
+eventhandler_tag exechook_establish(execlist_fn, void *);
+void exechook_disestablish(eventhandler_tag);
void doexechooks(struct proc *);
/*
* Exit hooks. Subsystems may want to do cleanup when a process exits.
*/
-void *exithook_establish(void (*)(struct proc *, void *), void *);
-void exithook_disestablish(void *);
+eventhandler_tag exithook_establish(exitlist_fn, void *);
+void exithook_disestablish(eventhandler_tag);
void doexithooks(struct proc *);
/*
* Fork hooks. Subsystems may want to do special processing when a process
* forks.
*/
-void *forkhook_establish(void (*)(struct proc *, struct proc *));
-void forkhook_disestablish(void *);
+eventhandler_tag forkhook_establish(forklist_fn);
+void forkhook_disestablish(eventhandler_tag);
void doforkhooks(struct proc *, struct proc *);
/*
--1UWUbFP1cBYEclgG--