Exemple #1
0
static int bus1_fop_open(struct inode *inode, struct file *file)
{
	struct bus1_peer *peer;

	peer = bus1_peer_new();
	if (IS_ERR(peer))
		return PTR_ERR(peer);

	file->private_data = peer;
	return 0;
}
Exemple #2
0
static int bus1_fop_open(struct inode *inode, struct file *file)
{
	struct bus1_peer *peer;
	int r;

	peer = bus1_peer_new();
	if (IS_ERR(peer))
		return PTR_ERR(peer);

	r = bus1_peer_connect(peer);
	if (r < 0) {
		bus1_peer_free(peer);
		return r;
	}

	file->private_data = peer;
	return 0;
}