]> xenbits.xensource.com Git - people/aperard/linux-chromebook.git/commitdiff
CHROMIUM: BACKPORT: staging: zsmalloc: Finish conversion to a separate module
authorBen Hutchings <ben@decadent.org.uk>
Wed, 20 Jun 2012 01:31:11 +0000 (02:31 +0100)
committerGerrit <chrome-bot@google.com>
Mon, 3 Dec 2012 20:58:14 +0000 (12:58 -0800)
Need BACKPORT, rather than UPSTREAM, since it won't apply cleanly because
we had already fixed the MODULE_LICENSE problem.

---original comment:

ZSMALLOC is tristate, but the code has no MODULE_LICENSE and since it
depends on GPL-only symbols it cannot be loaded as a module.  This in
turn breaks zram which now depends on it.  I assume it's meant to be
Dual BSD/GPL like the other z-stuff.

There is also no module_exit, which will make it impossible to unload.
Add the appropriate module_init and module_exit declarations suggested
by comments.

Reported-by: Christian Ohm <chr.ohm@gmx.net>
References: http://bugs.debian.org/677273
Cc: stable@vger.kernel.org # v3.4
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Conflicts:

drivers/staging/zsmalloc/zsmalloc-main.c

BUG=chromium-os:36829
TEST=extensively tested manually

Change-Id: I82bc7ffffe3007b82601ec71f43873be2059586c
Signed-off-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38998
Reviewed-by: Olof Johansson <olofj@chromium.org>
drivers/staging/zsmalloc/zsmalloc-main.c

index 3ebdf951de7d9dc29308fb70045a599a661d501e..175b3c94d5a746de2c9636c6c2631b96ccbdb3f3 100644 (file)
@@ -426,12 +426,6 @@ static struct page *find_get_zspage(struct size_class *class)
 }
 
 
-/*
- * If this becomes a separate module, register zs_init() with
- * module_init(), zs_exit with module_exit(), and remove zs_initialized
-*/
-static int zs_initialized;
-
 static int zs_cpu_notifier(struct notifier_block *nb, unsigned long action,
                                void *pcpu)
 {
@@ -490,7 +484,7 @@ fail:
 
 struct zs_pool *zs_create_pool(const char *name, gfp_t flags)
 {
-       int i, error, ovhd_size;
+       int i, ovhd_size;
        struct zs_pool *pool;
 
        if (!name)
@@ -517,28 +511,9 @@ struct zs_pool *zs_create_pool(const char *name, gfp_t flags)
 
        }
 
-       /*
-        * If this becomes a separate module, register zs_init with
-        * module_init, and remove this block
-       */
-       if (!zs_initialized) {
-               error = zs_init();
-               if (error)
-                       goto cleanup;
-               zs_initialized = 1;
-       }
-
        pool->flags = flags;
        pool->name = name;
 
-       error = 0; /* Success */
-
-cleanup:
-       if (error) {
-               zs_destroy_pool(pool);
-               pool = NULL;
-       }
-
        return pool;
 }
 EXPORT_SYMBOL_GPL(zs_create_pool);
@@ -750,4 +725,8 @@ u64 zs_get_total_size_bytes(struct zs_pool *pool)
 }
 EXPORT_SYMBOL_GPL(zs_get_total_size_bytes);
 
+module_init(zs_init);
+module_exit(zs_exit);
+
 MODULE_LICENSE("Dual BSD/GPL");
+MODULE_AUTHOR("Nitin Gupta <ngupta@vflare.org>");