From: Paul Mundt Date: Mon, 8 Mar 2010 12:46:37 +0000 (+0900) Subject: sh: Support early clkdev allocations. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2e733b3f84fa9c2ae60513c5f7b56d599ed2ae02;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git 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 --- 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 @@ #include #include #include +#include +#include +#include #include #include @@ -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;