/** * amdgpu_fence_fallback - fallback for hardware interrupts * * @work: delayed work item * * Checks for fence activity. */ static void amdgpu_fence_fallback(struct timer_list *t) { struct amdgpu_ring *ring = from_timer(ring, t, fence_drv.fallback_timer); amdgpu_fence_process(ring); }
static void join_timeout_handler (struct timer_list *t) { struct _adapter *adapter = from_timer(adapter, t, mlmepriv.assoc_timer); _r8712_join_timeout_handler(adapter); }
static void poll_health(struct timer_list *t) { struct mlx5_core_dev *dev = from_timer(dev, t, priv.health.timer); struct mlx5_core_health *health = &dev->priv.health; u32 count; if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) goto out; count = ioread32be(health->health_counter); if (count == health->prev) ++health->miss_counter; else health->miss_counter = 0; health->prev = count; if (health->miss_counter == MAX_MISSES) { dev_err(&dev->pdev->dev, "device's health compromised - reached miss count\n"); print_health_info(dev); } if (in_fatal(dev) && !health->sick) { health->sick = true; print_health_info(dev); mlx5_trigger_health_work(dev); } out: mod_timer(&health->timer, get_next_poll_jiffies()); }
/* ----------------------------------------------------------------------------- * Hardware trigger */ static void lm3554_flash_off_delay(struct timer_list *t) { struct lm3554 *flash = from_timer(flash, t, flash_off_delay); struct lm3554_platform_data *pdata = flash->pdata; gpio_set_value(pdata->gpio_strobe, 0); }
static void tpt_trig_timer(struct timer_list *t) { struct tpt_led_trigger *tpt_trig = from_timer(tpt_trig, t, timer); struct ieee80211_local *local = tpt_trig->local; struct led_classdev *led_cdev; unsigned long on, off, tpt; int i; if (!tpt_trig->running) return; mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ)); tpt = tpt_trig_traffic(local, tpt_trig); /* default to just solid on */ on = 1; off = 0; for (i = tpt_trig->blink_table_len - 1; i >= 0; i--) { if (tpt_trig->blink_table[i].throughput < 0 || tpt > tpt_trig->blink_table[i].throughput) { off = tpt_trig->blink_table[i].blink_time / 2; on = tpt_trig->blink_table[i].blink_time - off; break; } } read_lock(&local->tpt_led.leddev_list_lock); list_for_each_entry(led_cdev, &local->tpt_led.led_cdevs, trig_list) led_blink_set(led_cdev, &on, &off); read_unlock(&local->tpt_led.leddev_list_lock); }
static void _scan_timeout_handler (struct timer_list *t) { struct _adapter *adapter = from_timer(adapter, t, mlmepriv.scan_to_timer); r8712_scan_timeout_handler(adapter); }
static void hci_ibs_tx_idle_timeout(struct timer_list *t) { struct qca_data *qca = from_timer(qca, t, tx_idle_timer); struct hci_uart *hu = qca->hu; unsigned long flags; BT_DBG("hu %p idle timeout in %d state", hu, qca->tx_ibs_state); spin_lock_irqsave_nested(&qca->hci_ibs_lock, flags, SINGLE_DEPTH_NESTING); switch (qca->tx_ibs_state) { case HCI_IBS_TX_AWAKE: /* TX_IDLE, go to SLEEP */ if (send_hci_ibs_cmd(HCI_IBS_SLEEP_IND, hu) < 0) { BT_ERR("Failed to send SLEEP to device"); break; } qca->tx_ibs_state = HCI_IBS_TX_ASLEEP; qca->ibs_sent_slps++; queue_work(qca->workqueue, &qca->ws_tx_vote_off); break; case HCI_IBS_TX_ASLEEP: case HCI_IBS_TX_WAKING: /* Fall through */ default: BT_ERR("Spurious timeout tx state %d", qca->tx_ibs_state); break; } spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); }
/* * toggle the bit to wake up uCode and check the temperature * if the temperature is below CT, uCode will stay awake and send card * state notification with CT_KILL bit clear to inform Thermal Throttling * Management to change state. Otherwise, uCode will go back to sleep * without doing anything, driver should continue the 5 seconds timer * to wake up uCode for temperature check until temperature drop below CT */ static void iwl_tt_check_exit_ct_kill(struct timer_list *t) { struct iwl_priv *priv = from_timer(priv, t, thermal_throttle.ct_kill_exit_tm); struct iwl_tt_mgmt *tt = &priv->thermal_throttle; unsigned long flags; if (test_bit(STATUS_EXIT_PENDING, &priv->status)) return; if (tt->state == IWL_TI_CT_KILL) { if (priv->thermal_throttle.ct_kill_toggle) { iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); priv->thermal_throttle.ct_kill_toggle = false; } else { iwl_write32(priv->trans, CSR_UCODE_DRV_GP1_SET, CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); priv->thermal_throttle.ct_kill_toggle = true; } iwl_read32(priv->trans, CSR_UCODE_DRV_GP1); if (iwl_trans_grab_nic_access(priv->trans, &flags)) iwl_trans_release_nic_access(priv->trans, &flags); /* Reschedule the ct_kill timer to occur in * CT_KILL_EXIT_DURATION seconds to ensure we get a * thermal update */ IWL_DEBUG_TEMP(priv, "schedule ct_kill exit timer\n"); mod_timer(&priv->thermal_throttle.ct_kill_exit_tm, jiffies + CT_KILL_EXIT_DURATION * HZ); } }
static void settle_timeout(struct timer_list *t) { struct floppy_state *fs = from_timer(fs, t, timeout); struct swim3 __iomem *sw = fs->swim3; unsigned long flags; swim3_dbg("* settle timeout, state=%d\n", fs->state); spin_lock_irqsave(&swim3_lock, flags); fs->timeout_pending = 0; if (swim3_readbit(fs, SEEK_COMPLETE)) { out_8(&sw->select, RELAX); fs->state = locating; act(fs); goto unlock; } out_8(&sw->select, RELAX); if (fs->settle_time < 2*HZ) { ++fs->settle_time; set_timeout(fs, 1, settle_timeout); goto unlock; } swim3_err("%s", "Seek settle timeout\n"); swim3_end_request(fs, BLK_STS_IOERR, 0); fs->state = idle; start_request(fs); unlock: spin_unlock_irqrestore(&swim3_lock, flags); }
static void xfer_timeout(struct timer_list *t) { struct floppy_state *fs = from_timer(fs, t, timeout); struct swim3 __iomem *sw = fs->swim3; struct dbdma_regs __iomem *dr = fs->dma; unsigned long flags; int n; swim3_dbg("* xfer timeout, state=%d\n", fs->state); spin_lock_irqsave(&swim3_lock, flags); fs->timeout_pending = 0; out_le32(&dr->control, RUN << 16); /* We must wait a bit for dbdma to stop */ for (n = 0; (in_le32(&dr->status) & ACTIVE) && n < 1000; n++) udelay(1); out_8(&sw->intr_enable, 0); out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION); out_8(&sw->select, RELAX); swim3_err("Timeout %sing sector %ld\n", (rq_data_dir(fs->cur_req)==WRITE? "writ": "read"), (long)blk_rq_pos(fs->cur_req)); swim3_end_request(fs, BLK_STS_IOERR, 0); fs->state = idle; start_request(fs); spin_unlock_irqrestore(&swim3_lock, flags); }
static void est_timer(struct timer_list *t) { struct net_rate_estimator *est = from_timer(est, t, timer); struct gnet_stats_basic_packed b; u64 rate, brate; est_fetch_counters(est, &b); brate = (b.bytes - est->last_bytes) << (10 - est->ewma_log - est->intvl_log); brate -= (est->avbps >> est->ewma_log); rate = (u64)(b.packets - est->last_packets) << (10 - est->ewma_log - est->intvl_log); rate -= (est->avpps >> est->ewma_log); write_seqcount_begin(&est->seq); est->avbps += brate; est->avpps += rate; write_seqcount_end(&est->seq); est->last_bytes = b.bytes; est->last_packets = b.packets; est->next_jiffies += ((HZ/4) << est->intvl_log); if (unlikely(time_after_eq(jiffies, est->next_jiffies))) { /* Ouch... timer was delayed. */ est->next_jiffies = jiffies + 1; } mod_timer(&est->timer, est->next_jiffies); }
static void qtnf_scan_timeout(struct timer_list *t) { struct qtnf_wmac *mac = from_timer(mac, t, scan_timeout); pr_warn("mac%d scan timed out\n", mac->macid); qtnf_scan_done(mac, true); }
void mesh_path_timer(struct timer_list *t) { struct mesh_path *mpath = from_timer(mpath, t, timer); struct ieee80211_sub_if_data *sdata = mpath->sdata; int ret; if (sdata->local->quiescing) return; spin_lock_bh(&mpath->state_lock); if (mpath->flags & MESH_PATH_RESOLVED || (!(mpath->flags & MESH_PATH_RESOLVING))) { mpath->flags &= ~(MESH_PATH_RESOLVING | MESH_PATH_RESOLVED); spin_unlock_bh(&mpath->state_lock); } else if (mpath->discovery_retries < max_preq_retries(sdata)) { ++mpath->discovery_retries; mpath->discovery_timeout *= 2; mpath->flags &= ~MESH_PATH_REQ_QUEUED; spin_unlock_bh(&mpath->state_lock); mesh_queue_preq(mpath, 0); } else { mpath->flags &= ~(MESH_PATH_RESOLVING | MESH_PATH_RESOLVED | MESH_PATH_REQ_QUEUED); mpath->exp_time = jiffies; spin_unlock_bh(&mpath->state_lock); if (!mpath->is_gate && mesh_gate_num(sdata) > 0) { ret = mesh_path_send_to_gates(mpath); if (ret) mhwmp_dbg(sdata, "no gate was reachable\n"); } else mesh_path_flush_pending(mpath); } }
static void dhcp_timeout_handler (struct timer_list *t) { struct _adapter *adapter = from_timer(adapter, t, mlmepriv.dhcp_timer); _r8712_dhcp_timeout_handler(adapter); }
static void led_heartbeat_function(struct timer_list *t) { struct heartbeat_trig_data *heartbeat_data = from_timer(heartbeat_data, t, timer); struct led_classdev *led_cdev; unsigned long brightness = LED_OFF; unsigned long delay = 0; led_cdev = heartbeat_data->led_cdev; if (unlikely(panic_heartbeats)) { led_set_brightness_nosleep(led_cdev, LED_OFF); return; } if (test_and_clear_bit(LED_BLINK_BRIGHTNESS_CHANGE, &led_cdev->work_flags)) led_cdev->blink_brightness = led_cdev->new_blink_brightness; /* acts like an actual heart beat -- ie thump-thump-pause... */ switch (heartbeat_data->phase) { case 0: /* * The hyperbolic function below modifies the * heartbeat period length in dependency of the * current (1min) load. It goes through the points * f(0)=1260, f(1)=860, f(5)=510, f(inf)->300. */ heartbeat_data->period = 300 + (6720 << FSHIFT) / (5 * avenrun[0] + (7 << FSHIFT)); heartbeat_data->period = msecs_to_jiffies(heartbeat_data->period); delay = msecs_to_jiffies(70); heartbeat_data->phase++; if (!heartbeat_data->invert) brightness = led_cdev->blink_brightness; break; case 1: delay = heartbeat_data->period / 4 - msecs_to_jiffies(70); heartbeat_data->phase++; if (heartbeat_data->invert) brightness = led_cdev->blink_brightness; break; case 2: delay = msecs_to_jiffies(70); heartbeat_data->phase++; if (!heartbeat_data->invert) brightness = led_cdev->blink_brightness; break; default: delay = heartbeat_data->period - heartbeat_data->period / 4 - msecs_to_jiffies(70); heartbeat_data->phase = 0; if (heartbeat_data->invert) brightness = led_cdev->blink_brightness; break; } led_set_brightness_nosleep(led_cdev, brightness); mod_timer(&heartbeat_data->timer, jiffies + delay); }
static void mpc_agent_timeout(struct timer_list *t) { u8 index; struct sci_timer *tmr = from_timer(tmr, t, timer); struct sci_port_configuration_agent *port_agent; struct isci_host *ihost; unsigned long flags; u16 configure_phy_mask; port_agent = container_of(tmr, typeof(*port_agent), timer); ihost = container_of(port_agent, typeof(*ihost), port_agent); spin_lock_irqsave(&ihost->scic_lock, flags); if (tmr->cancel) goto done; port_agent->timer_pending = false; /* Find the mask of phys that are reported read but as yet unconfigured into a port */ configure_phy_mask = ~port_agent->phy_configured_mask & port_agent->phy_ready_mask; for (index = 0; index < SCI_MAX_PHYS; index++) { struct isci_phy *iphy = &ihost->phys[index]; if (configure_phy_mask & (1 << index)) { port_agent->link_up_handler(ihost, port_agent, phy_get_non_dummy_port(iphy), iphy); } } done: spin_unlock_irqrestore(&ihost->scic_lock, flags); }
/** * lbs_cmd_timeout_handler - handles the timeout of command sending. * It will re-send the same command again. * * @data: &struct lbs_private pointer */ static void lbs_cmd_timeout_handler(struct timer_list *t) { struct lbs_private *priv = from_timer(priv, t, command_timer); unsigned long flags; spin_lock_irqsave(&priv->driver_lock, flags); if (!priv->cur_cmd) goto out; netdev_info(priv->dev, "command 0x%04x timed out\n", le16_to_cpu(priv->cur_cmd->cmdbuf->command)); priv->cmd_timed_out = 1; /* * If the device didn't even acknowledge the command, reset the state * so that we don't block all future commands due to this one timeout. */ if (priv->dnld_sent == DNLD_CMD_SENT) priv->dnld_sent = DNLD_RES_RECEIVED; wake_up(&priv->waitq); out: spin_unlock_irqrestore(&priv->driver_lock, flags); }
/***************** * timer expires * *****************/ void dsp_tone_timeout(struct timer_list *t) { struct dsp *dsp = from_timer(dsp, t, tone.tl); struct dsp_tone *tone = &dsp->tone; struct pattern *pat = (struct pattern *)tone->pattern; int index = tone->index; if (!tone->tone) return; index++; if (!pat->seq[index]) index = 0; tone->index = index; /* set next tone */ if (pat->data[index] == DATA_S) dsp_tone_hw_message(dsp, NULL, 0); else dsp_tone_hw_message(dsp, pat->data[index], *(pat->siz[index])); /* set timer */ tone->tl.expires = jiffies + (pat->seq[index] * HZ) / 8000; add_timer(&tone->tl); }
/* poll the device fifo status register. not to be confused with * the poll syscall. */ static void cm4040_do_poll(struct timer_list *t) { struct reader_dev *dev = from_timer(dev, t, poll_timer); unsigned int obs = xinb(dev->p_dev->resource[0]->start + REG_OFFSET_BUFFER_STATUS); if ((obs & BSR_BULK_IN_FULL)) { set_bit(BS_READABLE, &dev->buffer_status); DEBUGP(4, dev, "waking up read_wait\n"); wake_up_interruptible(&dev->read_wait); } else clear_bit(BS_READABLE, &dev->buffer_status); if (!(obs & BSR_BULK_OUT_FULL)) { set_bit(BS_WRITABLE, &dev->buffer_status); DEBUGP(4, dev, "waking up write_wait\n"); wake_up_interruptible(&dev->write_wait); } else clear_bit(BS_WRITABLE, &dev->buffer_status); if (dev->buffer_status) wake_up_interruptible(&dev->poll_wait); mod_timer(&dev->poll_timer, jiffies + POLL_PERIOD); }
/******************************************************************************************************************** *function: I still not understand this function, so wait for further implementation * input: unsigned long data //acturally we send struct tx_ts_record or struct rx_ts_record to these timer * return: NULL * notice: ********************************************************************************************************************/ static void RxPktPendingTimeout(struct timer_list *t) { struct rx_ts_record *pRxTs = from_timer(pRxTs, t, rx_pkt_pending_timer); struct ieee80211_device *ieee = container_of(pRxTs, struct ieee80211_device, RxTsRecord[pRxTs->num]); PRX_REORDER_ENTRY pReorderEntry = NULL; //u32 flags = 0; unsigned long flags = 0; u8 index = 0; bool bPktInBuf = false; spin_lock_irqsave(&(ieee->reorder_spinlock), flags); IEEE80211_DEBUG(IEEE80211_DL_REORDER, "==================>%s()\n", __func__); if(pRxTs->rx_timeout_indicate_seq != 0xffff) { // Indicate the pending packets sequentially according to SeqNum until meet the gap. while(!list_empty(&pRxTs->rx_pending_pkt_list)) { pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pRxTs->rx_pending_pkt_list.prev, RX_REORDER_ENTRY, List); if(index == 0) pRxTs->rx_indicate_seq = pReorderEntry->SeqNum; if( SN_LESS(pReorderEntry->SeqNum, pRxTs->rx_indicate_seq) || SN_EQUAL(pReorderEntry->SeqNum, pRxTs->rx_indicate_seq) ) { list_del_init(&pReorderEntry->List); if(SN_EQUAL(pReorderEntry->SeqNum, pRxTs->rx_indicate_seq)) pRxTs->rx_indicate_seq = (pRxTs->rx_indicate_seq + 1) % 4096; IEEE80211_DEBUG(IEEE80211_DL_REORDER, "RxPktPendingTimeout(): IndicateSeq: %d\n", pReorderEntry->SeqNum); ieee->stats_IndicateArray[index] = pReorderEntry->prxb; index++; list_add_tail(&pReorderEntry->List, &ieee->RxReorder_Unused_List); } else { bPktInBuf = true; break; } } } if(index>0) { // Set rx_timeout_indicate_seq to 0xffff to indicate no pending packets in buffer now. pRxTs->rx_timeout_indicate_seq = 0xffff; // Indicate packets if(index > REORDER_WIN_SIZE) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Rx Reorder buffer full!! \n"); spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); return; } ieee80211_indicate_packets(ieee, ieee->stats_IndicateArray, index); } if(bPktInBuf && (pRxTs->rx_timeout_indicate_seq == 0xffff)) { pRxTs->rx_timeout_indicate_seq = pRxTs->rx_indicate_seq; mod_timer(&pRxTs->rx_pkt_pending_timer, jiffies + msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime)); } spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); }
void rnr_nak_timer(struct timer_list *t) { struct rxe_qp *qp = from_timer(qp, t, rnr_nak_timer); pr_debug("qp#%d rnr nak timer fired\n", qp_num(qp)); rxe_run_task(&qp->req.task, 1); }
static void poll_catas(struct timer_list *t) { struct mlx4_priv *priv = from_timer(priv, t, catas_err.timer); struct mlx4_dev *dev = &priv->dev; u32 slave_read; if (mlx4_is_slave(dev)) { slave_read = swab32(readl(&priv->mfunc.comm->slave_read)); if (mlx4_comm_internal_err(slave_read)) { mlx4_warn(dev, "Internal error detected on the communication channel\n"); goto internal_err; } } else if (readl(priv->catas_err.map)) { dump_err_buf(dev); goto internal_err; } if (dev->persist->state & MLX4_DEVICE_STATE_INTERNAL_ERROR) { mlx4_warn(dev, "Internal error mark was detected on device\n"); goto internal_err; } mod_timer(&priv->catas_err.timer, round_jiffies(jiffies + MLX4_CATAS_POLL_INTERVAL)); return; internal_err: if (mlx4_internal_err_reset) queue_work(dev->persist->catas_wq, &dev->persist->catas_work); }
static void fnic_notify_timer(struct timer_list *t) { struct fnic *fnic = from_timer(fnic, t, notify_timer); fnic_handle_link_event(fnic); mod_timer(&fnic->notify_timer, round_jiffies(jiffies + FNIC_NOTIFY_TIMER_PERIOD)); }
/** * link_stat_timer_handler - schedule work obtaining mac address and link status * @data: pointer to USB device instance * * The handler runs in interrupt context. That's why we need to defer the * tasks to a work queue. */ static void link_stat_timer_handler(struct timer_list *t) { struct most_dev *mdev = from_timer(mdev, t, link_stat_timer); schedule_work(&mdev->poll_work_obj); mdev->link_stat_timer.expires = jiffies + (2 * HZ); add_timer(&mdev->link_stat_timer); }
static void pwr_state_check_handler(struct timer_list *t) { struct pwrctrl_priv *pwrctrlpriv = from_timer(pwrctrlpriv, t, pwr_state_check_timer); struct adapter *padapter = pwrctrlpriv->adapter; rtw_ps_cmd(padapter); }
void wil_p2p_discovery_timer_fn(struct timer_list *t) { struct wil6210_priv *wil = from_timer(wil, t, p2p.discovery_timer); wil_dbg_misc(wil, "p2p_discovery_timer_fn\n"); schedule_work(&wil->p2p.discovery_expired_work); }
/******************************************************************************************************************** *function: Add BA timer function * input: unsigned long data //acturally we send struct tx_ts_record or struct rx_ts_record to these timer * return: NULL * notice: ********************************************************************************************************************/ static void TsAddBaProcess(struct timer_list *t) { struct tx_ts_record *pTxTs = from_timer(pTxTs, t, ts_add_ba_timer); u8 num = pTxTs->num; struct ieee80211_device *ieee = container_of(pTxTs, struct ieee80211_device, TxTsRecord[num]); TsInitAddBA(ieee, pTxTs, BA_POLICY_IMMEDIATE, false); IEEE80211_DEBUG(IEEE80211_DL_BA, "TsAddBaProcess(): ADDBA Req is started!! \n"); }
static void tsc200x_penup_timer(struct timer_list *t) { struct tsc200x *ts = from_timer(ts, t, penup_timer); unsigned long flags; spin_lock_irqsave(&ts->lock, flags); tsc200x_update_pen_state(ts, 0, 0, 0); spin_unlock_irqrestore(&ts->lock, flags); }
static void user_reader_timeout(struct timer_list *t) { struct file_priv *priv = from_timer(priv, t, user_read_timer); pr_warn("TPM user space timeout is deprecated (pid=%d)\n", task_tgid_nr(current)); schedule_work(&priv->timeout_work); }
static void led_timer_function(struct timer_list *t) { struct led_classdev *led_cdev = from_timer(led_cdev, t, blink_timer); unsigned long brightness; unsigned long delay; if (!led_cdev->blink_delay_on || !led_cdev->blink_delay_off) { led_set_brightness_nosleep(led_cdev, LED_OFF); clear_bit(LED_BLINK_SW, &led_cdev->work_flags); return; } if (test_and_clear_bit(LED_BLINK_ONESHOT_STOP, &led_cdev->work_flags)) { clear_bit(LED_BLINK_SW, &led_cdev->work_flags); return; } brightness = led_get_brightness(led_cdev); if (!brightness) { /* Time to switch the LED on. */ if (test_and_clear_bit(LED_BLINK_BRIGHTNESS_CHANGE, &led_cdev->work_flags)) brightness = led_cdev->new_blink_brightness; else brightness = led_cdev->blink_brightness; delay = led_cdev->blink_delay_on; } else { /* Store the current brightness value to be able * to restore it when the delay_off period is over. */ led_cdev->blink_brightness = brightness; brightness = LED_OFF; delay = led_cdev->blink_delay_off; } led_set_brightness_nosleep(led_cdev, brightness); /* Return in next iteration if led is in one-shot mode and we are in * the final blink state so that the led is toggled each delay_on + * delay_off milliseconds in worst case. */ if (test_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags)) { if (test_bit(LED_BLINK_INVERT, &led_cdev->work_flags)) { if (brightness) set_bit(LED_BLINK_ONESHOT_STOP, &led_cdev->work_flags); } else { if (!brightness) set_bit(LED_BLINK_ONESHOT_STOP, &led_cdev->work_flags); } } mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay)); }