当前位置: 首页>>代码示例>>C++>>正文


C++ round_jiffies函数代码示例

本文整理汇总了C++中round_jiffies函数的典型用法代码示例。如果您正苦于以下问题:C++ round_jiffies函数的具体用法?C++ round_jiffies怎么用?C++ round_jiffies使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了round_jiffies函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mlx4_start_catas_poll

void mlx4_start_catas_poll(struct mlx4_dev *dev)
{
	struct mlx4_priv *priv = mlx4_priv(dev);
	phys_addr_t addr;

	INIT_LIST_HEAD(&priv->catas_err.list);
	timer_setup(&priv->catas_err.timer, poll_catas, 0);
	priv->catas_err.map = NULL;

	if (!mlx4_is_slave(dev)) {
		addr = pci_resource_start(dev->persist->pdev,
					  priv->fw.catas_bar) +
					  priv->fw.catas_offset;

		priv->catas_err.map = ioremap(addr, priv->fw.catas_size * 4);
		if (!priv->catas_err.map) {
			mlx4_warn(dev, "Failed to map internal error buffer at 0x%llx\n",
				  (unsigned long long)addr);
			return;
		}
	}

	priv->catas_err.timer.expires  =
		round_jiffies(jiffies + MLX4_CATAS_POLL_INTERVAL);
	add_timer(&priv->catas_err.timer);
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:26,代码来源:catas.c

示例2: check_exit_ctkill

static void check_exit_ctkill(struct work_struct *work)
{
	struct iwl_mvm_tt_mgmt *tt;
	struct iwl_mvm *mvm;
	u32 duration;
	s32 temp;

	tt = container_of(work, struct iwl_mvm_tt_mgmt, ct_kill_exit.work);
	mvm = container_of(tt, struct iwl_mvm, thermal_throttle);

	duration = tt->params->ct_kill_duration;

	iwl_trans_start_hw(mvm->trans);
	temp = check_nic_temperature(mvm);
	iwl_trans_stop_device(mvm->trans);

	if (temp < MIN_TEMPERATURE || temp > MAX_TEMPERATURE) {
		IWL_DEBUG_TEMP(mvm, "Failed to measure NIC temperature\n");
		goto reschedule;
	}
	IWL_DEBUG_TEMP(mvm, "NIC temperature: %d\n", temp);

	if (temp <= tt->params->ct_kill_exit) {
		iwl_mvm_exit_ctkill(mvm);
		return;
	}

reschedule:
	schedule_delayed_work(&mvm->thermal_throttle.ct_kill_exit,
			      round_jiffies(duration * HZ));
}
开发者ID:Kanel,项目名称:CloudMAC-VAP-Driver,代码行数:31,代码来源:tt.c

示例3: pm_runtime_autosuspend_expiration

/*
 * pm_runtime_autosuspend_expiration - Get a device's autosuspend-delay expiration time.
 * @dev: Device to handle.
 *
 * Compute the autosuspend-delay expiration time based on the device's
 * power.last_busy time.  If the delay has already expired or is disabled
 * (negative) or the power.use_autosuspend flag isn't set, return 0.
 * Otherwise return the expiration time in jiffies (adjusted to be nonzero).
 *
 * This function may be called either with or without dev->power.lock held.
 * Either way it can be racy, since power.last_busy may be updated at any time.
 */
unsigned long pm_runtime_autosuspend_expiration(struct device *dev)
{
	int autosuspend_delay;
	long elapsed;
	unsigned long last_busy;
	unsigned long expires = 0;

	if (!dev->power.use_autosuspend)
		goto out;

	autosuspend_delay = ACCESS_ONCE(dev->power.autosuspend_delay);
	if (autosuspend_delay < 0)
		goto out;

	last_busy = ACCESS_ONCE(dev->power.last_busy);
	elapsed = jiffies - last_busy;
	if (elapsed < 0)
		goto out;	/* jiffies has wrapped around. */

	/*
	 * If the autosuspend_delay is >= 1 second, align the timer by rounding
	 * up to the nearest second.
	 */
	expires = last_busy + msecs_to_jiffies(autosuspend_delay);
	if (autosuspend_delay >= 1000)
		expires = round_jiffies(expires);
	expires += !expires;
	if (elapsed >= expires - last_busy)
		expires = 0;	/* Already expired. */

 out:
	return expires;
}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:45,代码来源:runtime.c

示例4: dev_watchdog

static void dev_watchdog(unsigned long arg)
{
	struct net_device *dev = (struct net_device *)arg;

	netif_tx_lock(dev);
	if (dev->qdisc != &noop_qdisc) {
		if (netif_device_present(dev) &&
		    netif_running(dev) &&
		    netif_carrier_ok(dev)) {
			if (netif_queue_stopped(dev) &&
			    time_after(jiffies, dev->trans_start + dev->watchdog_timeo)) {
#if 0 // Fix QA-Bug #8011 on Agile.
				printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n",
				       dev->name);
#endif
				dev->tx_timeout(dev);
			}
			if (!mod_timer(&dev->watchdog_timer, round_jiffies(jiffies + dev->watchdog_timeo)))
				dev_hold(dev);
		}
	}
	netif_tx_unlock(dev);

	dev_put(dev);
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-i_fw-50-0-16-6-2,代码行数:25,代码来源:sch_generic.c

示例5: setup_hres_sched_clock

static inline void setup_hres_sched_clock(unsigned long clock)
{
#ifdef CONFIG_CPU_SUPPORTS_HR_SCHED_CLOCK
	unsigned long data;

#ifdef CONFIG_32BIT
	unsigned long long v;

	v = NSEC_PER_SEC;
	v <<= CYC2NS_SHIFT;
	v += clock/2;
	do_div(v, clock);
	mult = v;
	shift = CYC2NS_SHIFT;
	/*
	 * We want an even value to automatically clear the top bit
	 * returned by cnt32_to_63() without an additional run time
	 * instruction. So if the LSB is 1 then round it up.
	 */
	if (mult & 1)
		mult++;
#else
	mult = clocksource_mips.mult;
	shift = clocksource_mips.shift;
#endif

	data = 0x80000000UL / clock * HZ;
	setup_timer(&cnt32_to_63_keepwarm_timer, cnt32_to_63_keepwarm, data);
	mod_timer(&cnt32_to_63_keepwarm_timer, round_jiffies(jiffies + data));
#endif
}
开发者ID:Sense1988,项目名称:20160311_EA1301,代码行数:31,代码来源:csrc-r4k.c

示例6: vio_port_up

void vio_port_up(struct vio_driver_state *vio)
{
	unsigned long flags;
	int err, state;

	spin_lock_irqsave(&vio->lock, flags);

	state = ldc_state(vio->lp);

	err = 0;
	if (state == LDC_STATE_INIT) {
		err = ldc_bind(vio->lp);
		if (err)
			printk(KERN_WARNING "%s: Port %lu bind failed, "
			       "err=%d\n",
			       vio->name, vio->vdev->channel_id, err);
	}

	if (!err) {
		err = ldc_connect(vio->lp);
		if (err)
			printk(KERN_WARNING "%s: Port %lu connect failed, "
			       "err=%d\n",
			       vio->name, vio->vdev->channel_id, err);
	}
	if (err) {
		unsigned long expires = jiffies + HZ;

		expires = round_jiffies(expires);
		mod_timer(&vio->timer, expires);
	}

	spin_unlock_irqrestore(&vio->lock, flags);
}
开发者ID:AdaLovelance,项目名称:lxcGrsecKernels,代码行数:34,代码来源:viohs.c

示例7: boot_moniter_work

static void boot_moniter_work(struct work_struct *work)
{
    struct aml_wdt_dev *wdev=container_of(work,struct aml_wdt_dev,boot_queue.work);
    reset_watchdog();
    mod_delayed_work(system_freezable_wq, &wdev->boot_queue,
                     round_jiffies(msecs_to_jiffies(wdev->reset_watchdog_time*1000)));
}
开发者ID:adbensi,项目名称:kernel-odroidc-3.10.80-rt102,代码行数:7,代码来源:aml_wdt.c

示例8: poll_catas

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);
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:30,代码来源:catas.c

示例9: fnic_notify_timer

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));
}
开发者ID:Anjali05,项目名称:linux,代码行数:8,代码来源:fnic_main.c

示例10: fnic_notify_timer

static void fnic_notify_timer(unsigned long data)
{
	struct fnic *fnic = (struct fnic *)data;

	fnic_handle_link_event(fnic);
	mod_timer(&fnic->notify_timer,
		  round_jiffies(jiffies + FNIC_NOTIFY_TIMER_PERIOD));
}
开发者ID:7799,项目名称:linux,代码行数:8,代码来源:fnic_main.c

示例11: cec_mod_timer

/*
 * @interval in seconds
 */
static void cec_mod_timer(struct timer_list *t, unsigned long interval)
{
	unsigned long iv;

	iv = interval * HZ + jiffies;

	mod_timer(t, round_jiffies(iv));
}
开发者ID:avagin,项目名称:linux,代码行数:11,代码来源:cec.c

示例12: round_jiffies_init

int __init round_jiffies_init(void) 
{
	printk("the round_jiffies test begin\n");
	unsigned long j=jiffies; //记录当前节拍 	
	unsigned long __result1=__round_jiffies(j,0); //参数j当前节拍,0是cpu编号
	unsigned long __result2=__round_jiffies(j,1);//参数j当前节拍,1是cpu编号
	unsigned long result1=round_jiffies(j);//参数j当前节拍
	unsigned long result2=round_jiffies(j);//参数j当前节拍
	printk("the jiffies is :%ld\n",j);//显示当前节拍
    	//显示函数调用结果	
	printk("the __result1 of __round_jiffies(j,0) is :%ld\n",__result1);
	printk("the __result2 of __round_jiffies(j,1) is :%ld\n",__result2);
	printk("the result1 of round_jiffies(j) is :%ld\n",result1);
	printk("the result2 of round_jiffies(j) is :%ld\n",result2); 
	printk("<0>out round_jiffies_init");
	return 0; 
} 
开发者ID:fjrti,项目名称:snippets,代码行数:17,代码来源:round_jiffies.c

