sh: use kzalloc() for cpg clocks
authorMagnus Damm <damm@igel.co.jp>
Wed, 17 Jun 2009 04:55:42 +0000 (04:55 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 17 Jun 2009 06:39:53 +0000 (15:39 +0900)
Convert the shared clock cpg code from bootmem to slab.
Without this patch the current bootmem code triggers
WARN_ON() because the slab is available.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/kernel/cpu/clock-cpg.c

index 275942e..6dfe2cc 100644 (file)
@@ -1,6 +1,6 @@
 #include <linux/clk.h>
 #include <linux/compiler.h>
-#include <linux/bootmem.h>
+#include <linux/slab.h>
 #include <linux/io.h>
 #include <asm/clock.h>
 
@@ -127,10 +127,11 @@ int __init sh_clk_div6_register(struct clk *clks, int nr)
        int k;
 
        freq_table_size *= (nr_divs + 1);
-
-       freq_table = alloc_bootmem(freq_table_size * nr);
-       if (!freq_table)
+       freq_table = kzalloc(freq_table_size * nr, GFP_KERNEL);
+       if (!freq_table) {
+               pr_err("sh_clk_div6_register: unable to alloc memory\n");
                return -ENOMEM;
+       }
 
        for (k = 0; !ret && (k < nr); k++) {
                clkp = clks + k;
@@ -175,10 +176,11 @@ int __init sh_clk_div4_register(struct clk *clks, int nr,
        int k;
 
        freq_table_size *= (nr_divs + 1);
-
-       freq_table = alloc_bootmem(freq_table_size * nr);
-       if (!freq_table)
+       freq_table = kzalloc(freq_table_size * nr, GFP_KERNEL);
+       if (!freq_table) {
+               pr_err("sh_clk_div4_register: unable to alloc memory\n");
                return -ENOMEM;
+       }
 
        for (k = 0; !ret && (k < nr); k++) {
                clkp = clks + k;