diff options
| author | ad <ad@NetBSD.org> | 2007-07-09 20:51:58 +0000 |
|---|---|---|
| committer | ad <ad@NetBSD.org> | 2007-07-09 20:51:58 +0000 |
| commit | 88ab7da936c561aba9ff7492617ffb08f8d08ece (patch) | |
| tree | d9d78b17ff651178241606f2e7766abdd0f15137 /sys/dev/hpc | |
| parent | 317bac119f13240650ea6882854b381cf1024fa1 (diff) | |
Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
Diffstat (limited to 'sys/dev/hpc')
| -rw-r--r-- | sys/dev/hpc/apm/apmdev.c | 36 | ||||
| -rw-r--r-- | sys/dev/hpc/hpcfb.c | 37 |
2 files changed, 26 insertions, 47 deletions
diff --git a/sys/dev/hpc/apm/apmdev.c b/sys/dev/hpc/apm/apmdev.c index 0ab7e3c936c..4403d4b64f0 100644 --- a/sys/dev/hpc/apm/apmdev.c +++ b/sys/dev/hpc/apm/apmdev.c @@ -1,4 +1,4 @@ -/* $NetBSD: apmdev.c,v 1.10 2007/03/04 06:01:47 christos Exp $ */ +/* $NetBSD: apmdev.c,v 1.11 2007/07/09 21:00:32 ad Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: apmdev.c,v 1.10 2007/03/04 06:01:47 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: apmdev.c,v 1.11 2007/07/09 21:00:32 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_apmdev.h" @@ -135,7 +135,6 @@ static int apmmatch(struct device *, struct cfdata *, void *); static void apm_event_handle(struct apm_softc *, u_int, u_int); static void apm_periodic_check(struct apm_softc *); -static void apm_create_thread(void *); static void apm_thread(void *); static void apm_perror(const char *, int, ...) __attribute__((__format__(__printf__,1,3))); @@ -714,9 +713,16 @@ apmattach(struct device *parent, struct device *self, void *aux) * Create a kernel thread to periodically check for APM events, * and notify other subsystems when they occur. */ - kthread_create(apm_create_thread, sc); - - return; + if (kthread_create(PRI_NONE, 0, NULL, apm_thread, sc, + &sc->sc_thread, "%s", sc->sc_dev.dv_xname) != 0) { + /* + * We were unable to create the APM thread; bail out. + */ + sc->ops->disconnect(sc->cookie); + printf("%s: unable to create thread, " + "kernel APM support disabled\n", + sc->sc_dev.dv_xname); + } } /* @@ -730,24 +736,6 @@ apmprint(void *aux, const char *pnp) return (UNCONF); } - -void -apm_create_thread(void *arg) -{ - struct apm_softc *sc = arg; - - if (kthread_create1(apm_thread, sc, &sc->sc_thread, - "%s", sc->sc_dev.dv_xname) == 0) - return; - - /* - * We were unable to create the APM thread; bail out. - */ - sc->ops->disconnect(sc->cookie); - printf("%s: unable to create thread, kernel APM support disabled\n", - sc->sc_dev.dv_xname); -} - void apm_thread(void *arg) { diff --git a/sys/dev/hpc/hpcfb.c b/sys/dev/hpc/hpcfb.c index c8cc20750ff..7cafceccc3c 100644 --- a/sys/dev/hpc/hpcfb.c +++ b/sys/dev/hpc/hpcfb.c @@ -1,4 +1,4 @@ -/* $NetBSD: hpcfb.c,v 1.41 2007/03/04 06:01:46 christos Exp $ */ +/* $NetBSD: hpcfb.c,v 1.42 2007/07/09 21:00:32 ad Exp $ */ /*- * Copyright (c) 1999 @@ -43,7 +43,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.41 2007/03/04 06:01:46 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpcfb.c,v 1.42 2007/07/09 21:00:32 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_hpcfb.h" @@ -187,7 +187,6 @@ void hpcfb_refresh_screen(struct hpcfb_softc *); void hpcfb_doswitch(struct hpcfb_softc *); #ifdef HPCFB_JUMP -static void hpcfb_create_thread(void *); static void hpcfb_thread(void *); #endif /* HPCFB_JUMP */ @@ -318,7 +317,7 @@ hpcfbattach(struct device *parent, sc->sc_polling = 0; /* XXX */ sc->sc_mapping = 0; /* XXX */ - callout_init(&sc->sc_switch_callout); + callout_init(&sc->sc_switch_callout, 0); /* Add a power hook to power management */ sc->sc_powerhook = powerhook_establish(sc->sc_dev.dv_xname, @@ -338,29 +337,21 @@ hpcfbattach(struct device *parent, /* * Create a kernel thread to scroll, */ - kthread_create(hpcfb_create_thread, sc); + if (kthread_create(PRI_NONE, 0, NULL, hpcfb_thread, sc, + &sc->sc_thread, "%s", sc->sc_dev.dv_xname) != 0) { + /* + * We were unable to create the HPCFB thread; bail out. + */ + sc->sc_thread = 0; + printf("%s: unable to create thread, kernel " + "hpcfb scroll support disabled\n", + sc->sc_dev.dv_xname); + } #endif /* HPCFB_JUMP */ } #ifdef HPCFB_JUMP void -hpcfb_create_thread(void *arg) -{ - struct hpcfb_softc *sc = arg; - - if (kthread_create1(hpcfb_thread, sc, &sc->sc_thread, - "%s", sc->sc_dev.dv_xname) == 0) - return; - - /* - * We were unable to create the HPCFB thread; bail out. - */ - sc->sc_thread = 0; - printf("%s: unable to create thread, kernel hpcfb scroll support disabled\n", - sc->sc_dev.dv_xname); -} - -void hpcfb_thread(void *arg) { struct hpcfb_softc *sc = arg; @@ -497,7 +488,7 @@ hpcfb_init(struct hpcfb_fbconf *fbconf, struct hpcfb_devconfig *dc) dc->dc_max_row = 0; dc->dc_min_row = dc->dc_rows; dc->dc_scroll = 0; - callout_init(&dc->dc_scroll_ch); + callout_init(&dc->dc_scroll_ch, 0); #endif /* HPCFB_JUMP */ dc->dc_memsize = ri->ri_stride * ri->ri_height; /* hook rasops in hpcfb_ops */ |
