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


C++ del_timer_sync函数代码示例

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


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

示例1: mips_scroll_message

void mips_scroll_message(void)
{
	del_timer_sync(&mips_scroll_timer);
	max_display_count = strlen(display_string) + 1 - 8;
	mod_timer(&mips_scroll_timer, jiffies + 1);
}
开发者ID:JulianKemmerer,项目名称:Drexel-CS370,代码行数:6,代码来源:display.c

示例2: pvc_proc_cleanup

static void pvc_proc_cleanup(void)
{
	remove_proc_subtree(DISPLAY_DIR_NAME, NULL);
	del_timer_sync(&timer);
}
开发者ID:020gzh,项目名称:linux,代码行数:5,代码来源:picvue_proc.c

示例3: gf_timer_work

static void gf_timer_work(struct work_struct *work)
{
    unsigned char value[4] = { 0 };
    unsigned char* p_fw = GF_FW;
    struct gf_dev *gf_dev = NULL;
    int ret = 0;
    u8 mode = 0xFF;

    GF_LOG_INFO("start\n");
    if (work == NULL) {
		GF_LOG_INFO("wrong work\n");
		return;
    }
    gf_dev = container_of(work, struct gf_dev, spi_work);

    if(gf_dev->mode == GF_FF_MODE)
		goto exit;

    mutex_lock(&gf_dev->buf_lock);
    gf_dev->spi->max_speed_hz = 960000;//SPI_SPEED_MIN;
    spi_setup(gf_dev->spi);
    mutex_unlock(&gf_dev->buf_lock);

    gf_spi_read_byte(gf_dev, 0x8040, &value[0]);
    gf_spi_read_byte(gf_dev, 0x8000, &value[1]);
    gf_spi_read_byte(gf_dev, 0x8043, &value[2]);

    if (value[0] == 0xC6 && value[1] == 0x47) {
		gf_spi_write_byte(gf_dev, 0x8040, 0xAA);
		mdelay(1);
    } else {
		gf_spi_read_byte(gf_dev, 0x8040, &value[0]);
		gf_spi_read_byte(gf_dev, 0x8000, &value[1]);
		gf_spi_read_byte(gf_dev, 0x8043, &value[2]);
		if ((value[0] == 0xC6) && (value[1] == 0x47)) {
		    gf_spi_write_byte(gf_dev, 0x8040, 0xAA);
		    mdelay(1);
		} else {
		    GF_LOG_INFO("hardware works abnormal,do reset! 0x8040 = 0x%x \
				0x8000 = 0x%x 0x8046 = 0x%x\n", value[0], value[1], value[2]);
			gf_irq_disable(gf_dev);
		    gf_reset(gf_dev);

		    gf_spi_read_byte(gf_dev, 0x41e4, &value[0]);
		    gf_spi_read_byte(gf_dev, 0x8000, &value[1]);
		    GF_LOG_INFO("read 0x41e4 finish value = 0x%x, 0x8000=0x%x\n",
				value[0], value[1]);

		    if (value[0] != 0xbe) {
				gf_spi_read_byte(gf_dev, 0x41e4, &value[0]);
				if (value[0] != 0xbe) {
				    /*******************firmware update*********************/
				    GF_LOG_INFO("firmware update start\n");
				    del_timer_sync(&gf_dev->gf_timer);
				    if (gf_fw_update_init(gf_dev)) {
						gf_fw_update(gf_dev, p_fw, FW_LENGTH);
						gf_reset();
				    }
				    gf_dev->gf_timer.expires = jiffies + 2 * HZ;
				    add_timer(&gf_dev->gf_timer);
				}
		    }
		    /**********************update config*************************/
		    ret = gf_spi_write_byte(gf_dev, 0x8040, 0xAA);
		    if (!ret)
				GF_LOG_INFO("write 0x8040 fail\n");

		    if (!hw_config(gf_dev))
				GF_LOG_INFO("write config fail\n");
		    gf_irq_enable(gf_dev);
		}
    }
    /* if mode was changed by reset, we should set the mode  back to the primary mode */
    gf_spi_read_byte(gf_dev, GF_MODE_STATUS, &mode);
    if (mode != gf_dev->mode) {
		GF_LOG_INFO("set mode back\n");
		gf_spi_write_byte(gf_dev, GF_MODE_STATUS, gf_dev->mode);
		gf_spi_read_byte(gf_dev, GF_MODE_STATUS, &mode);
		GF_LOG_INFO("mode444 = %d\n", mode);
    }

exit:
    mod_timer(&gf_dev->gf_timer, jiffies + 2*HZ);
    GF_LOG_INFO("end\n");
}
开发者ID:moonlightly,项目名称:NX523J_kernel,代码行数:85,代码来源:gf-spi.c

