Module Name: src Committed By: jun Date: Wed Aug 5 13:29:16 UTC 2009
Modified Files: src/sys/dev/ic: i82365.c Log Message: fix pcic kthread creation timing. see http://mail-index.netbsd.org/current-users/2008/07/15/msg003526.html fix kern/41791 & port-hpcmips/41164. ok by uwe & tsutsui To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/dev/ic/i82365.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/ic/i82365.c diff -u src/sys/dev/ic/i82365.c:1.107 src/sys/dev/ic/i82365.c:1.108 --- src/sys/dev/ic/i82365.c:1.107 Tue May 12 14:25:17 2009 +++ src/sys/dev/ic/i82365.c Wed Aug 5 13:29:16 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: i82365.c,v 1.107 2009/05/12 14:25:17 cegger Exp $ */ +/* $NetBSD: i82365.c,v 1.108 2009/08/05 13:29:16 jun Exp $ */ /* * Copyright (c) 2004 Charles M. Hannum. All rights reserved. @@ -49,7 +49,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: i82365.c,v 1.107 2009/05/12 14:25:17 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i82365.c,v 1.108 2009/08/05 13:29:16 jun Exp $"); #define PCICDEBUG @@ -390,7 +390,6 @@ struct pcmciabus_attach_args paa; struct pcic_softc *sc = (struct pcic_softc *)h->ph_parent; int locs[PCMCIABUSCF_NLOCS]; - char cs[4]; /* initialize the rest of the handle */ @@ -417,21 +416,6 @@ return; } - /* - * queue creation of a kernel thread to handle insert/removal events. - */ -#ifdef DIAGNOSTIC - if (h->event_thread != NULL) - panic("pcic_attach_socket: event thread"); -#endif - config_pending_incr(); - snprintf(cs, sizeof(cs), "%d,%d", h->chip, h->socket); - - if (kthread_create(PRI_NONE, 0, NULL, pcic_event_thread, h, - &h->event_thread, "%s,%s", device_xname(h->ph_parent), cs)) { - aprint_error_dev(h->ph_parent, "unable to create event thread for sock 0x%02x\n", h->sock); - panic("pcic_attach_socket"); - } } /* @@ -457,6 +441,7 @@ { struct pcic_softc *sc = (struct pcic_softc *)h->ph_parent; int reg; + char cs[4]; DPRINTF(("%s: attach finish socket %ld\n", device_xname(h->ph_parent), (long) (h - &sc->handle[0]))); @@ -511,6 +496,22 @@ } else { h->laststate = PCIC_LASTSTATE_EMPTY; } + + /* + * queue creation of a kernel thread to handle insert/removal events. + */ +#ifdef DIAGNOSTIC + if (h->event_thread != NULL) + panic("pcic_attach_socket: event thread"); +#endif + config_pending_incr(); + snprintf(cs, sizeof(cs), "%d,%d", h->chip, h->socket); + + if (kthread_create(PRI_NONE, 0, NULL, pcic_event_thread, h, + &h->event_thread, "%s,%s", device_xname(h->ph_parent), cs)) { + aprint_error_dev(h->ph_parent, "unable to create event thread for sock 0x%02x\n", h->sock); + panic("pcic_attach_socket"); + } } void