Пример #1
0
static int rpcrouter_open(struct inode *inode, struct file *filp)
{
	int rc;
	struct msm_rpc_endpoint *ept;

	rc = nonseekable_open(inode, filp);
	if (rc < 0)
		return rc;

	ept = msm_rpcrouter_create_local_endpoint(inode->i_rdev);
	if (!ept)
		return -ENOMEM;

	filp->private_data = ept;
	return 0;
}
Пример #2
0
static int rpcrouter_open(struct inode *inode, struct file *filp)
{
	int rc;
	void *pil;
	struct msm_rpc_endpoint *ept;
	struct rpcrouter_file_info *file_info;

	rc = nonseekable_open(inode, filp);
	if (rc < 0)
		return rc;

	file_info = kzalloc(sizeof(*file_info), GFP_KERNEL);
	if (!file_info)
		return -ENOMEM;

	ept = msm_rpcrouter_create_local_endpoint(inode->i_rdev);
	if (!ept) {
		kfree(file_info);
		return -ENOMEM;
	}
	file_info->ept = ept;

	/* if router device, load the modem */
	if (inode->i_rdev == msm_rpcrouter_devno) {
		pil = msm_rpcrouter_load_modem();
		if (IS_ERR(pil)) {
			kfree(file_info);
			msm_rpcrouter_destroy_local_endpoint(ept);
			return PTR_ERR(pil);
		}
		file_info->modem_pil = pil;
	}

	filp->private_data = file_info;
	return 0;
}