Make ashmem driver loadable as kernel module

This commit is contained in:
Simon Fels 2016-08-19 09:25:16 +02:00
commit acafc66bdf

View file

@ -18,6 +18,7 @@
#define pr_fmt(fmt) "ashmem: " fmt
#include <linux/module.h>
#include <linux/init.h>
#include <linux/export.h>
#include <linux/file.h>
@ -857,8 +858,20 @@ static int __init ashmem_init(void)
register_shrinker(&ashmem_shrinker);
pr_info("initialized\n");
return 0;
}
device_initcall(ashmem_init);
static void __exit ashmem_exit(void)
{
unregister_shrinker(&ashmem_shrinker);
misc_deregister(&ashmem_misc);
kmem_cache_destroy(ashmem_range_cachep);
kmem_cache_destroy(ashmem_area_cachep);
}
module_init(ashmem_init);
module_exit(ashmem_exit);
MODULE_LICENSE("GPL");