示例4: ath9k_htc_stop

static void ath9k_htc_stop(struct ieee80211_hw *hw)
{
	struct ath9k_htc_priv *priv = hw->priv;
	struct ath_hw *ah = priv->ah;
	struct ath_common *common = ath9k_hw_common(ah);
	int ret __attribute__ ((unused));
	u8 cmd_rsp;

	mutex_lock(&priv->mutex);

	if (priv->op_flags & OP_INVALID) {
		ath_dbg(common, ATH_DBG_ANY, "Device not present\n");
		mutex_unlock(&priv->mutex);
		return;
	}

	ath9k_htc_ps_wakeup(priv);

	WMI_CMD(WMI_DISABLE_INTR_CMDID);
	WMI_CMD(WMI_DRAIN_TXQ_ALL_CMDID);
	WMI_CMD(WMI_STOP_RECV_CMDID);

	tasklet_kill(&priv->rx_tasklet);

	del_timer_sync(&priv->tx.cleanup_timer);
	ath9k_htc_tx_drain(priv);
	ath9k_wmi_event_drain(priv);

	mutex_unlock(&priv->mutex);

	/* Cancel all the running timers/work .. */
	cancel_work_sync(&priv->fatal_work);
	cancel_work_sync(&priv->ps_work);

#ifdef CONFIG_MAC80211_LEDS
	cancel_work_sync(&priv->led_work);
#endif
	ath9k_htc_stop_ani(priv);

	mutex_lock(&priv->mutex);

	if (ah->btcoex_hw.enabled) {
		ath9k_hw_btcoex_disable(ah);
		if (ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE)
			ath_htc_cancel_btcoex_work(priv);
	}

	/* Remove a monitor interface if it's present. */
	if (priv->ah->is_monitoring)
		ath9k_htc_remove_monitor_interface(priv);

	ath9k_hw_phy_disable(ah);
	ath9k_hw_disable(ah);
	ath9k_htc_ps_restore(priv);
	ath9k_htc_setpower(priv, ATH9K_PM_FULL_SLEEP);

	priv->op_flags |= OP_INVALID;

	ath_dbg(common, ATH_DBG_CONFIG, "Driver halt\n");
	mutex_unlock(&priv->mutex);
}
开发者ID:71eh,项目名称:open80211s,代码行数:61,代码来源:htc_drv_main.c

示例5: rtw_free_stainfo

