/* XPC's heartbeat code will never call this function and xpc_partition_up() at the same time. Nor will it ever make multiple calls to either function at the same time.  */
void xpc_partition_going_down(struct xpc_partition *part, enum xp_retval reason)
/* XPC's heartbeat code will never call this function and xpc_partition_up() at the same time. Nor will it ever make multiple calls to either function at the same time.  */
void xpc_partition_going_down(struct xpc_partition *part, enum xp_retval reason)
{
	unsigned long irq_flags;
	int ch_number;
	struct xpc_channel *ch;
	dev_dbg(xpc_chan, "deactivating partition %d, reason=%d\n",
		XPC_PARTID(part), reason);
	if (!xpc_part_ref(part)) {
		return;
	}
	for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
		ch = &part->channels[ch_number];
		xpc_msgqueue_ref(ch);
		spin_lock_irqsave(&ch->lock, irq_flags);
		XPC_DISCONNECT_CHANNEL(ch, reason, &irq_flags);
		spin_unlock_irqrestore(&ch->lock, irq_flags);
		xpc_msgqueue_deref(ch);
	}
	xpc_wakeup_channel_mgr(part);
	xpc_part_deref(part);
}