]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
UBUNTU: SAUCE: ashmem: turn into module
authorChristian Brauner <christian@brauner.io>
Wed, 20 Jun 2018 17:21:37 +0000 (19:21 +0200)
committerSeth Forshee <seth.forshee@canonical.com>
Mon, 4 Mar 2019 12:51:31 +0000 (06:51 -0600)
The Android ashmem driver needs to become a module for the sake of Anbox.
To do this we need to export shmem_zero_setup() since ashmem is currently
using is.
Note, the abomination that is the Android ashmem driver will go away in the
not so distant future in favour of memfds.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/staging/android/Kconfig
drivers/staging/android/Makefile
drivers/staging/android/ashmem.c
mm/shmem.c

index 17c5587805f54eed328bf7b3246939c73735c620..20bee89914640e7e6f3a35a9f7bef2bfddab995a 100644 (file)
@@ -3,7 +3,7 @@ menu "Android"
 if ANDROID
 
 config ASHMEM
-       bool "Enable the Anonymous Shared Memory Subsystem"
+       tristate "Enable the Anonymous Shared Memory Subsystem"
        default n
        depends on SHMEM
        help
index 90e6154f11a4cda073c5a6f69944d231361270be..8ee4bfaf8d8c956d7ae80d7816d5d0eb792d3846 100644 (file)
@@ -2,5 +2,6 @@ ccflags-y += -I$(src)                   # needed for trace events
 
 obj-y                                  += ion/
 
-obj-$(CONFIG_ASHMEM)                   += ashmem.o
+ashmem_linux-y                         += ashmem.o
+obj-$(CONFIG_ASHMEM)                   += ashmem_linux.o
 obj-$(CONFIG_ANDROID_VSOC)             += vsoc.o
index 90a8a9f1ac7d8abd2f7a5f21fe9839934a5ec7f4..28c6ad8619b9c9d8561d2942876059f6146bc085 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/security.h>
 #include <linux/mm.h>
 #include <linux/mman.h>
+#include <linux/module.h>
 #include <linux/uaccess.h>
 #include <linux/personality.h>
 #include <linux/bitops.h>
@@ -902,4 +903,18 @@ out_free1:
 out:
        return ret;
 }
-device_initcall(ashmem_init);
+
+static void __exit ashmem_exit(void)
+{
+       misc_deregister(&ashmem_misc);
+       unregister_shrinker(&ashmem_shrinker);
+       kmem_cache_destroy(ashmem_range_cachep);
+       kmem_cache_destroy(ashmem_area_cachep);
+}
+
+module_init(ashmem_init);
+module_exit(ashmem_exit);
+
+MODULE_AUTHOR("Google, Inc.");
+MODULE_DESCRIPTION("Driver for Android shared memory device");
+MODULE_LICENSE("GPL v2");
index 2c012eee133d1f13dc3fe8b7112278dfc02e8ceb..a8cdb6778b3cf691a29645435e9501a23bea83b5 100644 (file)
@@ -3992,6 +3992,7 @@ int shmem_zero_setup(struct vm_area_struct *vma)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(shmem_zero_setup);
 
 /**
  * shmem_read_mapping_page_gfp - read into page cache, using specified page allocation flags.