/* This function must be called with the hvcsd->lock held.  */
static int hvcs_partner_connect(struct hvcs_struct *hvcsd)
/* This function must be called with the hvcsd->lock held.  */
static int hvcs_partner_connect(struct hvcs_struct *hvcsd)
{
	int retval;
	unsigned int unit_address = hvcsd->vdev->unit_address;
	retval = hvcs_register_connection(unit_address,
			hvcsd->p_partition_ID,
			hvcsd->p_unit_address);
	if (!retval) {
		hvcsd->connected = 1;
		return 0;
	} else if (retval != -EINVAL)
		return retval;
	if (hvcs_get_pi(hvcsd))
		return -ENOMEM;
	if (!hvcs_has_pi(hvcsd))
		return -ENODEV;
	retval = hvcs_register_connection(unit_address,
			hvcsd->p_partition_ID,
			hvcsd->p_unit_address);
	if (retval != -EINVAL) {
		hvcsd->connected = 1;
		return retval;
	}
	printk(KERN_INFO "HVCS: vty-server or partner"
			" vty is busy.  Try again later.\n");
	return -EBUSY;
}