static void tws_drain_reserved_reqs(struct tws_softc *sc) { struct tws_request *r; r = &sc->reqs[TWS_REQ_TYPE_AEN_FETCH]; if ( r->state != TWS_REQ_STATE_FREE ) { TWS_TRACE_DEBUG(sc, "reset aen req", 0, 0); untimeout(tws_timeout, r, r->thandle); tws_unmap_request(sc, r); free(r->data, M_TWS); r->state = TWS_REQ_STATE_FREE; r->error_code = TWS_REQ_RET_RESET; } r = &sc->reqs[TWS_REQ_TYPE_PASSTHRU]; if ( r->state == TWS_REQ_STATE_BUSY ) { TWS_TRACE_DEBUG(sc, "reset passthru req", 0, 0); r->error_code = TWS_REQ_RET_RESET; } r = &sc->reqs[TWS_REQ_TYPE_GETSET_PARAM]; if ( r->state != TWS_REQ_STATE_FREE ) { TWS_TRACE_DEBUG(sc, "reset setparam req", 0, 0); untimeout(tws_timeout, r, r->thandle); tws_unmap_request(sc, r); free(r->data, M_TWS); r->state = TWS_REQ_STATE_FREE; r->error_code = TWS_REQ_RET_RESET; } }
STATIC void spm_free_priv(queue_t *q) { uint t; spm_t *s = PRIV(q); ensure(s, return); if (s->rbid) unbufcall(xchg(&s->rbid, 0)); if (s->wbid) unbufcall(xchg(&s->wbid, 0)); if ((*(s->prev) = s->next)) s->next->prev = s->prev; s->next = NULL; s->prev = NULL; if ((t = xchg(&s->wtim, 0))) untimeout(t); if ((t = xchg(&s->rtim, 0))) untimeout(t); noenable(s->wq); noenable(s->rq); assure(s->refcnt == 0); printd(("spm: unlinked module private structure\n")); kmem_cache_free(spm_priv_cachep, s); printd(("spm: freed module private structure\n")); return; }
static void upap_lowerdown (void) { #ifdef AUTH_CFG_CLIENT #if defined(DEF_PAP_TIMEOUT) if (client_state == PAP_CS_AUTHREQ) untimeout((FP)upap_timeout, NULL); #endif /* of #if defined(DEF_PAP_TIMEOUT) */ client_state = PAP_CS_INIT; #endif /* of #ifdef AUTH_CFG_CLIENT */ #ifdef AUTH_CFG_SERVER #if defined(DEF_PAP_REQTIME) if (server_state == PAP_SS_LISTEN) untimeout((FP)upap_reqtimeout, NULL); #endif /* of #if defined(DEF_PAP_REQTIME) */ server_state = PAP_SS_INIT; #endif /* of #ifdef AUTH_CFG_SERVER */ }
static void ddksample_trigger (int dev, int state) { ddksample_portc *portc = ossddk_adev_get_portc (dev); if (portc->open_mode & OPEN_WRITE) { if ((state & PCM_ENABLE_OUTPUT) && (portc->prepare_flags & PCM_ENABLE_OUTPUT)) { portc->prepare_flags &= ~PCM_ENABLE_OUTPUT; /* * Arm the timeout if it was not started yet. */ if (portc->audio_active == 0) portc->timeout_id = timeout (ddksample_intr, portc, portc->timeout_value); portc->audio_active |= PCM_ENABLE_OUTPUT; } else if (!(state & PCM_ENABLE_OUTPUT) && (portc->audio_active & PCM_ENABLE_OUTPUT)) { portc->audio_active &= ~PCM_ENABLE_OUTPUT; if (portc->audio_active == 0) untimeout (portc->timeout_id); portc->timeout_id = 0; } } if (portc->open_mode & OPEN_READ) { if ((state & PCM_ENABLE_INPUT) && (portc->prepare_flags & PCM_ENABLE_INPUT)) { portc->prepare_flags &= ~PCM_ENABLE_INPUT; /* * Arm the timeout if it was not started yet. */ if (portc->audio_active == 0) portc->timeout_id = timeout (ddksample_intr, portc, portc->timeout_value); portc->audio_active |= PCM_ENABLE_INPUT; } else if (!(state & PCM_ENABLE_INPUT) && (portc->audio_active & PCM_ENABLE_INPUT)) { portc->audio_active &= ~PCM_ENABLE_INPUT; if (portc->audio_active == 0) untimeout (portc->timeout_id); portc->timeout_id = 0; } } }
/*---------------------------------------------------------------------------* * timer T313 stop *---------------------------------------------------------------------------*/ void T313_stop(call_desc_t *cd) { if(cd->T313 != TIMER_IDLE) { cd->T313 = TIMER_IDLE; #if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 untimeout((TIMEOUT_FUNC_T)T313_timeout, (void *)cd, cd->T313_callout); #else untimeout((TIMEOUT_FUNC_T)T313_timeout, (void *)cd); #endif } DBGL3(L3_T_MSG, "T313_stop", ("cr = %d\n", cd->cr)); }
static void tws_drain_busy_queue(struct tws_softc *sc) { struct tws_request *req; union ccb *ccb; TWS_TRACE_DEBUG(sc, "entry", 0, 0); mtx_lock(&sc->q_lock); req = tws_q_remove_tail(sc, TWS_BUSY_Q); mtx_unlock(&sc->q_lock); while ( req ) { TWS_TRACE_DEBUG(sc, "moved to TWS_COMPLETE_Q", 0, req->request_id); untimeout(tws_timeout, req, req->ccb_ptr->ccb_h.timeout_ch); req->error_code = TWS_REQ_RET_RESET; ccb = (union ccb *)(req->ccb_ptr); ccb->ccb_h.status &= ~CAM_SIM_QUEUED; ccb->ccb_h.status |= CAM_REQUEUE_REQ; ccb->ccb_h.status |= CAM_SCSI_BUS_RESET; tws_unmap_request(req->sc, req); mtx_lock(&sc->sim_lock); xpt_done(req->ccb_ptr); mtx_unlock(&sc->sim_lock); mtx_lock(&sc->q_lock); tws_q_insert_tail(sc, req, TWS_FREE_Q); req = tws_q_remove_tail(sc, TWS_BUSY_Q); mtx_unlock(&sc->q_lock); } }
static void bvm_tty_close(struct tty *tp) { /* XXX Should be replaced with callout_stop(9) */ untimeout(bvm_timeout, tp, bvm_timeouthandle); }
void rdsv3_cancel_delayed_work(rdsv3_delayed_work_t *dwp) { RDSV3_DPRINTF4("rdsv3_cancel_delayed_work", "Enter(wq: %p, dwp: %p)", dwp->wq, dwp); mutex_enter(&dwp->lock); if (dwp->timeid != 0) { (void) untimeout(dwp->timeid); dwp->timeid = 0; } else { RDSV3_DPRINTF4("rdsv3_cancel_delayed_work", "Nothing to cancel (wq: %p, dwp: %p)", dwp->wq, dwp); mutex_exit(&dwp->lock); return; } mutex_exit(&dwp->lock); mutex_enter(&dwp->wq->wq_lock); dwp->wq->wq_pending--; mutex_exit(&dwp->wq->wq_lock); RDSV3_DPRINTF4("rdsv3_cancel_delayed_work", "Return(wq: %p, dwp: %p)", dwp->wq, dwp); }
/* clean up so we can unload the driver. */ int ips_adapter_free(ips_softc_t *sc) { int error = 0; intrmask_t mask; if(sc->state & IPS_DEV_OPEN) return EBUSY; if((error = ips_diskdev_free(sc))) return error; if(ips_cmdqueue_free(sc)){ device_printf(sc->dev, "trying to exit when command queue is not empty!\n"); return EBUSY; } DEVICE_PRINTF(1, sc->dev, "free\n"); mask = splbio(); untimeout(ips_timeout, sc, sc->timer); splx(mask); if (mtx_initialized(&sc->cmd_mtx)) mtx_destroy(&sc->cmd_mtx); if(sc->sg_dmatag) bus_dma_tag_destroy(sc->sg_dmatag); if(sc->command_dmatag) bus_dma_tag_destroy(sc->command_dmatag); if(sc->device_file) destroy_dev(sc->device_file); return 0; }
/*ARGSUSED*/ static int xcalwd_close(dev_t dev, int flag, int otyp, cred_t *credp) { xcalwd_state_t *tsp; int instance; timeout_id_t tid; instance = getminor(dev); if (instance < 0) return (ENXIO); tsp = ddi_get_soft_state(xcalwd_statep, instance); if (tsp == NULL) return (ENXIO); mutex_enter(&tsp->lock); if (tsp->started == B_FALSE) { tsp->tid = 0; mutex_exit(&tsp->lock); return (0); } /* * The watchdog is enabled. Cancel the pending timer * and call plat_fan_blast. */ tsp->started = B_FALSE; tid = tsp->tid; tsp->tid = 0; mutex_exit(&tsp->lock); if (tid != 0) (void) untimeout(tid); plat_fan_blast(); return (0); }
static void sess_sm_q4_failed(iscsit_sess_t *ist, sess_event_ctx_t *ctx) { /* Session timer must not be running when we leave this event */ switch (ctx->se_ctx_event) { case SE_CONN_IN_LOGIN: /* N7 */ sess_sm_new_state(ist, ctx, SS_Q5_CONTINUE); break; case SE_SESSION_REINSTATE: /* N6 */ (void) untimeout(ist->ist_state_timeout); /*FALLTHROUGH*/ case SE_SESSION_TIMEOUT: /* N6 */ sess_sm_new_state(ist, ctx, SS_Q6_DONE); break; case SE_CONN_FAIL: /* Don't care */ break; default: ASSERT(0); break; } }
int beeper_off(void) { BEEP_DEBUG1((CE_CONT, "beeper_off : start.")); mutex_enter(&beep_state.mutex); if (beep_state.mode == BEEP_UNINIT) { mutex_exit(&beep_state.mutex); return (ENXIO); } if (beep_state.mode == BEEP_TIMED) { (void) untimeout(beep_state.timeout_id); beep_state.timeout_id = 0; } if (beep_state.mode != BEEP_OFF) { beep_state.mode = BEEP_OFF; if (beep_state.beep_off != NULL) (*beep_state.beep_off)(beep_state.arg); } beep_state.queue_head = 0; beep_state.queue_tail = 0; mutex_exit(&beep_state.mutex); BEEP_DEBUG1((CE_CONT, "beeper_off : done.")); return (0); }
/* * Cause timeout_mp to be called soonest */ void reschedule_timeout_mp(void) { if (timeout_mp_id) untimeout(timeout_mp_id); timeout_mp_id = timeout(0, timeout_mp, 0); }
/* * pccard_remove_controller - Called when the slot * driver is unloaded. The plan is to unload * drivers from the slots, and then remove the * slots from the slot list, and then finally * remove the controller structure. Messy... */ void pccard_remove_controller(struct slot_ctrl *cp) { struct slot *sp, *next, *last = 0; struct slot_ctrl *cl; struct pccard_dev *dp; for (sp = slot_list; sp; sp = next) { next = sp->next; /* * If this slot belongs to this controller, * remove this slot. */ if (sp->ctrl == cp) { pccard_slots[sp->slot] = 0; if (sp->insert_seq) untimeout(inserted, (void *)sp); /* * Unload the drivers attached to this slot. */ while (dp = sp->devices) remove_device(dp); /* * Disable the slot and unlink the slot from the * slot list. */ disable_slot(sp); if (last) last->next = next; else slot_list = next; #if NAPM > 0 apm_hook_disestablish(APM_HOOK_SUSPEND, &s_hook[sp->slot]); apm_hook_disestablish(APM_HOOK_RESUME, &r_hook[sp->slot]); #endif if (cp->extra && sp->cdata) FREE(sp->cdata, M_DEVBUF); FREE(sp, M_DEVBUF); /* * xx Can't use sp after we have freed it. */ } else { last = sp; } } /* * Unlink controller structure from controller list. */ if (cont_list == cp) cont_list = cp->next; else for (cl = cont_list; cl->next; cl = cl->next) if (cl->next == cp) { cl->next = cp->next; break; } }
void tws_cmd_complete(struct tws_request *req) { struct tws_softc *sc = req->sc; untimeout(tws_timeout, req, req->ccb_ptr->ccb_h.timeout_ch); tws_unmap_request(sc, req); }
static void ahbhandleimmed(struct ahb_softc *ahb, u_int32_t mbox, u_int intstat) { struct ccb_hdr *ccb_h; u_int target_id; if (ahb->immed_cmd == 0) { printf("ahb%ld: Immediate Command complete with no " " pending command\n", ahb->unit); return; } target_id = intstat & INTSTAT_TARGET_MASK; ccb_h = LIST_FIRST(&ahb->pending_ccbs); while (ccb_h != NULL) { struct ecb *pending_ecb; union ccb *ccb; pending_ecb = (struct ecb *)ccb_h->ccb_ecb_ptr; ccb = pending_ecb->ccb; ccb_h = LIST_NEXT(ccb_h, sim_links.le); if (ccb->ccb_h.target_id == target_id || target_id == ahb->scsi_id) { untimeout(ahbtimeout, pending_ecb, ccb->ccb_h.timeout_ch); LIST_REMOVE(&ccb->ccb_h, sim_links.le); if ((ccb->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) bus_dmamap_unload(ahb->buffer_dmat, pending_ecb->dmamap); if (pending_ecb == ahb->immed_ecb) ccb->ccb_h.status = CAM_CMD_TIMEOUT|CAM_RELEASE_SIMQ; else if (target_id == ahb->scsi_id) ccb->ccb_h.status = CAM_SCSI_BUS_RESET; else ccb->ccb_h.status = CAM_BDR_SENT; ahbecbfree(ahb, pending_ecb); xpt_done(ccb); } else if (ahb->immed_ecb != NULL) { /* Re-instate timeout */ ccb->ccb_h.timeout_ch = timeout(ahbtimeout, (caddr_t)pending_ecb, (ccb->ccb_h.timeout * hz) / 1000); } } if (ahb->immed_ecb != NULL) { ahb->immed_ecb = NULL; printf("ahb%ld: No longer in timeout\n", ahb->unit); } else if (target_id == ahb->scsi_id) printf("ahb%ld: SCSI Bus Reset Delivered\n", ahb->unit); else printf("ahb%ld: Bus Device Reset Delibered to target %d\n", ahb->unit, target_id); ahb->immed_cmd = 0; }
void os_request_timer(void * osext, HPT_U32 interval) { PVBUS_EXT vbus_ext = osext; HPT_ASSERT(vbus_ext->ext_type==EXT_TYPE_VBUS); untimeout(os_timer_for_ldm, vbus_ext, vbus_ext->timer); vbus_ext->timer = timeout(os_timer_for_ldm, vbus_ext, interval * hz / 1000000); }
static void idm_state_s3_xpt_up(idm_conn_t *ic, idm_conn_event_ctx_t *event_ctx) { switch (event_ctx->iec_event) { case CE_LOGIN_RCV: /* T4 */ idm_initial_login_actions(ic, event_ctx); idm_update_state(ic, CS_S4_IN_LOGIN, event_ctx); break; case CE_LOGIN_TIMEOUT: /* * Don't need to cancel login timer since the timer is * presumed to be the source of this event. */ (void) idm_notify_client(ic, CN_LOGIN_FAIL, NULL); idm_update_state(ic, CS_S9_INIT_ERROR, event_ctx); break; case CE_CONNECT_REJECT: /* * Iscsit doesn't want to hear from us again in this case. * Since it rejected the connection it doesn't have a * connection context to handle additional notifications. * IDM needs to just clean things up on its own. */ (void) untimeout(ic->ic_state_timeout); idm_update_state(ic, CS_S9A_REJECTED, event_ctx); break; case CE_CONNECT_FAIL: case CE_TRANSPORT_FAIL: case CE_LOGOUT_OTHER_CONN_SND: /* T6 */ (void) untimeout(ic->ic_state_timeout); (void) idm_notify_client(ic, CN_LOGIN_FAIL, NULL); idm_update_state(ic, CS_S9_INIT_ERROR, event_ctx); break; case CE_TX_PROTOCOL_ERROR: case CE_RX_PROTOCOL_ERROR: /* Don't care */ break; default: ASSERT(0); /*NOTREACHED*/ } }
void BnxeTimerStop(um_device_t * pUM) { atomic_swap_32(&pUM->timerEnabled, B_FALSE); BNXE_LOCK_ENTER_TIMER(pUM); BNXE_LOCK_EXIT_TIMER(pUM); untimeout(pUM->timerID); pUM->timerID = 0; }
static void tws_scsi_err_complete(struct tws_request *req, struct tws_command_header *hdr) { u_int8_t *sense_data; struct tws_softc *sc = req->sc; union ccb *ccb = req->ccb_ptr; TWS_TRACE_DEBUG(sc, "sbe, cmd_status", hdr->status_block.error, req->cmd_pkt->cmd.pkt_a.status); if ( hdr->status_block.error == TWS_ERROR_LOGICAL_UNIT_NOT_SUPPORTED || hdr->status_block.error == TWS_ERROR_UNIT_OFFLINE ) { if ( ccb->ccb_h.target_lun ) { TWS_TRACE_DEBUG(sc, "invalid lun error",0,0); ccb->ccb_h.status |= CAM_DEV_NOT_THERE; } else { TWS_TRACE_DEBUG(sc, "invalid target error",0,0); ccb->ccb_h.status |= CAM_SEL_TIMEOUT; } } else { TWS_TRACE_DEBUG(sc, "scsi status error",0,0); ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR; if (((ccb->csio.cdb_io.cdb_bytes[0] == 0x1A) && (hdr->status_block.error == TWS_ERROR_NOT_SUPPORTED))) { ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR | CAM_AUTOSNS_VALID; TWS_TRACE_DEBUG(sc, "page mode not supported",0,0); } } /* if there were no error simply mark complete error */ if (ccb->ccb_h.status == 0) ccb->ccb_h.status = CAM_REQ_CMP_ERR; sense_data = (u_int8_t *)&ccb->csio.sense_data; if (sense_data) { memcpy(sense_data, hdr->sense_data, TWS_SENSE_DATA_LENGTH ); ccb->csio.sense_len = TWS_SENSE_DATA_LENGTH; ccb->ccb_h.status |= CAM_AUTOSNS_VALID; } ccb->csio.scsi_status = req->cmd_pkt->cmd.pkt_a.status; ccb->ccb_h.status &= ~CAM_SIM_QUEUED; mtx_lock(&sc->sim_lock); xpt_done(ccb); mtx_unlock(&sc->sim_lock); untimeout(tws_timeout, req, req->ccb_ptr->ccb_h.timeout_ch); tws_unmap_request(req->sc, req); mtx_lock(&sc->q_lock); tws_q_remove_request(sc, req, TWS_BUSY_Q); tws_q_insert_tail(sc, req, TWS_FREE_Q); mtx_unlock(&sc->q_lock); }
/*---------------------------------------------------------------------------* * Timer T4 stop *---------------------------------------------------------------------------*/ static void T4_stop(struct l1_softc *sc) { NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); if(sc->sc_I430T4) { sc->sc_I430T4 = 0; untimeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, sc->sc_T4_callout); } }
static void ecos_del_timer(ecos_timer_entry_t *entry) { if (entry == NULL) return; if (entry->timer) untimeout((timeout_fun *)timer_func, entry); ecos_timer_count--; return; }
mntfs * dup_mntfs(mntfs *mf) { if (mf->mf_refc == 0) { if (mf->mf_cid) untimeout(mf->mf_cid); mf->mf_cid = 0; } mf->mf_refc++; return mf; }
int mii_stop_portmon(mii_handle_t mac) { if (!mac->mii_linknotify || !mac->portmon_timer) return (MII_STATE); mac->mii_linknotify = NULL; mac->lock = NULL; (void) untimeout(mac->portmon_timer); mac->portmon_timer = 0; return (MII_SUCCESS); }
/*---------------------------------------------------------------------------* * I.430 Timer T3 stop *---------------------------------------------------------------------------*/ static void T3_stop(struct l1_softc *sc) { NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); sc->sc_init_tries = 0; /* init connect retry count */ if(sc->sc_I430T3) { sc->sc_I430T3 = 0; untimeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, sc->sc_T3_callout); } }
void os_request_timer(void * osext, HPT_U32 interval) { PVBUS_EXT vbus_ext = osext; HPT_ASSERT(vbus_ext->ext_type==EXT_TYPE_VBUS); #if (__FreeBSD_version >= 1000510) callout_reset_sbt(&vbus_ext->timer, SBT_1US * interval, 0, os_timer_for_ldm, vbus_ext, 0); #else untimeout(os_timer_for_ldm, vbus_ext, vbus_ext->timer); vbus_ext->timer = timeout(os_timer_for_ldm, vbus_ext, interval * hz / 1000000); #endif }
void tws_getset_param_complete(struct tws_request *req) { struct tws_softc *sc = req->sc; TWS_TRACE_DEBUG(sc, "getset complete", req, req->request_id); untimeout(tws_timeout, req, req->thandle); tws_unmap_request(sc, req); free(req->data, M_TWS); req->state = TWS_REQ_STATE_FREE; }
/* * mseclose: just turn off mouse innterrupts. */ static int mseclose(struct cdev *dev, int flags, int fmt, struct thread *td) { mse_softc_t *sc = dev->si_drv1; int s; untimeout(msetimeout, dev, sc->sc_callout); callout_handle_init(&sc->sc_callout); s = spltty(); (*sc->sc_disablemouse)(sc->sc_iot, sc->sc_ioh); sc->sc_flags &= ~MSESC_OPEN; splx(s); return(0); }
void atp_unlink() { untimeout(asp_clock_locked, (void *)&atp_inited); untimeout(atp_trp_clock_locked, (void *)&atp_inited); atp_untimout(atp_rcb_timer, trp_tmo_rcb); trp_tmo_list = 0; #ifdef BAD_IDEA /* allocated in asp_scb_alloc(), which is called by asp_open() */ if (scb_resource_m) { gbuf_freem(scb_resource_m); scb_resource_m = 0; scb_free_list = 0; } /* allocated in atp_trans_alloc() */ if (atp_resource_m) { gbuf_freem(atp_resource_m); atp_resource_m = 0; atp_trans_free_list = 0; } #endif }
static void pst_done(struct iop_softc *sc, u_int32_t mfa, struct i2o_single_reply *reply) { struct pst_request *request = (struct pst_request *)reply->transaction_context; struct pst_softc *psc = request->psc; untimeout((timeout_t *)pst_timeout, request, request->timeout_handle); request->bp->bio_resid = request->bp->bio_bcount - reply->donecount; biofinish(request->bp, NULL, reply->status ? EIO : 0); free(request, M_PSTRAID); psc->iop->reg->oqueue = mfa; psc->iop->outstanding--; pst_start(psc); }