Пример #1
0
/*------------------------------------------------------------------------------
 * Context: softirq
 */
int oz_pd_sleep(struct oz_pd *pd)
{
	int do_stop = 0;
	u16 stop_apps = 0;
	oz_polling_lock_bh();
	if (pd->state & (OZ_PD_S_SLEEP | OZ_PD_S_STOPPED)) {
		oz_polling_unlock_bh();
		return 0;
	}
	if (pd->keep_alive && pd->session_id) {
		if (pd->keep_alive >= OZ_KALIVE_INFINITE)
			oz_pd_indicate_farewells(pd);
		oz_pd_set_state(pd, OZ_PD_S_SLEEP);
		oz_pd_notify_uevent(pd);
	} else {
		do_stop = 1;
	}
	stop_apps = pd->total_apps;
	oz_polling_unlock_bh();
	if (do_stop) {
		oz_pd_stop(pd);
	} else {
		oz_services_stop(pd, stop_apps, 1);
		oz_timer_add(pd, OZ_TIMER_STOP, pd->keep_alive);
	}
	return do_stop;
}
Пример #2
0
/*------------------------------------------------------------------------------
 * Context: softirq or process
 */
void oz_pd_stop(struct oz_pd *pd)
{
	u16 stop_apps = 0;
	oz_trace_msg(M, "oz_pd_stop() State = 0x%x\n", pd->state);
	oz_polling_lock_bh();
	oz_pd_indicate_farewells(pd);
	stop_apps = pd->total_apps;
	pd->total_apps = 0;
	pd->paused_apps = 0;
	oz_polling_unlock_bh();
	oz_services_stop(pd, stop_apps, 0);
	oz_polling_lock_bh();
	oz_pd_set_state(pd, OZ_PD_S_STOPPED);

	if (hrtimer_active(&pd->timeout)) {
		oz_trace_msg(M, "hrtimer timeout active\n");
		hrtimer_cancel(&pd->timeout);
	}
	if (hrtimer_active(&pd->heartbeat)) {
		oz_trace_msg(M, "hrtimer heartbeat active\n");
		hrtimer_cancel(&pd->heartbeat);
	}
	/* connect_req will restart timers */

	/* Remove from PD list.*/
	list_del(&pd->link);


	oz_polling_unlock_bh();
	oz_trace_msg(M, "pd ref count = %d\n", atomic_read(&pd->ref_count));
	oz_pd_put(pd);
}
Пример #3
0
/*------------------------------------------------------------------------------
 * Context: softirq or process
 */
void oz_pd_stop(struct oz_pd *pd)
{
	u16 stop_apps = 0;
	oz_trace("oz_pd_stop() State = 0x%x\n", pd->state);
	oz_pd_indicate_farewells(pd);
	oz_polling_lock_bh();
	stop_apps = pd->total_apps;
	pd->total_apps = 0;
	pd->paused_apps = 0;
	oz_polling_unlock_bh();
	oz_services_stop(pd, stop_apps, 0);
	oz_polling_lock_bh();
	oz_pd_set_state(pd, OZ_PD_S_STOPPED);
	/* Remove from PD list.*/
	list_del(&pd->link);
	oz_polling_unlock_bh();
	oz_trace("pd ref count = %d\n", atomic_read(&pd->ref_count));
	oz_timer_delete(pd, 0);
	oz_pd_put(pd);
}