/* Open the device and initialize all of its memory. The device is only opened once, but can be "queried" by multiple processes that know its file descriptor.  */
static int perf_open(struct inode *inode, struct file *file)
/* Open the device and initialize all of its memory. The device is only opened once, but can be "queried" by multiple processes that know its file descriptor.  */
static int perf_open(struct inode *inode, struct file *file)
{
	lock_kernel();
	spin_lock(&perf_lock);
	if (perf_enabled) {
		spin_unlock(&perf_lock);
		unlock_kernel();
		return -EBUSY;
	}
	perf_enabled = 1;
 	spin_unlock(&perf_lock);
	unlock_kernel();
	return 0;
}