Exemplo n.º 1
0
int PVRDebugProcSetLevel(struct file *file, const char *buffer, u32 count,
			 void *data)
{
#define	_PROC_SET_BUFFER_SZ		2
	char data_buffer[_PROC_SET_BUFFER_SZ];

	if (count != _PROC_SET_BUFFER_SZ) {
		return -EINVAL;
	} else {
		if (copy_from_user(data_buffer, buffer, count))
			return -EINVAL;
		if (data_buffer[count - 1] != '\n')
			return -EINVAL;
		PVRDebugSetLevel(data_buffer[0] - '0');
	}
	return (count);
}
Exemplo n.º 2
0
IMG_INT PVRDebugProcSetLevel(struct file *file, const IMG_CHAR *buffer, IMG_UINT32 count, IMG_VOID *data)
{
#define	_PROC_SET_BUFFER_SZ		2
	IMG_CHAR data_buffer[_PROC_SET_BUFFER_SZ];

	if (count != _PROC_SET_BUFFER_SZ)
	{
		return -EINVAL;
	}
	else
	{
		if (copy_from_user(data_buffer, buffer, count))
			return -EINVAL;
		if (data_buffer[count - 1] != '\n')
			return -EINVAL;
		PVRDebugSetLevel(data_buffer[0] - '0');
	}
	return (count);
}
Exemplo n.º 3
0
static int __init PVRCore_Init(void)
{
	int error;

	PVR_TRACE("PVRCore_Init");

	AssignedMajorNumber = register_chrdev(0, DEVNAME, &pvrsrv_fops);

	if (AssignedMajorNumber <= 0) {
		PVR_DPF(PVR_DBG_ERROR,
			 "PVRCore_Init: unable to get major number");

		return -EBUSY;
	}

	PVR_TRACE("PVRCore_Init: major device %d", AssignedMajorNumber);

	if (CreateProcEntries()) {
		unregister_chrdev(AssignedMajorNumber, DRVNAME);

		return -ENOMEM;
	}

	LinuxInitMutex(&gPVRSRVLock);

#ifdef DEBUG
	PVRDebugSetLevel(debug);
#endif

	if (LinuxMMInit() != PVRSRV_OK) {
		error = -ENOMEM;
		goto init_failed;
	}

	LinuxBridgeInit();

	PVRMMapInit();

	error = platform_driver_register(&powervr_driver);
	if (error != 0) {
		PVR_DPF(PVR_DBG_ERROR, "PVRCore_Init: "
			"unable to register platform driver (%d)", error);

		goto init_failed;
	}

	powervr_device.dev.devt = MKDEV(AssignedMajorNumber, 0);

	error = platform_device_register(&powervr_device);
	if (error != 0) {
		platform_driver_unregister(&powervr_driver);

		PVR_DPF(PVR_DBG_ERROR, "PVRCore_Init: "
			"unable to register platform device (%d)", error);

		goto init_failed;
	}


	return 0;

init_failed:

	PVRMMapCleanup();
	LinuxMMCleanup();
	RemoveProcEntries();
	unregister_chrdev(AssignedMajorNumber, DRVNAME);

	return error;

}