这篇教程C++ time_is_before_jiffies函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中time_is_before_jiffies函数的典型用法代码示例。如果您正苦于以下问题:C++ time_is_before_jiffies函数的具体用法?C++ time_is_before_jiffies怎么用?C++ time_is_before_jiffies使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了time_is_before_jiffies函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mmc_spi_skipstatic int mmc_spi_skip(struct mmc_spi_host *host, unsigned long timeout, unsigned n, u8 byte){ u8 *cp = host->data->status; unsigned long start = jiffies; while (1) { int status; unsigned i; status = mmc_spi_readbytes(host, n); if (status < 0) return status; for (i = 0; i < n; i++) { if (cp[i] != byte) return cp[i]; } if (time_is_before_jiffies(start + timeout)) break; /* If we need long timeouts, we may release the CPU. * We use jiffies here because we want to have a relation * between elapsed time and the blocking of the scheduler. */ if (time_is_before_jiffies(start+1)) schedule(); } return -ETIMEDOUT;}
开发者ID:1N4148,项目名称:android_kernel_samsung_golden,代码行数:31,
示例2: gpu_i2c_check_statusstatic int gpu_i2c_check_status(struct gpu_i2c_dev *i2cd){ unsigned long target = jiffies + msecs_to_jiffies(1000); u32 val; do { val = readl(i2cd->regs + I2C_MST_CNTL); if (!(val & I2C_MST_CNTL_CYCLE_TRIGGER)) break; if ((val & I2C_MST_CNTL_STATUS) != I2C_MST_CNTL_STATUS_BUS_BUSY) break; usleep_range(500, 600); } while (time_is_after_jiffies(target)); if (time_is_before_jiffies(target)) { dev_err(i2cd->dev, "i2c timeout error %x/n", val); return -ETIMEDOUT; } val = readl(i2cd->regs + I2C_MST_CNTL); switch (val & I2C_MST_CNTL_STATUS) { case I2C_MST_CNTL_STATUS_OKAY: return 0; case I2C_MST_CNTL_STATUS_NO_ACK: return -ENXIO; case I2C_MST_CNTL_STATUS_TIMEOUT: return -ETIMEDOUT; default: return 0; }}
开发者ID:avagin,项目名称:linux,代码行数:32,
示例3: igb_ptp_tx_work/** * igb_ptp_tx_work * @work: pointer to work struct * * This work function polls the TSYNCTXCTL valid bit to determine when a * timestamp has been taken for the current stored skb. **/void igb_ptp_tx_work(struct work_struct *work){ struct igb_adapter *adapter = container_of(work, struct igb_adapter, ptp_tx_work); struct e1000_hw *hw = &adapter->hw; u32 tsynctxctl; if (!adapter->ptp_tx_skb) return; if (time_is_before_jiffies(adapter->ptp_tx_start + IGB_PTP_TX_TIMEOUT)) { dev_kfree_skb_any(adapter->ptp_tx_skb); adapter->ptp_tx_skb = NULL; adapter->tx_hwtstamp_timeouts++; dev_warn(&adapter->pdev->dev, "clearing Tx timestamp hang"); return; } tsynctxctl = rd32(E1000_TSYNCTXCTL); if (tsynctxctl & E1000_TSYNCTXCTL_VALID) igb_ptp_tx_hwtstamp(adapter); else /* reschedule to check later */ schedule_work(&adapter->ptp_tx_work);}
开发者ID:JS-Wang,项目名称:linux-testing,代码行数:33,
示例4: __ratelimit/* * __ratelimit - rate limiting * @rs: ratelimit_state data * * This enforces a rate limit: not more than @rs->ratelimit_burst callbacks * in every @rs->ratelimit_jiffies */int __ratelimit(struct ratelimit_state *rs){ unsigned long flags; if (!rs->interval) return 1; spin_lock_irqsave(&ratelimit_lock, flags); if (!rs->begin) rs->begin = jiffies; if (time_is_before_jiffies(rs->begin + rs->interval)) { if (rs->missed) printk(KERN_WARNING "%s: %d callbacks suppressed/n", __func__, rs->missed); rs->begin = 0; rs->printed = 0; rs->missed = 0; } if (rs->burst && rs->burst > rs->printed) goto print; rs->missed++; spin_unlock_irqrestore(&ratelimit_lock, flags); return 0;print: rs->printed++; spin_unlock_irqrestore(&ratelimit_lock, flags); return 1;}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:38,
示例5: igb_ptp_rx_hang/** * igb_ptp_rx_hang - detect error case when Rx timestamp registers latched * @adapter: private network adapter structure * * This watchdog task is scheduled to detect error case where hardware has * dropped an Rx packet that was timestamped when the ring is full. The * particular error is rare but leaves the device in a state unable to timestamp * any future packets. **/void igb_ptp_rx_hang(struct igb_adapter *adapter){ struct e1000_hw *hw = &adapter->hw; struct igb_ring *rx_ring; u32 tsyncrxctl = rd32(E1000_TSYNCRXCTL); unsigned long rx_event; int n; if (hw->mac.type != e1000_82576) return; /* If we don't have a valid timestamp in the registers, just update the * timeout counter and exit */ if (!(tsyncrxctl & E1000_TSYNCRXCTL_VALID)) { adapter->last_rx_ptp_check = jiffies; return; } /* Determine the most recent watchdog or rx_timestamp event */ rx_event = adapter->last_rx_ptp_check; for (n = 0; n < adapter->num_rx_queues; n++) { rx_ring = adapter->rx_ring[n]; if (time_after(rx_ring->last_rx_timestamp, rx_event)) rx_event = rx_ring->last_rx_timestamp; } /* Only need to read the high RXSTMP register to clear the lock */ if (time_is_before_jiffies(rx_event + 5 * HZ)) { rd32(E1000_RXSTMPH); adapter->last_rx_ptp_check = jiffies; adapter->rx_hwtstamp_cleared++; dev_warn(&adapter->pdev->dev, "clearing Rx timestamp hang"); }}
开发者ID:JS-Wang,项目名称:linux-testing,代码行数:44,
示例6: check_free_space/* * Check the amount of free space and suspend/resume accordingly. */static int check_free_space(struct bsd_acct_struct *acct){ struct kstatfs sbuf; if (time_is_before_jiffies(acct->needcheck)) goto out; /* May block */ if (vfs_statfs(&acct->file->f_path, &sbuf)) goto out; if (acct->active) { u64 suspend = sbuf.f_blocks * SUSPEND; do_div(suspend, 100); if (sbuf.f_bavail <= suspend) { acct->active = 0; pr_info("Process accounting paused/n"); } } else { u64 resume = sbuf.f_blocks * RESUME; do_div(resume, 100); if (sbuf.f_bavail >= resume) { acct->active = 1; pr_info("Process accounting resumed/n"); } } acct->needcheck = jiffies + ACCT_TIMEOUT*HZ;out: return acct->active;}
开发者ID:oscardagrach,项目名称:linux,代码行数:34,
示例7: at86rf230_xmitstatic intat86rf230_xmit(struct ieee802154_hw *hw, struct sk_buff *skb){ struct at86rf230_local *lp = hw->priv; struct at86rf230_state_change *ctx = &lp->tx; lp->tx_skb = skb; lp->tx_retry = 0; /* After 5 minutes in PLL and the same frequency we run again the * calibration loops which is recommended by at86rf2xx datasheets. * * The calibration is initiate by a state change from TRX_OFF * to TX_ON, the lp->cal_timeout should be reinit by state_delay * function then to start in the next 5 minutes. */ if (time_is_before_jiffies(lp->cal_timeout)) { lp->is_tx_from_off = true; at86rf230_async_state_change(lp, ctx, STATE_TRX_OFF, at86rf230_xmit_start, false); } else { at86rf230_xmit_start(ctx); } return 0;}
开发者ID:EvolutionMod,项目名称:ath10-lenovo,代码行数:26,
示例8: ixgbe_ptp_tx_hwtstamp_work/** * ixgbe_ptp_tx_hwtstamp_work * @work: pointer to the work struct * * This work item polls TSYNCTXCTL valid bit to determine when a Tx hardware * timestamp has been taken for the current skb. It is necesary, because the * descriptor's "done" bit does not correlate with the timestamp event. */static void ixgbe_ptp_tx_hwtstamp_work(struct work_struct *work){ struct ixgbe_adapter *adapter = container_of(work, struct ixgbe_adapter, ptp_tx_work); struct ixgbe_hw *hw = &adapter->hw; bool timeout = time_is_before_jiffies(adapter->ptp_tx_start + IXGBE_PTP_TX_TIMEOUT); u32 tsynctxctl; /* we have to have a valid skb */ if (!adapter->ptp_tx_skb) return; if (timeout) { dev_kfree_skb_any(adapter->ptp_tx_skb); adapter->ptp_tx_skb = NULL; adapter->tx_hwtstamp_timeouts++; e_warn(drv, "clearing Tx Timestamp hang"); return; } tsynctxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCTXCTL); if (tsynctxctl & IXGBE_TSYNCTXCTL_VALID) ixgbe_ptp_tx_hwtstamp(adapter); else /* reschedule to keep checking if it's not available yet */ schedule_work(&adapter->ptp_tx_work);}
开发者ID:AlexeyManikin,项目名称:ixgbe-linux-netmap-single-queue,代码行数:36,
示例9: ixgbe_ptp_rx_hang/** * ixgbe_ptp_rx_hang - detect error case when Rx timestamp registers latched * @adapter: private network adapter structure * * this watchdog task is scheduled to detect error case where hardware has * dropped an Rx packet that was timestamped when the ring is full. The * particular error is rare but leaves the device in a state unable to timestamp * any future packets. */void ixgbe_ptp_rx_hang(struct ixgbe_adapter *adapter){ struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_ring *rx_ring; u32 tsyncrxctl = IXGBE_READ_REG(hw, IXGBE_TSYNCRXCTL); unsigned long rx_event; int n; /* if we don't have a valid timestamp in the registers, just update the * timeout counter and exit */ if (!(tsyncrxctl & IXGBE_TSYNCRXCTL_VALID)) { adapter->last_rx_ptp_check = jiffies; return; } /* determine the most recent watchdog or rx_timestamp event */ rx_event = adapter->last_rx_ptp_check; for (n = 0; n < adapter->num_rx_queues; n++) { rx_ring = adapter->rx_ring[n]; if (time_after(rx_ring->last_rx_timestamp, rx_event)) rx_event = rx_ring->last_rx_timestamp; } /* only need to read the high RXSTMP register to clear the lock */ if (time_is_before_jiffies(rx_event + 5*HZ)) { IXGBE_READ_REG(hw, IXGBE_RXSTMPH); adapter->last_rx_ptp_check = jiffies; adapter->rx_hwtstamp_cleared++; e_warn(drv, "clearing RX Timestamp hang"); }}
开发者ID:AlexeyManikin,项目名称:ixgbe-linux-netmap-single-queue,代码行数:42,
示例10: ctrl_write_callbackstatic void ctrl_write_callback(struct urb *urb){#ifdef HTC_DEBUG_QMI_STUCK struct ctrl_write_context *context = urb->context; struct rmnet_ctrl_dev *dev = context->dev;#else struct rmnet_ctrl_dev *dev = urb->context;#endif #ifdef HTC_DEBUG_QMI_STUCK del_timer(&context->timer); if (unlikely(time_is_before_jiffies(context->start_jiffies + HZ))) pr_err("[%s] urb %p takes %d msec to complete./n", __func__, urb, jiffies_to_msecs(jiffies - context->start_jiffies));#endif if (urb->status) { dev->tx_ctrl_err_cnt++; pr_debug_ratelimited("Write status/size %d/%d/n", urb->status, urb->actual_length); }#ifdef HTC_LOG_RMNET_USB_CTRL log_rmnet_usb_ctrl_event(dev->intf, "Tx cb", urb->actual_length);#endif kfree(urb->setup_packet); kfree(urb->transfer_buffer); usb_free_urb(urb); usb_autopm_put_interface_async(dev->intf);#ifdef HTC_DEBUG_QMI_STUCK kfree(context);#endif }
开发者ID:JonnyXDA,项目名称:Sense_4.3,代码行数:34,
示例11: i40e_ptp_tx_hang/** * i40e_ptp_tx_hang - Detect error case when Tx timestamp register is hung * @pf: The PF private data structure * * This watchdog task is run periodically to make sure that we clear the Tx * timestamp logic if we don't obtain a timestamp in a reasonable amount of * time. It is unexpected in the normal case but if it occurs it results in * permanently preventing timestamps of future packets. **/void i40e_ptp_tx_hang(struct i40e_pf *pf){ struct sk_buff *skb; if (!(pf->flags & I40E_FLAG_PTP) || !pf->ptp_tx) return; /* Nothing to do if we're not already waiting for a timestamp */ if (!test_bit(__I40E_PTP_TX_IN_PROGRESS, pf->state)) return; /* We already have a handler routine which is run when we are notified * of a Tx timestamp in the hardware. If we don't get an interrupt * within a second it is reasonable to assume that we never will. */ if (time_is_before_jiffies(pf->ptp_tx_start + HZ)) { skb = pf->ptp_tx_skb; pf->ptp_tx_skb = NULL; clear_bit_unlock(__I40E_PTP_TX_IN_PROGRESS, pf->state); /* Free the skb after we clear the bitlock */ dev_kfree_skb_any(skb); pf->tx_hwtstamp_timeouts++; }}
开发者ID:Lyude,项目名称:linux,代码行数:34,
示例12: mxcmci_pio_data_transferstatic int mxcmci_pio_data_transfer(struct mxcmci_priv *priv){ struct mmc_data *data = priv->data; unsigned long *buf; u8 *buf8; int no_of_bytes; int no_of_words; unsigned long timeout_jiffies; int i; u32 temp_data; long timeout; buf = (unsigned long *)(sg_virt(data->sg)); buf8 = (u8 *)buf; /* calculate the number of bytes and words requested for transfer */ no_of_bytes = data->blocks * data->blksz; no_of_words = (no_of_bytes + 3) / 4; dev_dbg(priv->host->parent, "no_of_words = %d/n", no_of_words); if (data->flags & MMC_DATA_READ) { timeout_jiffies = jiffies + msecs_to_jiffies(1000); for (i = 0; i < no_of_words; i++) { while (1) { if (__raw_readl(priv->base + MMC_STATUS) & (STATUS_BUF_READ_RDY | STATUS_READ_OP_DONE)) break; if (time_is_before_jiffies(timeout_jiffies)) { dev_err(priv->host->parent, "wait read ready timeout/n"); data->error = -ETIMEDOUT; break; } } temp_data = __raw_readl(priv->base + MMC_BUFFER_ACCESS); if (no_of_bytes >= 4) { *buf++ = temp_data; no_of_bytes -= 4; } else { do { *buf8++ = temp_data; temp_data = temp_data >> 8; } while (--no_of_bytes); } } if (!data->error) { mxcmci_interrupt_enable(priv, INT_CNTR_READ_OP_DONE); timeout = wait_for_completion_timeout(&priv->comp_read_op_done, msecs_to_jiffies(1000)); if (timeout == 0) { dev_err(priv->host->parent, "wait read_op_done timeout/n"); data->error = -ETIMEDOUT; } } } else {
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:60,
示例13: sun4i_mdio_writestatic int sun4i_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value){ struct sun4i_mdio_data *data = bus->priv; unsigned long timeout_jiffies; /* issue the phy address and reg */ writel((mii_id << 8) | regnum, data->membase + EMAC_MAC_MADR_REG); /* pull up the phy io line */ writel(0x1, data->membase + EMAC_MAC_MCMD_REG); /* Wait read complete */ timeout_jiffies = jiffies + MDIO_TIMEOUT; while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) { if (time_is_before_jiffies(timeout_jiffies)) return -ETIMEDOUT; msleep(1); } /* push down the phy io line */ writel(0x0, data->membase + EMAC_MAC_MCMD_REG); /* and write data */ writel(value, data->membase + EMAC_MAC_MWTD_REG); return 0;}
开发者ID:19Dan01,项目名称:linux,代码行数:26,
示例14: check_free_space/* * Check the amount of free space and suspend/resume accordingly. */static int check_free_space(struct bsd_acct_struct *acct, struct file *file){ struct kstatfs sbuf; int res; int act; u64 resume; u64 suspend; spin_lock(&acct_lock); res = acct->active; if (!file || time_is_before_jiffies(acct->needcheck)) goto out; spin_unlock(&acct_lock); /* May block */ if (vfs_statfs(&file->f_path, &sbuf)) return res; suspend = sbuf.f_blocks * SUSPEND; resume = sbuf.f_blocks * RESUME; do_div(suspend, 100); do_div(resume, 100); if (sbuf.f_bavail <= suspend) act = -1; else if (sbuf.f_bavail >= resume) act = 1; else act = 0; /* * If some joker switched acct->file under us we'ld better be * silent and _not_ touch anything. */ spin_lock(&acct_lock); if (file != acct->file) { if (act) res = act > 0; goto out; } if (acct->active) { if (act < 0) { acct->active = 0; pr_info("Process accounting paused/n"); } } else { if (act > 0) { acct->active = 1; pr_info("Process accounting resumed/n"); } } acct->needcheck = jiffies + ACCT_TIMEOUT*HZ; res = acct->active;out: spin_unlock(&acct_lock); return res;}
开发者ID:andyqee,项目名称:linux,代码行数:62,
|