ChangeLog: - Fix "could sleep" problems in pcn_attach() - Lock pcn_intr() - Remove duplicate callout_handle_init() from pcn_attach() Index: if_pcn.c =================================================================== RCS file: /home/ncvs/src/sys/pci/if_pcn.c,v retrieving revision 1.30 diff -u -r1.30 if_pcn.c --- if_pcn.c 21 Jan 2003 08:56:11 -0000 1.30 +++ if_pcn.c 6 Feb 2003 23:11:56 -0000 @@ -521,7 +521,6 @@ /* Initialize our mutex. */ mtx_init(&sc->pcn_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); - PCN_LOCK(sc); /* * Handle power management nonsense. @@ -620,7 +619,6 @@ sc->arpcom.ac_enaddr, ":"); sc->pcn_unit = unit; - callout_handle_init(&sc->pcn_stat_ch); sc->pcn_ldata = contigmalloc(sizeof(struct pcn_list_data), M_DEVBUF, M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0); @@ -667,12 +665,12 @@ */ ether_ifattach(ifp, (u_int8_t *) eaddr); callout_handle_init(&sc->pcn_stat_ch); - PCN_UNLOCK(sc); + return(0); fail: - PCN_UNLOCK(sc); - mtx_destroy(&sc->pcn_mtx); + if (error != 0) + mtx_destroy(&sc->pcn_mtx); return(error); } @@ -977,6 +975,8 @@ return; } + PCN_LOCK(sc); + CSR_WRITE_4(sc, PCN_IO32_RAP, PCN_CSR_CSR); while ((status = CSR_READ_4(sc, PCN_IO32_RDP)) & PCN_CSR_INTR) { @@ -997,6 +997,8 @@ if (ifp->if_snd.ifq_head != NULL) pcn_start(ifp); + PCN_UNLOCK(sc); + return; } @@ -1401,6 +1403,7 @@ ifp->if_timer = 0; untimeout(pcn_tick, sc, sc->pcn_stat_ch); + PCN_CSR_CLRBIT(sc, PCN_CSR_CSR, PCN_CSR_INTEN); PCN_CSR_SETBIT(sc, PCN_CSR_CSR, PCN_CSR_STOP); sc->pcn_link = 0;