Older kernels than 3.10 do not register the epc device as a

platform device causing SGX module initialization to fail.
This fix includes registering a simple isgx device explicitely.

Signed-off-by: Serge Ayoun <serge.ayoun@intel.com>
This commit is contained in:
Serge Ayoun
2017-06-07 15:25:02 +03:00
parent 81bb6abbd7
commit cb96ee7a99
+22
View File
@@ -412,6 +412,28 @@ static struct platform_driver sgx_drv = {
},
};
#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0))
module_platform_driver(sgx_drv);
#else
static struct platform_device *pdev;
int init_sgx_module(void)
{
platform_driver_register(&sgx_drv);
pdev = platform_device_register_simple("intel_sgx", 0, NULL, 0);
if (IS_ERR(pdev))
pr_err("platform_device_register_simple failed\n");
return 0;
}
void cleanup_sgx_module(void)
{
dev_set_uevent_suppress(&pdev->dev, true);
platform_device_unregister(pdev);
platform_driver_unregister(&sgx_drv);
}
module_init(init_sgx_module);
module_exit(cleanup_sgx_module);
#endif
MODULE_LICENSE("Dual BSD/GPL");