Skip to content

Commit

Permalink
staging: zsmalloc: Finish conversion to a separate module
Browse files Browse the repository at this point in the history
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 <[email protected]>
References: http://bugs.debian.org/677273
Cc: [email protected] # v3.4
Signed-off-by: Ben Hutchings <[email protected]>
Reviewed-by: Jonathan Nieder <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
bwhacks authored and gregkh committed Jun 20, 2012
1 parent 2f0f8e6 commit 069f101
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions drivers/staging/zsmalloc/zsmalloc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,12 +471,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)
{
Expand Down Expand Up @@ -535,7 +529,7 @@ static int zs_init(void)

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)
Expand All @@ -562,28 +556,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);
Expand Down Expand Up @@ -799,3 +774,9 @@ u64 zs_get_total_size_bytes(struct zs_pool *pool)
return npages << PAGE_SHIFT;
}
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 <[email protected]>");

0 comments on commit 069f101

Please sign in to comment.