/*  using pstapriv->sta_hash_lock to protect */
u32	rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
{
    int i;
    struct __queue *pfree_sta_queue;
    struct recv_reorder_ctrl *preorder_ctrl;
    struct	sta_xmit_priv	*pstaxmitpriv;
    struct	xmit_priv	*pxmitpriv = &padapter->xmitpriv;
    struct	sta_priv *pstapriv = &padapter->stapriv;


    if (psta == NULL)
        goto exit;

    pfree_sta_queue = &pstapriv->free_sta_queue;

    pstaxmitpriv = &psta->sta_xmitpriv;

    spin_lock_bh(&pxmitpriv->lock);

    rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q);
    psta->sleepq_len = 0;

    rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vo_q.sta_pending);

    list_del_init(&(pstaxmitpriv->vo_q.tx_pending));

    rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);

    list_del_init(&(pstaxmitpriv->vi_q.tx_pending));

    rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);

    list_del_init(&(pstaxmitpriv->bk_q.tx_pending));

    rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->be_q.sta_pending);

    list_del_init(&(pstaxmitpriv->be_q.tx_pending));

    spin_unlock_bh(&pxmitpriv->lock);

    list_del_init(&psta->hash_list);
    RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_err_, ("\n free number_%d stainfo  with hwaddr=0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x\n", pstapriv->asoc_sta_count , psta->hwaddr[0], psta->hwaddr[1], psta->hwaddr[2], psta->hwaddr[3], psta->hwaddr[4], psta->hwaddr[5]));
    pstapriv->asoc_sta_count--;

    /*  re-init sta_info; 20061114 */
    _rtw_init_sta_xmit_priv(&psta->sta_xmitpriv);
    _rtw_init_sta_recv_priv(&psta->sta_recvpriv);

    del_timer_sync(&psta->addba_retry_timer);

    /* for A-MPDU Rx reordering buffer control, cancel reordering_ctrl_timer */
    for (i = 0; i < 16; i++) {
        struct list_head *phead, *plist;
        struct recv_frame *prhdr;
        struct recv_frame *prframe;
        struct __queue *ppending_recvframe_queue;
        struct __queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue;

        preorder_ctrl = &psta->recvreorder_ctrl[i];

        del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);

        ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;

        spin_lock_bh(&ppending_recvframe_queue->lock);

        phead =		get_list_head(ppending_recvframe_queue);
        plist = phead->next;

        while (!list_empty(phead)) {
            prhdr = container_of(plist, struct recv_frame, list);
            prframe = (struct recv_frame *)prhdr;

            plist = plist->next;

            list_del_init(&(prframe->list));

            rtw_free_recvframe(prframe, pfree_recv_queue);
        }

        spin_unlock_bh(&ppending_recvframe_queue->lock);
    }

    if (!(psta->state & WIFI_AP_STATE))
        rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, false);

#ifdef CONFIG_88EU_AP_MODE

    spin_lock_bh(&pstapriv->auth_list_lock);
    if (!list_empty(&psta->auth_list)) {
        list_del_init(&psta->auth_list);
        pstapriv->auth_list_cnt--;
    }
    spin_unlock_bh(&pstapriv->auth_list_lock);

    psta->expire_to = 0;

    psta->sleepq_ac_len = 0;
    psta->qos_info = 0;
//.........这里部分代码省略.........
开发者ID:aejsmith,项目名称:linux,代码行数:101,代码来源:rtw_sta_mgt.c

示例6: hangcheck_exit

static void __exit hangcheck_exit(void)
{
	del_timer_sync(&hangcheck_ticktock);
        printk("Hangcheck: Stopped hangcheck timer.\n");
}
开发者ID:EMFPGA,项目名称:linux_media,代码行数:5,代码来源:hangcheck-timer.c

示例7: ___ieee80211_stop_tx_ba_session

int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
				    enum ieee80211_back_parties initiator,
				    bool tx)
{
	struct ieee80211_local *local = sta->local;
	struct tid_ampdu_tx *tid_tx;
	int ret;

	lockdep_assert_held(&sta->ampdu_mlme.mtx);

	spin_lock_bh(&sta->lock);

	tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
	if (!tid_tx) {
		spin_unlock_bh(&sta->lock);
		return -ENOENT;
	}

	/* if we're already stopping ignore any new requests to stop */
	if (test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
		spin_unlock_bh(&sta->lock);
		return -EALREADY;
	}

	if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) {
		/* not even started yet! */
		ieee80211_assign_tid_tx(sta, tid, NULL);
		spin_unlock_bh(&sta->lock);
		kfree_rcu(tid_tx, rcu_head);
		return 0;
	}

	set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state);

	spin_unlock_bh(&sta->lock);

#ifdef CONFIG_MAC80211_HT_DEBUG
	printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
	       sta->sta.addr, tid);
#endif /* CONFIG_MAC80211_HT_DEBUG */

	del_timer_sync(&tid_tx->addba_resp_timer);

	/*
	 * After this packets are no longer handed right through
	 * to the driver but are put onto tid_tx->pending instead,
	 * with locking to ensure proper access.
	 */
	clear_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state);

	/*
	 * There might be a few packets being processed right now (on
	 * another CPU) that have already gotten past the aggregation
	 * check when it was still OPERATIONAL and consequently have
	 * IEEE80211_TX_CTL_AMPDU set. In that case, this code might
	 * call into the driver at the same time or even before the
	 * TX paths calls into it, which could confuse the driver.
	 *
	 * Wait for all currently running TX paths to finish before
	 * telling the driver. New packets will not go through since
	 * the aggregation session is no longer OPERATIONAL.
	 */
	synchronize_net();

	tid_tx->stop_initiator = initiator;
	tid_tx->tx_stop = tx;

	ret = drv_ampdu_action(local, sta->sdata,
			       IEEE80211_AMPDU_TX_STOP,
			       &sta->sta, tid, NULL, 0);

	/* HW shall not deny going back to legacy */
	if (WARN_ON(ret)) {
		/*
		 * We may have pending packets get stuck in this case...
		 * Not bothering with a workaround for now.
		 */
	}

	return ret;
}
开发者ID:Lampus,项目名称:linux,代码行数:81,代码来源:agg-tx.c

示例8: ieee80211_process_addba_resp

void ieee80211_process_addba_resp(struct ieee80211_local *local,
				  struct sta_info *sta,
				  struct ieee80211_mgmt *mgmt,
				  size_t len)
{
	struct tid_ampdu_tx *tid_tx;
	u16 capab, tid;
	u8 buf_size;

	capab = le16_to_cpu(mgmt->u.action.u.addba_resp.capab);
	tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2;
	buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;

	mutex_lock(&sta->ampdu_mlme.mtx);

	tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
	if (!tid_tx)
		goto out;

	if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid);
#endif
		goto out;
	}

	del_timer_sync(&tid_tx->addba_resp_timer);

#ifdef CONFIG_MAC80211_HT_DEBUG
	printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid);
#endif

	/*
	 * addba_resp_timer may have fired before we got here, and
	 * caused WANT_STOP to be set. If the stop then was already
	 * processed further, STOPPING might be set.
	 */
	if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) ||
	    test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
#ifdef CONFIG_MAC80211_HT_DEBUG
		printk(KERN_DEBUG
		       "got addBA resp for tid %d but we already gave up\n",
		       tid);
#endif
		goto out;
	}

	/*
	 * IEEE 802.11-2007 7.3.1.14:
	 * In an ADDBA Response frame, when the Status Code field
	 * is set to 0, the Buffer Size subfield is set to a value
	 * of at least 1.
	 */
	if (le16_to_cpu(mgmt->u.action.u.addba_resp.status)
			== WLAN_STATUS_SUCCESS && buf_size) {
		if (test_and_set_bit(HT_AGG_STATE_RESPONSE_RECEIVED,
				     &tid_tx->state)) {
			/* ignore duplicate response */
			goto out;
		}

		tid_tx->buf_size = buf_size;

		if (test_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state))
			ieee80211_agg_tx_operational(local, sta, tid);

		sta->ampdu_mlme.addba_req_num[tid] = 0;
	} else {
		___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR,
						true);
	}

 out:
	mutex_unlock(&sta->ampdu_mlme.mtx);
}
开发者ID:Lampus,项目名称:linux,代码行数:75,代码来源:agg-tx.c

示例9: bnad_set_coalesce

static int
bnad_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *coalesce)
{
	struct bnad *bnad = netdev_priv(netdev);
	unsigned long flags;
	int to_del = 0;

	if (coalesce->rx_coalesce_usecs == 0 ||
	    coalesce->rx_coalesce_usecs >
	    BFI_MAX_COALESCING_TIMEO * BFI_COALESCING_TIMER_UNIT)
		return -EINVAL;

	if (coalesce->tx_coalesce_usecs == 0 ||
	    coalesce->tx_coalesce_usecs >
	    BFI_MAX_COALESCING_TIMEO * BFI_COALESCING_TIMER_UNIT)
		return -EINVAL;

	mutex_lock(&bnad->conf_mutex);
	/*
	 * Do not need to store rx_coalesce_usecs here
	 * Every time DIM is disabled, we can get it from the
	 * stack.
	 */
	spin_lock_irqsave(&bnad->bna_lock, flags);
	if (coalesce->use_adaptive_rx_coalesce) {
		if (!(bnad->cfg_flags & BNAD_CF_DIM_ENABLED)) {
			bnad->cfg_flags |= BNAD_CF_DIM_ENABLED;
			bnad_dim_timer_start(bnad);
		}
	} else {
		if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED) {
			bnad->cfg_flags &= ~BNAD_CF_DIM_ENABLED;
			if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED &&
			    test_bit(BNAD_RF_DIM_TIMER_RUNNING,
			    &bnad->run_flags)) {
				clear_bit(BNAD_RF_DIM_TIMER_RUNNING,
							&bnad->run_flags);
				to_del = 1;
			}
			spin_unlock_irqrestore(&bnad->bna_lock, flags);
			if (to_del)
				del_timer_sync(&bnad->dim_timer);
			spin_lock_irqsave(&bnad->bna_lock, flags);
			bnad_rx_coalescing_timeo_set(bnad);
		}
	}
	if (bnad->tx_coalescing_timeo != coalesce->tx_coalesce_usecs /
					BFI_COALESCING_TIMER_UNIT) {
		bnad->tx_coalescing_timeo = coalesce->tx_coalesce_usecs /
						BFI_COALESCING_TIMER_UNIT;
		bnad_tx_coalescing_timeo_set(bnad);
	}

	if (bnad->rx_coalescing_timeo != coalesce->rx_coalesce_usecs /
					BFI_COALESCING_TIMER_UNIT) {
		bnad->rx_coalescing_timeo = coalesce->rx_coalesce_usecs /
						BFI_COALESCING_TIMER_UNIT;

		if (!(bnad->cfg_flags & BNAD_CF_DIM_ENABLED))
			bnad_rx_coalescing_timeo_set(bnad);

	}

	/* Add Tx Inter-pkt DMA count?  */

	spin_unlock_irqrestore(&bnad->bna_lock, flags);

	mutex_unlock(&bnad->conf_mutex);
	return 0;
}
开发者ID:acton393,项目名称:linux,代码行数:70,代码来源:bnad_ethtool.c

示例10: aml_callkey_earlysuspend

static int aml_callkey_earlysuspend(struct early_suspend *handler)
{
	del_timer_sync(&gp_call_key_workdata->timer);
	return 0;
}
开发者ID:OpenLD,项目名称:linux-wetek-3.10.y,代码行数:5,代码来源:aml_callkey.c

示例11: aml_pcm_trigger

static int aml_pcm_trigger(struct snd_pcm_substream *substream,
	int cmd)
{
	struct snd_pcm_runtime *rtd = substream->runtime;
	struct aml_runtime_data *prtd = rtd->private_data;
	audio_stream_t *s = &prtd->s;
	int ret = 0;
	
	spin_lock(&s->lock);
	switch (cmd) {
	case SNDRV_PCM_TRIGGER_START:
		
		del_timer_sync(&prtd->timer);
		
		prtd->timer.expires = jiffies + 1;
    del_timer(&prtd->timer);
    add_timer(&prtd->timer);
        
		// TODO
    	if ((aml_soc_platform.pcm_pdata) && ((struct pcm_platform_data *) (aml_soc_platform.pcm_pdata))->mute_func)
        	((struct pcm_platform_data *) (aml_soc_platform.pcm_pdata))->mute_func(0);

		if(substream->stream == SNDRV_PCM_STREAM_PLAYBACK){
		    printk("aml_pcm_trigger: playback start\n");
			audio_enable_ouput(1);
		}else{
		//	printk("aml_pcm_trigger: capture start\n");
			audio_in_i2s_enable(1);
            {
              int * ppp = (int*)(rtd->dma_area+rtd->dma_bytes*2-8);
			  ppp[0] = 0x78787878;
			  ppp[1] = 0x78787878;
            }

		}
		
		s->active = 1;
		
		break;		/* SNDRV_PCM_TRIGGER_START */
	case SNDRV_PCM_TRIGGER_SUSPEND:
	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
	case SNDRV_PCM_TRIGGER_STOP:
		// TODO
		s->active = 0;
		if(substream->stream == SNDRV_PCM_STREAM_PLAYBACK){
            printk("aml_pcm_trigger: playback stop\n");
				audio_enable_ouput(0);
		}else{
        //    printk("aml_pcm_trigger: capture stop\n");
				audio_in_i2s_enable(0);
		}
		break;

	case SNDRV_PCM_TRIGGER_RESUME:
	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
		// TODO
		s->active = 1;
		if(substream->stream == SNDRV_PCM_STREAM_PLAYBACK){
        //    printk("aml_pcm_trigger: playback resume\n");
				audio_enable_ouput(1);
		}else{
        //    printk("aml_pcm_trigger: capture resume\n");
			  audio_in_i2s_enable(1);
              {
                int * ppp = (int*)(rtd->dma_area+rtd->dma_bytes*2-8);
			    ppp[0] = 0x78787878;
			    ppp[1] = 0x78787878;
              }
		}
		
		break;

	default:
		ret = -EINVAL;
	}
	spin_unlock(&s->lock);
	return ret;
}
开发者ID:KaZoom,项目名称:buildroot-linux-kernel,代码行数:78,代码来源:aml_pcm.c