示例13: protection_work

/*
 * protection_work
 *
 *  Sleep on waitqueue c2c_dev->waitq on event prot_event!=0
 *  If c2c->reset_flag => end work
 *  If genio[i]->poll_timeout => errhandler() and end work.
 *  If c2c->pending_armed => possible pending operations
 *     if (genio[i].pending!=0) arm wakeup timeout
 *  If c2c->pws_is_on => release pending operation timeout (wakeup timeout)
 */
static void protection_work(struct work_struct *work)
{
	struct ap9540_c2c *c2c;
	struct c2c_genio *genio;
	unsigned long exp;
	int ret, i, n;

	c2c = container_of(work, struct ap9540_c2c, protection_work);
	ret = 0;
	while (1) {
		/* sleep until some event occur */
		ret = wait_event_interruptible(c2c->waitq,
				(c2c->protection_event != 0));
		if (ret == -ERESTARTSYS) {
			dev_err(c2c->dev, "unexpected wake of 'prot_work'\n");
			break;
		}
		c2c->protection_event = 0;
		/* genio reset */
		if (c2c->reset_flag) {
			ret = 0;
			break;
		}
		/* polling timeout */
		ret = 0;
		for (i = 0, genio = c2c->genio; i < 32; i++, genio++) {
			if (genio->poll_timeout)
				protection_nfy_tout(c2c, genio);
		}
		/* pending set operation */
		for (i = 0, n = 0, genio = c2c->genio; i < 32; i++, genio++) {
			if (genio->pending)
				n++;
		}
		if (c2c->powerup_timeout)
			protection_nfy_powerup_tout(c2c, n);

		if (n) {
			if (c2c->pwr_is_on) {
				dev_err(c2c->dev, "%d pending op(s) !!!\n", n);
			} else if (c2c->powerup_timeout_armed == 0) {
				c2c->powerup_timeout_armed = 1;
				exp = round_jiffies((c2c->powerup_timeout_ms
						* HZ) / 1000);
				exp += jiffies;
				c2c->powerup_timer.expires = exp;
				add_timer(&c2c->powerup_timer);
			}
		}
		/* C2C wakeup acknowledge */
		if (c2c->pwr_is_on) {
			del_timer(&c2c->powerup_timer);
			c2c->powerup_timeout_armed = 0;
		}
	}
	if ((ret < 0) && c2c->errhandler)
		c2c->errhandler(ret);
}
开发者ID:Abhinav1997,项目名称:android_kernel_snda_u8500,代码行数:68,代码来源:ap9540_c2c.c

示例14: __netdev_watchdog_up

void __netdev_watchdog_up(struct net_device *dev)
{
	if (dev->tx_timeout) {
		if (dev->watchdog_timeo <= 0)
			dev->watchdog_timeo = 5*HZ;
		if (!mod_timer(&dev->watchdog_timer,
			       round_jiffies(jiffies + dev->watchdog_timeo)))
			dev_hold(dev);
	}
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:10,代码来源:sch_generic.c

示例15: mlx4_start_sense

void mlx4_start_sense(struct mlx4_dev *dev)
{
	struct mlx4_priv *priv = mlx4_priv(dev);
	struct mlx4_sense *sense = &priv->sense;

	if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_DPDP))
		return;

	sense->resched = 1;
	queue_delayed_work(sense->sense_wq , &sense->sense_poll,
			   round_jiffies(MLX4_SENSE_RANGE));
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:12,代码来源:sense.c


注:本文中的round_jiffies函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。