summaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-03-08 21:46:37 +0900
committerPaul Mundt <lethal@linux-sh.org>2010-03-09 11:57:18 +0900
commit2e733b3f84fa9c2ae60513c5f7b56d599ed2ae02 (patch)
tree6264e1ee6ebe2f68a24974be3eafcea399effe52 /arch/sh/kernel
parent51a5006afcd13176276f0935ee57c4cc6f210e83 (diff)
downloadop-kernel-dev-2e733b3f84fa9c2ae60513c5f7b56d599ed2ae02.zip
op-kernel-dev-2e733b3f84fa9c2ae60513c5f7b56d599ed2ae02.tar.gz
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>
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r--arch/sh/kernel/clkdev.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/sh/kernel/clkdev.c b/arch/sh/kernel/clkdev.c
index 29cd802..defdd6e 100644
--- a/arch/sh/kernel/clkdev.c
+++ b/arch/sh/kernel/clkdev.c
@@ -20,6 +20,9 @@
#include <linux/string.h>
#include <linux/mutex.h>
#include <linux/clk.h>
+#include <linux/slab.h>
+#include <linux/bootmem.h>
+#include <linux/mm.h>
#include <asm/clock.h>
#include <asm/clkdev.h>
@@ -103,12 +106,16 @@ struct clk_lookup_alloc {
char con_id[MAX_CON_ID];
};
-struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
- const char *dev_fmt, ...)
+struct clk_lookup * __init_refok
+clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...)
{
struct clk_lookup_alloc *cla;
- cla = kzalloc(sizeof(*cla), GFP_KERNEL);
+ if (!slab_is_available())
+ cla = alloc_bootmem_low_pages(sizeof(*cla));
+ else
+ cla = kzalloc(sizeof(*cla), GFP_KERNEL);
+
if (!cla)
return NULL;
OpenPOWER on IntegriCloud