本文整理汇总了C++中delayed_work_pending函数的典型用法代码示例。如果您正苦于以下问题:C++ delayed_work_pending函数的具体用法?C++ delayed_work_pending怎么用?C++ delayed_work_pending使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delayed_work_pending函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: my_exit
static void my_exit (void) {
// irq
// #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)
// if (!can_request_irq(thisIRQ, irqflags))
// #endif
free_irq(thisIRQ,&dev_id);
while (delayed_work_pending(hello_data->wk)) {
cancel_delayed_work_sync(hello_data->wk);
printk(KERN_ALERT "2470:10.6a: Cancelling delayed work!\n");
}
destroy_workqueue(hello_data->proc_hello_wkq);
kfree(hello_data->wk);
kfree(hello_data->proc_hello_value);
kfree(hello_data);
if (proc_hello)
remove_proc_entry (HELLO, proc_mydev);
if (proc_mydev)
remove_proc_entry (MYDEV, 0);
// module exit message
printk(KERN_ALERT "2470:10.6a: main destroyed!\n");
}
示例2: max77665_charger_types
static int max77665_charger_types(struct max77665_charger *charger)
{
#define MA_TO_UA 1000
enum cable_status_t cable_status = charger->cable_status;
int chgin_ilim = 0;
int ret;
switch (cable_status) {
case CABLE_TYPE_USB: //USB input current 500mA
chgin_ilim = charger->chgin_ilim_usb *MA_TO_UA;
break;
case CABLE_TYPE_AC: //AC input current 1200mA
chgin_ilim = charger->chgin_ilim_ac * MA_TO_UA;
break;
default:
chgin_ilim = 0;
break;
}
if (chgin_ilim) {
/* set ilim cur */
ret = regulator_set_current_limit(charger->ps, chgin_ilim, MAX_AC_CURRENT*MA_TO_UA);
if (ret) {
pr_err("failed to set current limit\n");
return ret;
}
}
if(delayed_work_pending(&charger->poll_dwork))
cancel_delayed_work(&charger->poll_dwork);
schedule_delayed_work_on(0, &charger->poll_dwork, 0);
return 0;
}
示例3: row_add_request
/*
* row_add_request() - Add request to the scheduler
* @q: requests queue
* @rq: request to add
*
*/
static void row_add_request(struct request_queue *q,
struct request *rq)
{
struct row_data *rd = (struct row_data *)q->elevator->elevator_data;
struct row_queue *rqueue = RQ_ROWQ(rq);
list_add_tail(&rq->queuelist, &rqueue->fifo);
rd->nr_reqs[rq_data_dir(rq)]++;
rq_set_fifo_time(rq, jiffies); /* for statistics*/
if (queue_idling_enabled[rqueue->prio]) {
if (delayed_work_pending(&rd->read_idle.idle_work))
(void)cancel_delayed_work(
&rd->read_idle.idle_work);
if (ktime_to_ms(ktime_sub(ktime_get(),
rqueue->idle_data.last_insert_time)) <
rd->read_idle.freq) {
rqueue->idle_data.begin_idling = true;
row_log_rowq(rd, rqueue->prio, "Enable idling");
} else {
rqueue->idle_data.begin_idling = false;
row_log_rowq(rd, rqueue->prio, "Disable idling");
}
rqueue->idle_data.last_insert_time = ktime_get();
}
row_log_rowq(rd, rqueue->prio, "added request");
}
示例4: haptic_enable
static void haptic_enable(struct timed_output_dev *tdev, int value)
{
struct haptic_data *chip =
container_of(tdev, struct haptic_data, tdev);
mutex_lock(&chip->haptic_mutex);
if (chip->motor_status == MOTOR_SHUTDOWN)
goto unlock;
#ifdef __CONFIG_DEBUG_HAPTIC__
pr_info("%s: vibration time = %d\n", __func__, g_vibrate_count++);
#endif
//max77665_haptic_on(chip, false);
hrtimer_cancel(&chip->timer);
if (delayed_work_pending(&chip->disable_work))
cancel_delayed_work(&chip->disable_work);
if (value > 0) {
value = min(value, chip->max_timeout);
hrtimer_start(&chip->timer, ktime_set(value/1000, (value%1000)*1000000),
HRTIMER_MODE_REL);
}
#ifdef __CONFIG_DEBUG_HAPTIC__
pr_info("%s: process: %s, time: %d ms\n", __func__, current->comm, value);
#endif
max77665_haptic_on(chip, !!value);
unlock:
mutex_unlock(&chip->haptic_mutex);
}
示例5: stop_podgov_workers
static void stop_podgov_workers(struct podgov_info_rec *podgov)
{
/* idle_timer can rearm itself */
do {
cancel_delayed_work_sync(&podgov->idle_timer);
} while (delayed_work_pending(&podgov->idle_timer));
}
示例6: msm_voice_rx_mute_timeout_put
static int msm_voice_rx_mute_timeout_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
static struct delayed_work *unmute_work = NULL;
int ret = 0;
int mute = ucontrol->value.integer.value[0];
uint32_t session_id = ucontrol->value.integer.value[1];
int timeout = ucontrol->value.integer.value[2];
if (unmute_work == NULL) {
unmute_work = kzalloc(sizeof(struct delayed_work), GFP_KERNEL);
INIT_DELAYED_WORK(unmute_work, msm_voice_unmute_work);
}
if ((mute != 1) || (timeout <= 0)) {
pr_err(" %s Invalid arguments", __func__);
ret = -EINVAL;
goto done;
}
pr_debug("%s: mute=%d session_id=%#x timeout=%d\n", __func__,
mute, session_id, timeout);
voc_set_device_mute_lge(voc_get_session_id(VOICE_SESSION_NAME),
VSS_IVOLUME_DIRECTION_RX, 1, 500);
if (unlikely(delayed_work_pending(unmute_work)))
cancel_delayed_work_sync(unmute_work);
schedule_delayed_work(unmute_work, msecs_to_jiffies(timeout));
done:
return ret;
}
示例7: hotplug_boostpulse
inline void hotplug_boostpulse(void)
{
if (unlikely(flags & (EARLYSUSPEND_ACTIVE
| HOTPLUG_DISABLED)))
return;
if (!(flags & BOOSTPULSE_ACTIVE)) {
flags |= BOOSTPULSE_ACTIVE;
/*
* If there are less than 2 CPUs online, then online
* an additional CPU, otherwise check for any pending
* offlines, cancel them and pause for 2 seconds.
* Either way, we don't allow any cpu_down()
* whilst the user is interacting with the device.
*/
if (likely(num_online_cpus() < 2)) {
cancel_delayed_work_sync(&hotplug_offline_work);
flags |= HOTPLUG_PAUSED;
schedule_work(&hotplug_online_single_work);
schedule_delayed_work(&hotplug_unpause_work, HZ );
} else {
pr_info("auto_hotplug: %s: %d CPUs online\n", __func__, num_online_cpus());
if (delayed_work_pending(&hotplug_offline_work)) {
pr_info("auto_hotplug: %s: Cancelling hotplug_offline_work\n", __func__);
cancel_delayed_work(&hotplug_offline_work);
flags |= HOTPLUG_PAUSED;
schedule_delayed_work(&hotplug_unpause_work, HZ );
schedule_delayed_work_on(0, &hotplug_decision_work, MIN_SAMPLING_RATE);
}
}
}
}
示例8: rt9532_duration_work
static void rt9532_duration_work(struct work_struct *work)
{
if(delayed_work_pending(&charger.irq_work))
cancel_delayed_work_sync(&charger.irq_work);
schedule_delayed_work(&charger.irq_work, msecs_to_jiffies(1000));
}
示例9: battery_chargalg_schedule_delayed_work
static void battery_chargalg_schedule_delayed_work(struct delayed_work *work,
unsigned long delay)
{
if (delayed_work_pending(work))
cancel_delayed_work(work);
schedule_delayed_work(work, delay);
}
示例10: hsic_aux_gpio_irq
/* HSIC AUX GPIO irq handler */
static irqreturn_t hsic_aux_gpio_irq(int irq, void *data)
{
struct device *dev = data;
dev_dbg(dev,
"%s---> hsic aux gpio request irq: %d\n",
__func__, irq);
if (hsic.hsic_aux_irq_enable == 0) {
dev_dbg(dev,
"%s---->AUX IRQ is disabled\n", __func__);
return IRQ_HANDLED;
}
cancel_delayed_work(&hsic.wakeup_work);
if (delayed_work_pending(&hsic.hsic_aux)) {
dev_dbg(dev,
"%s---->Delayed work pending\n", __func__);
return IRQ_HANDLED;
}
hsic.hsic_aux_finish = 0;
schedule_delayed_work(&hsic.hsic_aux, 0);
dev_dbg(dev,
"%s<----\n", __func__);
return IRQ_HANDLED;
}
示例11: rfkill_schedule_ratelimited
static void rfkill_schedule_ratelimited(void)
{
if (delayed_work_pending(&rfkill_op_work))
return;
schedule_delayed_work(&rfkill_op_work,
rfkill_ratelimit(rfkill_last_scheduled));
rfkill_last_scheduled = jiffies;
}
示例12: batch_update
static bool batch_update(struct fb_info *info, struct omap3epfb_update_area *p)
{
struct omap3epfb_par *par = info->par;
// If EPD is disabled, do nothing
if (par->disable_flags > 0)
{
DEBUG_REGION(DEBUG_LEVEL3, p,"update DISABLED = ");
// Tell the caller not to update.
return false;
}
// Check if the delayed full screen updates are enabled.
if (!par->clear_delay)
{
DEBUG_REGION(DEBUG_LEVEL1, p," do = ");
if (fast==1) {
omap3epfb_update_screen(par->info, OMAP3EPFB_WVFID_VU, false);
} else {
omap3epfb_update_area(info, p);
}
return false;
}
// If this is not a fullscreen GC update, treat it as a normal update.
if (!(rect_fullscreen(info, p) && p->wvfid == OMAP3EPFB_WVFID_GC))
{
// If we have a fullscreen batched, we do not need to update.
if (!delayed_work_pending(&par->clear_work))
{
DEBUG_REGION(DEBUG_LEVEL1, p," do = ");
if (fast==1) {
omap3epfb_update_screen(par->info, OMAP3EPFB_WVFID_VU, false);
} else {
omap3epfb_update_area(info, p);
}
}
else
{
DEBUG_REGION(DEBUG_LEVEL1, p," skip = ");
}
return false;
}
// We need to do fullscreen batching.
if (par->user_debug & DEBUG_LEVEL1)
{
if (TIME_DELTA_MS(par->last_clear) < 1000)
DEBUG_REGION(DEBUG_LEVEL1, p," req FULLSCREEN PREV %dms ago AUTO = ", TIME_DELTA_MS(par->last_clear));
else
DEBUG_REGION(DEBUG_LEVEL1, p," req FULLSCREEN = ");
}
omap3epfb_reqq_purge(par->info);
cancel_delayed_work_sync(&par->clear_work);
schedule_delayed_work(&par->clear_work, msecs_to_jiffies(par->clear_delay));
par->last_clear = TIME_STAMP();
return true;
}
示例13: rt2x00link_stop_tuner
void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev)
{
#if 0 /* Not in RHEL5... */
cancel_delayed_work_sync(&rt2x00dev->link.work);
#else
if (delayed_work_pending(&rt2x00dev->link.work))
cancel_rearming_delayed_work(&rt2x00dev->link.work);
#endif
}
示例14: mdss_mdp_clk_ctrl
void mdss_mdp_clk_ctrl(int enable, int isr)
{
static atomic_t clk_ref = ATOMIC_INIT(0);
static DEFINE_MUTEX(clk_ctrl_lock);
int force_off = 0;
pr_debug("clk enable=%d isr=%d clk_ref=%d\n", enable, isr,
atomic_read(&clk_ref));
/*
* It is assumed that if isr = TRUE then start = OFF
* if start = ON when isr = TRUE it could happen that the usercontext
* could turn off the clocks while the interrupt is updating the
* power to ON
*/
WARN_ON(isr == true && enable);
if (enable == MDP_BLOCK_POWER_ON) {
atomic_inc(&clk_ref);
} else if (!atomic_add_unless(&clk_ref, -1, 0)) {
if (enable == MDP_BLOCK_MASTER_OFF) {
pr_debug("master power-off req\n");
force_off = 1;
} else {
WARN(1, "too many mdp clock off call\n");
}
}
WARN_ON(enable == MDP_BLOCK_MASTER_OFF && !force_off);
if (isr) {
/* if it's power off send workqueue to turn off clocks */
if (mdss_res->clk_ena && !atomic_read(&clk_ref))
queue_delayed_work(mdss_res->clk_ctrl_wq,
&mdss_res->clk_ctrl_worker,
mdss_res->timeout);
} else {
mutex_lock(&clk_ctrl_lock);
if (delayed_work_pending(&mdss_res->clk_ctrl_worker))
cancel_delayed_work(&mdss_res->clk_ctrl_worker);
if (atomic_read(&clk_ref)) {
mdss_mdp_clk_ctrl_update(true);
} else if (mdss_res->clk_ena) {
mutex_lock(&mdp_suspend_mutex);
if (force_off || mdss_res->suspend) {
mdss_mdp_clk_ctrl_update(false);
} else {
/* send workqueue to turn off mdp power */
queue_delayed_work(mdss_res->clk_ctrl_wq,
&mdss_res->clk_ctrl_worker,
mdss_res->timeout);
}
mutex_unlock(&mdp_suspend_mutex);
}
mutex_unlock(&clk_ctrl_lock);
}
}
示例15: cleanup_module
void cleanup_module () {
flush_workqueue(queue);
if (delayed_work_pending(&dwork)) {
cancel_delayed_work(&dwork);
flush_workqueue(queue);
}
destroy_workqueue(queue);
printk(KERN_INFO "Module removed");
}