示例#1
0
/* rpc connect for hsusb */
int msm_hsusb_rpc_connect(void)
{
	int ver;
	int i;

	if (usb_ep && !IS_ERR(usb_ep)) {
		pr_info("%s: usb_ep already connected\n", __func__);
		return 0;
	}

	/* Initialize rpc ids */
	for (i = 0, ver = 0x00010003; i < 3; i++) {
		if (msm_hsusb_init_rpc_ids(ver-i)) {
			pr_err("%s: rpc ids initialization failed\n"
				, __func__);
			return -ENODATA;
		}

		usb_ep = msm_rpc_connect(usb_rpc_ids.prog,
						usb_rpc_ids.vers_comp,
						MSM_RPC_UNINTERRUPTIBLE);

		if (IS_ERR(usb_ep)) {
			pr_err("%s: connect compatible failed vers = %lx\n",
					__func__, usb_rpc_ids.vers_comp);

		} else {
			pr_err("%s: rpc connect success vers = %lx\n",
					__func__, usb_rpc_ids.vers_comp);
			return 0;
		}
	}
	return -EAGAIN;
}
/* rpc connect for hsusb */
int msm_hsusb_rpc_connect(void)
{

	if (usb_ep && !IS_ERR(usb_ep)) {
		printk(KERN_INFO "%s: usb_ep already connected\n", __func__);
		return 0;
	}

	/* Initialize rpc ids */
	if (msm_hsusb_init_rpc_ids(0x00010001)) {
		printk(KERN_ERR "%s: rpc ids initialization failed\n"
			, __func__);
		return -ENODATA;
	}

	usb_ep = msm_rpc_connect_compatible(usb_rpc_ids.prog,
					usb_rpc_ids.vers_comp,
					MSM_RPC_UNINTERRUPTIBLE);

	if (IS_ERR(usb_ep)) {
		printk(KERN_ERR "%s: connect compatible failed vers = %lx\n",
			 __func__, usb_rpc_ids.vers_comp);

		/* Initialize rpc ids */
		if (msm_hsusb_init_rpc_ids(0x00010002)) {
			printk(KERN_ERR "%s: rpc ids initialization failed\n",
				__func__);
			return -ENODATA;
		}
		usb_ep = msm_rpc_connect_compatible(usb_rpc_ids.prog,
					usb_rpc_ids.vers_comp,
					MSM_RPC_UNINTERRUPTIBLE);
	}

	if (IS_ERR(usb_ep)) {
		printk(KERN_ERR "%s: connect compatible failed vers = %lx\n",
				__func__, usb_rpc_ids.vers_comp);
		return -EAGAIN;
	} else
		printk(KERN_INFO "%s: rpc connect success vers = %lx\n",
				__func__, usb_rpc_ids.vers_comp);

	return 0;
}