Commit 2387e11c authored by Andries E. Brouwer's avatar Andries E. Brouwer Committed by Linus Torvalds

[PATCH] __initdata in dm.c

parent c6114f41
...@@ -138,23 +138,20 @@ static void local_exit(void) ...@@ -138,23 +138,20 @@ static void local_exit(void)
DMINFO("cleaned up"); DMINFO("cleaned up");
} }
/* int (*_inits[])(void) __initdata = {
* We have a lot of init/exit functions, so it seems easier to local_init,
* store them in an array. The disposable macro 'xx' dm_target_init,
* expands a prefix into a pair of function names. dm_linear_init,
*/ dm_stripe_init,
static struct { dm_interface_init,
int (*init) (void); };
void (*exit) (void);
void (*_exits[])(void) __exitdata = {
} _inits[] = { local_exit,
#define xx(n) {n ## _init, n ## _exit}, dm_target_exit,
xx(local) dm_linear_exit,
xx(dm_target) dm_stripe_exit,
xx(dm_linear) dm_interface_exit,
xx(dm_stripe)
xx(dm_interface)
#undef xx
}; };
static int __init dm_init(void) static int __init dm_init(void)
...@@ -164,7 +161,7 @@ static int __init dm_init(void) ...@@ -164,7 +161,7 @@ static int __init dm_init(void)
int r, i; int r, i;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
r = _inits[i].init(); r = _inits[i]();
if (r) if (r)
goto bad; goto bad;
} }
...@@ -173,17 +170,17 @@ static int __init dm_init(void) ...@@ -173,17 +170,17 @@ static int __init dm_init(void)
bad: bad:
while (i--) while (i--)
_inits[i].exit(); _exits[i]();
return r; return r;
} }
static void __exit dm_exit(void) static void __exit dm_exit(void)
{ {
int i = ARRAY_SIZE(_inits); int i = ARRAY_SIZE(_exits);
while (i--) while (i--)
_inits[i].exit(); _exits[i]();
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment