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>
This commit is contained in:
parent
51a5006afc
commit
2e733b3f84
1 changed files with 10 additions and 3 deletions
|
@ -20,6 +20,9 @@
|
||||||
#include <linux/string.h>
|
#include <linux/string.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
#include <linux/bootmem.h>
|
||||||
|
#include <linux/mm.h>
|
||||||
#include <asm/clock.h>
|
#include <asm/clock.h>
|
||||||
#include <asm/clkdev.h>
|
#include <asm/clkdev.h>
|
||||||
|
|
||||||
|
@ -103,12 +106,16 @@ struct clk_lookup_alloc {
|
||||||
char con_id[MAX_CON_ID];
|
char con_id[MAX_CON_ID];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
|
struct clk_lookup * __init_refok
|
||||||
const char *dev_fmt, ...)
|
clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...)
|
||||||
{
|
{
|
||||||
struct clk_lookup_alloc *cla;
|
struct clk_lookup_alloc *cla;
|
||||||
|
|
||||||
|
if (!slab_is_available())
|
||||||
|
cla = alloc_bootmem_low_pages(sizeof(*cla));
|
||||||
|
else
|
||||||
cla = kzalloc(sizeof(*cla), GFP_KERNEL);
|
cla = kzalloc(sizeof(*cla), GFP_KERNEL);
|
||||||
|
|
||||||
if (!cla)
|
if (!cla)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue