diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-03-08 07:46:37 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-03-08 21:57:18 -0500 |
commit | 2e733b3f84fa9c2ae60513c5f7b56d599ed2ae02 (patch) | |
tree | 6264e1ee6ebe2f68a24974be3eafcea399effe52 | |
parent | 51a5006afcd13176276f0935ee57c4cc6f210e83 (diff) |
sh: Support early clkdev allocations.
early platform devices and the like may need to set up clock aliases,
which require an allocation at a time well before the slab allocators
are available. The clock framework comes up after bootmem, so using
bootmem as a fallback should be sufficient.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/kernel/clkdev.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/sh/kernel/clkdev.c b/arch/sh/kernel/clkdev.c index 29cd802ac388..defdd6e30908 100644 --- a/arch/sh/kernel/clkdev.c +++ b/arch/sh/kernel/clkdev.c | |||
@@ -20,6 +20,9 @@ | |||
20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
21 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/slab.h> | ||
24 | #include <linux/bootmem.h> | ||
25 | #include <linux/mm.h> | ||
23 | #include <asm/clock.h> | 26 | #include <asm/clock.h> |
24 | #include <asm/clkdev.h> | 27 | #include <asm/clkdev.h> |
25 | 28 | ||
@@ -103,12 +106,16 @@ struct clk_lookup_alloc { | |||
103 | char con_id[MAX_CON_ID]; | 106 | char con_id[MAX_CON_ID]; |
104 | }; | 107 | }; |
105 | 108 | ||
106 | struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, | 109 | struct clk_lookup * __init_refok |
107 | const char *dev_fmt, ...) | 110 | clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...) |
108 | { | 111 | { |
109 | struct clk_lookup_alloc *cla; | 112 | struct clk_lookup_alloc *cla; |
110 | 113 | ||
111 | cla = kzalloc(sizeof(*cla), GFP_KERNEL); | 114 | if (!slab_is_available()) |
115 | cla = alloc_bootmem_low_pages(sizeof(*cla)); | ||
116 | else | ||
117 | cla = kzalloc(sizeof(*cla), GFP_KERNEL); | ||
118 | |||
112 | if (!cla) | 119 | if (!cla) |
113 | return NULL; | 120 | return NULL; |
114 | 121 | ||