示例12: cisco_stop

static void cisco_stop(struct net_device *dev)
{
	del_timer_sync(&dev_to_hdlc(dev)->state.cisco.timer);
	if (netif_carrier_ok(dev))
		netif_carrier_off(dev);
}
开发者ID:wxlong,项目名称:Test,代码行数:6,代码来源:hdlc_cisco.c

示例13: xpc_stop_hb_beater

static void
xpc_stop_hb_beater(void)
{
	del_timer_sync(&xpc_hb_timer);
	xpc_arch_ops.heartbeat_exit();
}
开发者ID:020gzh,项目名称:linux,代码行数:6,代码来源:xpc_main.c

示例14: wl_cfg80211_bt_handler

static void wl_cfg80211_bt_handler(struct work_struct *work)
{
    struct btcoex_info *btcx_inf;

    btcx_inf = container_of(work, struct btcoex_info, work);

    if (btcx_inf->timer_on) {
        btcx_inf->timer_on = 0;
        del_timer_sync(&btcx_inf->timer);
    }

    switch (btcx_inf->bt_state) {
    case BT_DHCP_START:
        /* DHCP started
         * provide OPPORTUNITY window to get DHCP address
         */
        WL_TRACE(("%s bt_dhcp stm: started \n",
                  __FUNCTION__));
        btcx_inf->bt_state = BT_DHCP_OPPR_WIN;
        mod_timer(&btcx_inf->timer,
                  jiffies + BT_DHCP_OPPR_WIN_TIME*HZ/1000);
        btcx_inf->timer_on = 1;
        break;

    case BT_DHCP_OPPR_WIN:
        if (btcx_inf->dhcp_done) {
            WL_TRACE(("%s DHCP Done before T1 expiration\n",
                      __FUNCTION__));
            goto btc_coex_idle;
        }

        /* DHCP is not over yet, start lowering BT priority
         * enforce btc_params + flags if necessary
         */
        WL_TRACE(("%s DHCP T1:%d expired\n", __FUNCTION__,
                  BT_DHCP_OPPR_WIN_TIME));
        if (btcx_inf->dev)
            wl_cfg80211_bt_setflag(btcx_inf->dev, TRUE);
        btcx_inf->bt_state = BT_DHCP_FLAG_FORCE_TIMEOUT;
        mod_timer(&btcx_inf->timer,
                  jiffies + BT_DHCP_FLAG_FORCE_TIME*HZ/1000);
        btcx_inf->timer_on = 1;
        break;

    case BT_DHCP_FLAG_FORCE_TIMEOUT:
        if (btcx_inf->dhcp_done) {
            WL_TRACE(("%s DHCP Done before T2 expiration\n",
                      __FUNCTION__));
        } else {
            /* Noo dhcp during T1+T2, restore BT priority */
            WL_TRACE(("%s DHCP wait interval T2:%d"
                      "msec expired\n", __FUNCTION__,
                      BT_DHCP_FLAG_FORCE_TIME));
        }

        /* Restoring default bt priority */
        if (btcx_inf->dev)
            wl_cfg80211_bt_setflag(btcx_inf->dev, FALSE);
btc_coex_idle:
        btcx_inf->bt_state = BT_DHCP_IDLE;
        btcx_inf->timer_on = 0;
        break;

    default:
        WL_ERR(("%s error g_status=%d !!!\n", __FUNCTION__,
                btcx_inf->bt_state));
        if (btcx_inf->dev)
            wl_cfg80211_bt_setflag(btcx_inf->dev, FALSE);
        btcx_inf->bt_state = BT_DHCP_IDLE;
        btcx_inf->timer_on = 0;
        break;
    }

    net_os_wake_unlock(btcx_inf->dev);
}
开发者ID:AmeriCanAndroid,项目名称:aca-evo3d-gsm-omega-3.0-mdj,代码行数:75,代码来源:dhd_cfg80211.c

