static void cmd_crash_exit_handler(struct mem_link_device *mld)
{
	struct link_device *ld = &mld->link_dev;
	struct modem_ctl *mc = ld->mc;
	unsigned long flags;

	spin_lock_irqsave(&ld->lock, flags);
	ld->state = LINK_STATE_CP_CRASH;
	spin_unlock_irqrestore(&ld->lock, flags);

	if (timer_pending(&mc->crash_ack_timer))
		del_timer(&mc->crash_ack_timer);

	if (atomic_read(&mc->forced_cp_crash))
		evt_log(0, "%s<-%s: CP_CRASH_ACK\n", ld->name, mc->name);
	else
		evt_log(0, "%s<-%s: ERR! CP_CRASH_EXIT\n", ld->name, mc->name);

#ifdef DEBUG_MODEM_IF
	if (!atomic_read(&mc->forced_cp_crash))
		queue_work(system_nrt_wq, &mld->dump_work);
#endif

	mem_handle_cp_crash(mld, STATE_CRASH_EXIT);
}
/**
@brief		handle no CRASH_ACK from CP

This function will be invoked if there will have been no CRASH_ACK from CP in
FORCE_CRASH_ACK_TIMEOUT after AP sends a CP_CRASH request to CP.

@param arg	the pointer to a mem_link_device instance
*/
static void handle_no_cp_crash_ack(unsigned long arg)
{
	struct mem_link_device *mld = (struct mem_link_device *)arg;
	struct link_device *ld = &mld->link_dev;

	mif_err("%s: ERR! No CRASH_EXIT ACK from CP\n", ld->name);

	mem_handle_cp_crash(mld, STATE_CRASH_EXIT);
}
static void cmd_crash_reset_handler(struct mem_link_device *mld)
{
	struct link_device *ld = &mld->link_dev;
	struct modem_ctl *mc = ld->mc;
	unsigned long flags;

	spin_lock_irqsave(&ld->lock, flags);
	ld->state = LINK_STATE_OFFLINE;
	spin_unlock_irqrestore(&ld->lock, flags);

	evt_log(0, "%s<-%s: ERR! CP_CRASH_RESET\n", ld->name, mc->name);

	mem_handle_cp_crash(mld, STATE_CRASH_RESET);
}
static void handle_no_cp_crash_ack(unsigned long arg)
{
	struct mem_link_device *mld = (struct mem_link_device *)arg;
	struct link_device *ld = &mld->link_dev;
	struct modem_ctl *mc = ld->mc;

	if (cp_crashed(mc)) {
		mif_debug("%s: STATE_CRASH_EXIT without CRASH_ACK\n",
			ld->name);
	} else {
		mif_err("%s: ERR! No CRASH_ACK from CP\n", ld->name);
		mem_handle_cp_crash(mld, STATE_CRASH_EXIT);
	}
}
static void pm_cp_fail_cb(struct modem_link_pm *pm)
{
	struct link_device *ld = pm_to_link_device(pm);
	struct mem_link_device *mld = ld_to_mem_link_device(ld);
	struct modem_ctl *mc = ld->mc;
	struct io_device *iod = mc->iod;

	if (cp_online(mc)) {
		mem_handle_cp_crash(mld, STATE_CRASH_EXIT);
	} else if (cp_booting(mc)) {
		unsigned long flags;

		spin_lock_irqsave(&mc->lock, flags);
		iod->modem_state_changed(iod, STATE_OFFLINE);
		ld->reload(ld);
		spin_unlock_irqrestore(&mc->lock, flags);
	}
}