diff options
author | Jean-Christop PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2010-11-17 04:04:33 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-11-26 05:51:04 -0500 |
commit | 6d803ba736abb5e122dede70a4720e4843dd6df4 (patch) | |
tree | 6d01199e41ede3ae3931664f7bd10a68dbcc42e6 /arch/sh/include | |
parent | 64d2dc384e41e2b7acead6804593ddaaf8aad8e1 (diff) |
ARM: 6483/1: arm & sh: factorised duplicated clkdev.c
factorise some generic infrastructure to assist looking up struct clks
for the ARM & SH architecture.
as the code is identical at 99%
put the arch specific code for allocation as example in asm/clkdev.h
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/sh/include')
-rw-r--r-- | arch/sh/include/asm/clkdev.h | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/arch/sh/include/asm/clkdev.h b/arch/sh/include/asm/clkdev.h index 5645f358128..6ba91868201 100644 --- a/arch/sh/include/asm/clkdev.h +++ b/arch/sh/include/asm/clkdev.h | |||
@@ -1,9 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * arch/sh/include/asm/clkdev.h | 2 | * Copyright (C) 2010 Paul Mundt <lethal@linux-sh.org> |
3 | * | ||
4 | * Cloned from arch/arm/include/asm/clkdev.h: | ||
5 | * | ||
6 | * Copyright (C) 2008 Russell King. | ||
7 | * | 3 | * |
8 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 5 | * it under the terms of the GNU General Public License version 2 as |
@@ -11,25 +7,25 @@ | |||
11 | * | 7 | * |
12 | * Helper for the clk API to assist looking up a struct clk. | 8 | * Helper for the clk API to assist looking up a struct clk. |
13 | */ | 9 | */ |
14 | #ifndef __ASM_CLKDEV_H | ||
15 | #define __ASM_CLKDEV_H | ||
16 | 10 | ||
17 | struct clk; | 11 | #ifndef __CLKDEV__H_ |
12 | #define __CLKDEV__H_ | ||
18 | 13 | ||
19 | struct clk_lookup { | 14 | #include <linux/bootmem.h> |
20 | struct list_head node; | 15 | #include <linux/mm.h> |
21 | const char *dev_id; | 16 | #include <linux/slab.h> |
22 | const char *con_id; | ||
23 | struct clk *clk; | ||
24 | }; | ||
25 | 17 | ||
26 | struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, | 18 | #include <asm/clock.h> |
27 | const char *dev_fmt, ...); | ||
28 | 19 | ||
29 | void clkdev_add(struct clk_lookup *cl); | 20 | static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size) |
30 | void clkdev_drop(struct clk_lookup *cl); | 21 | { |
22 | if (!slab_is_available()) | ||
23 | return alloc_bootmem_low_pages(size); | ||
24 | else | ||
25 | return kzalloc(size, GFP_KERNEL); | ||
26 | } | ||
31 | 27 | ||
32 | void clkdev_add_table(struct clk_lookup *, size_t); | 28 | #define __clk_put(clk) |
33 | int clk_add_alias(const char *, const char *, char *, struct device *); | 29 | #define __clk_get(clk) ({ 1; }) |
34 | 30 | ||
35 | #endif | 31 | #endif /* __CLKDEV_H__ */ |