diff options
author | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-05-16 08:43:19 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-16 09:18:32 -0400 |
commit | 7dd8e9be9dba1dc5f0dfec67e37076b9c56a97d7 (patch) | |
tree | 3ef8e0f1ba899d77ed3a7196b2765be971bc8e53 | |
parent | 2717fca171b737c94a143dbad85e04781154c74b (diff) |
staging: android: persistent_ram: Prepare for modular builds
This is a transition patch to keep things bisectable, just moves
some routines under '#ifndef MODULE'. The code inside the #ifndef
will go away soon, but so far we must support pstore and ram_console.
So, we are about to use persistent_ram with pstore, with the ability
to compile persistent_ram routines as modules. Some parts of
persistent_ram uses memblock_reserve() routine, which is should be
only used built-in code, and thus it is not exported.
These persistent_ram bits are only used by Android's ram_console,
which is always built-in.
Without this patch, we won't able to compile persistent_ram as a
module:
ERROR: "memblock_reserve" [fs/pstore/ramoops.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
(As alternative, we could export memblock_reserve, but the thing
is: we won't need it later.)
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/android/persistent_ram.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/drivers/staging/android/persistent_ram.c b/drivers/staging/android/persistent_ram.c index 63481dad9b76..4b46eaad5f56 100644 --- a/drivers/staging/android/persistent_ram.c +++ b/drivers/staging/android/persistent_ram.c | |||
@@ -384,28 +384,6 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size, | |||
384 | return 0; | 384 | return 0; |
385 | } | 385 | } |
386 | 386 | ||
387 | static int __init persistent_ram_buffer_init(const char *name, | ||
388 | struct persistent_ram_zone *prz) | ||
389 | { | ||
390 | int i; | ||
391 | struct persistent_ram *ram; | ||
392 | struct persistent_ram_descriptor *desc; | ||
393 | phys_addr_t start; | ||
394 | |||
395 | list_for_each_entry(ram, &persistent_ram_list, node) { | ||
396 | start = ram->start; | ||
397 | for (i = 0; i < ram->num_descs; i++) { | ||
398 | desc = &ram->descs[i]; | ||
399 | if (!strcmp(desc->name, name)) | ||
400 | return persistent_ram_buffer_map(start, | ||
401 | desc->size, prz); | ||
402 | start += desc->size; | ||
403 | } | ||
404 | } | ||
405 | |||
406 | return -EINVAL; | ||
407 | } | ||
408 | |||
409 | static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool ecc) | 387 | static int __init persistent_ram_post_init(struct persistent_ram_zone *prz, bool ecc) |
410 | { | 388 | { |
411 | int ret; | 389 | int ret; |
@@ -478,6 +456,29 @@ err: | |||
478 | return ERR_PTR(ret); | 456 | return ERR_PTR(ret); |
479 | } | 457 | } |
480 | 458 | ||
459 | #ifndef MODULE | ||
460 | static int __init persistent_ram_buffer_init(const char *name, | ||
461 | struct persistent_ram_zone *prz) | ||
462 | { | ||
463 | int i; | ||
464 | struct persistent_ram *ram; | ||
465 | struct persistent_ram_descriptor *desc; | ||
466 | phys_addr_t start; | ||
467 | |||
468 | list_for_each_entry(ram, &persistent_ram_list, node) { | ||
469 | start = ram->start; | ||
470 | for (i = 0; i < ram->num_descs; i++) { | ||
471 | desc = &ram->descs[i]; | ||
472 | if (!strcmp(desc->name, name)) | ||
473 | return persistent_ram_buffer_map(start, | ||
474 | desc->size, prz); | ||
475 | start += desc->size; | ||
476 | } | ||
477 | } | ||
478 | |||
479 | return -EINVAL; | ||
480 | } | ||
481 | |||
481 | static __init | 482 | static __init |
482 | struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) | 483 | struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) |
483 | { | 484 | { |
@@ -528,3 +529,4 @@ int __init persistent_ram_early_init(struct persistent_ram *ram) | |||
528 | 529 | ||
529 | return 0; | 530 | return 0; |
530 | } | 531 | } |
532 | #endif | ||