Commit ea3a0ee5 authored by Ira Weiny's avatar Ira Weiny Committed by Doug Ledford
Browse files

IB/hfi1: Restructure hfi1_file_open



Rearrange the file open call in prep for new changes.

Reviewed-by: default avatarDean Luick <dean.luick@intel.com>
Signed-off-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent ff4ce9bd
Loading
Loading
Loading
Loading
+10 −4
Original line number Original line Diff line number Diff line
@@ -168,6 +168,7 @@ static inline int is_valid_mmap(u64 token)


static int hfi1_file_open(struct inode *inode, struct file *fp)
static int hfi1_file_open(struct inode *inode, struct file *fp)
{
{
	struct hfi1_filedata *fd;
	struct hfi1_devdata *dd = container_of(inode->i_cdev,
	struct hfi1_devdata *dd = container_of(inode->i_cdev,
					       struct hfi1_devdata,
					       struct hfi1_devdata,
					       user_cdev);
					       user_cdev);
@@ -176,10 +177,15 @@ static int hfi1_file_open(struct inode *inode, struct file *fp)
	kobject_get(&dd->kobj);
	kobject_get(&dd->kobj);


	/* The real work is performed later in assign_ctxt() */
	/* The real work is performed later in assign_ctxt() */
	fp->private_data = kzalloc(sizeof(struct hfi1_filedata), GFP_KERNEL);

	if (fp->private_data) /* no cpu affinity by default */
	fd = kzalloc(sizeof(*fd), GFP_KERNEL);
		((struct hfi1_filedata *)fp->private_data)->rec_cpu_num = -1;

	return fp->private_data ? 0 : -ENOMEM;
	if (fd) /* no cpu affinity by default */
		fd->rec_cpu_num = -1;

	fp->private_data = fd;

	return fd ? 0 : -ENOMEM;
}
}


static long hfi1_file_ioctl(struct file *fp, unsigned int cmd,
static long hfi1_file_ioctl(struct file *fp, unsigned int cmd,