示例15: clamp_thread

static int clamp_thread(void *arg)
{
	int cpunr = (unsigned long)arg;
	DEFINE_TIMER(wakeup_timer, noop_timer, 0, 0);
	static const struct sched_param param = {
		.sched_priority = MAX_USER_RT_PRIO/2,
	};
	unsigned int count = 0;
	unsigned int target_ratio;

	set_bit(cpunr, cpu_clamping_mask);
	set_freezable();
	init_timer_on_stack(&wakeup_timer);
	sched_setscheduler(current, SCHED_FIFO, &param);

	while (true == clamping && !kthread_should_stop() &&
		cpu_online(cpunr)) {
		int sleeptime;
		unsigned long target_jiffies;
		unsigned int guard;
		unsigned int compensation = 0;
		int interval; /* jiffies to sleep for each attempt */
		unsigned int duration_jiffies = msecs_to_jiffies(duration);
		unsigned int window_size_now;

		try_to_freeze();
		/*
		 * make sure user selected ratio does not take effect until
		 * the next round. adjust target_ratio if user has changed
		 * target such that we can converge quickly.
		 */
		target_ratio = set_target_ratio;
		guard = 1 + target_ratio/20;
		window_size_now = window_size;
		count++;

		/*
		 * systems may have different ability to enter package level
		 * c-states, thus we need to compensate the injected idle ratio
		 * to achieve the actual target reported by the HW.
		 */
		compensation = get_compensation(target_ratio);
		interval = duration_jiffies*100/(target_ratio+compensation);

		/* align idle time */
		target_jiffies = roundup(jiffies, interval);
		sleeptime = target_jiffies - jiffies;
		if (sleeptime <= 0)
			sleeptime = 1;
		schedule_timeout_interruptible(sleeptime);
		/*
		 * only elected controlling cpu can collect stats and update
		 * control parameters.
		 */
		if (cpunr == control_cpu && !(count%window_size_now)) {
			should_skip =
				powerclamp_adjust_controls(target_ratio,
							guard, window_size_now);
			smp_mb();
		}

		if (should_skip)
			continue;

		target_jiffies = jiffies + duration_jiffies;
		mod_timer(&wakeup_timer, target_jiffies);
		if (unlikely(local_softirq_pending()))
			continue;
		/*
		 * stop tick sched during idle time, interrupts are still
		 * allowed. thus jiffies are updated properly.
		 */
		preempt_disable();
		/* mwait until target jiffies is reached */
		while (time_before(jiffies, target_jiffies)) {
			unsigned long ecx = 1;
			unsigned long eax = target_mwait;

			/*
			 * REVISIT: may call enter_idle() to notify drivers who
			 * can save power during cpu idle. same for exit_idle()
			 */
			local_touch_nmi();
			stop_critical_timings();
			mwait_idle_with_hints(eax, ecx);
			start_critical_timings();
			atomic_inc(&idle_wakeup_counter);
		}
		preempt_enable();
	}
	del_timer_sync(&wakeup_timer);
	clear_bit(cpunr, cpu_clamping_mask);

	return 0;
}

/*
 * 1 HZ polling while clamping is active, useful for userspace
 * to monitor actual idle ratio.
 */
//.........这里部分代码省略.........
开发者ID:ammubhave,项目名称:bargud,代码行数:101,代码来源:intel_powerclamp.c


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