static int queue_cpu_stop_work(struct cpu_stopper *stopper, struct cpu_stop_work *work) { int ret=0; //printk("suspend_process_queue_cpu_stop_work smp=%u enabled=%d\n",smp_processor_id(),stopper->enabled ); if (stopper->enabled) { ret=wake_up_process(stopper->thread);// 1 -> success if(ret) list_add_tail(&work->list, &stopper->works); } else cpu_stop_signal_done(work->done, false); return ret; }
/* queue @work to @stopper. if offline, @work is completed immediately */ static void cpu_stop_queue_work(struct cpu_stopper *stopper, struct cpu_stop_work *work) { unsigned long flags; spin_lock_irqsave(&stopper->lock, flags); if (stopper->enabled) { list_add_tail(&work->list, &stopper->works); wake_up_process(stopper->thread); } else cpu_stop_signal_done(work->done, false); spin_unlock_irqrestore(&stopper->lock, flags); }
/* queue @work to @stopper. if offline, @work is completed immediately */ static void cpu_stop_queue_work(unsigned int cpu, struct cpu_stop_work *work) { struct cpu_stopper *stopper = &per_cpu(cpu_stopper, cpu); struct task_struct *p = per_cpu(cpu_stopper_task, cpu); unsigned long flags; spin_lock_irqsave(&stopper->lock, flags); if (stopper->enabled) { list_add_tail(&work->list, &stopper->works); wake_up_process(p); } else cpu_stop_signal_done(work->done, false); spin_unlock_irqrestore(&stopper->lock, flags); }