kernel: update linux 3.9 to 3.9.8
[openwrt/svn-archive/archive.git] / target / linux / ramips / patches-3.9 / 0141-clocksource-make-clocksource_of_init-pass-a-device_n.patch
1 From ec2ed8cdbe8b3d24261f0d88eb039e9d71e5d588 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Thu, 23 May 2013 16:58:12 +0200
4 Subject: [PATCH 141/164] clocksource: make clocksource_of_init() pass a
5 device_node pointer
6
7 If we look at the clocksources that are OF enabled we will notice, that they
8 all do a of_find_matching_node() when being called. This patch changes
9 clocksource_of_init() to always pass the struct device_node pointer to the
10 init function.
11
12 Signed-off-by: John Crispin <blogic@openwrt.org>
13 ---
14 drivers/clocksource/bcm2835_timer.c | 12 +-----------
15 drivers/clocksource/clksrc-of.c | 4 ++--
16 drivers/clocksource/tegra20_timer.c | 14 +-------------
17 drivers/clocksource/vt8500_timer.c | 14 +-------------
18 4 files changed, 5 insertions(+), 39 deletions(-)
19
20 --- a/drivers/clocksource/bcm2835_timer.c
21 +++ b/drivers/clocksource/bcm2835_timer.c
22 @@ -95,23 +95,13 @@ static irqreturn_t bcm2835_time_interrup
23 }
24 }
25
26 -static struct of_device_id bcm2835_time_match[] __initconst = {
27 - { .compatible = "brcm,bcm2835-system-timer" },
28 - {}
29 -};
30 -
31 -static void __init bcm2835_timer_init(void)
32 +static void __init bcm2835_timer_init(struct device_node *node)
33 {
34 - struct device_node *node;
35 void __iomem *base;
36 u32 freq;
37 int irq;
38 struct bcm2835_timer *timer;
39
40 - node = of_find_matching_node(NULL, bcm2835_time_match);
41 - if (!node)
42 - panic("No bcm2835 timer node");
43 -
44 base = of_iomap(node, 0);
45 if (!base)
46 panic("Can't remap registers");
47 --- a/drivers/clocksource/clksrc-of.c
48 +++ b/drivers/clocksource/clksrc-of.c
49 @@ -26,10 +26,10 @@ void __init clocksource_of_init(void)
50 {
51 struct device_node *np;
52 const struct of_device_id *match;
53 - void (*init_func)(void);
54 + void (*init_func)(struct device_node *);
55
56 for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
57 init_func = match->data;
58 - init_func();
59 + init_func(np);
60 }
61 }
62 --- a/drivers/clocksource/tegra20_timer.c
63 +++ b/drivers/clocksource/tegra20_timer.c
64 @@ -154,29 +154,17 @@ static struct irqaction tegra_timer_irq
65 .dev_id = &tegra_clockevent,
66 };
67
68 -static const struct of_device_id timer_match[] __initconst = {
69 - { .compatible = "nvidia,tegra20-timer" },
70 - {}
71 -};
72 -
73 static const struct of_device_id rtc_match[] __initconst = {
74 { .compatible = "nvidia,tegra20-rtc" },
75 {}
76 };
77
78 -static void __init tegra20_init_timer(void)
79 +static void __init tegra20_init_timer(struct device_node *np)
80 {
81 - struct device_node *np;
82 struct clk *clk;
83 unsigned long rate;
84 int ret;
85
86 - np = of_find_matching_node(NULL, timer_match);
87 - if (!np) {
88 - pr_err("Failed to find timer DT node\n");
89 - BUG();
90 - }
91 -
92 timer_reg_base = of_iomap(np, 0);
93 if (!timer_reg_base) {
94 pr_err("Can't map timer registers\n");
95 --- a/drivers/clocksource/vt8500_timer.c
96 +++ b/drivers/clocksource/vt8500_timer.c
97 @@ -129,22 +129,10 @@ static struct irqaction irq = {
98 .dev_id = &clockevent,
99 };
100
101 -static struct of_device_id vt8500_timer_ids[] = {
102 - { .compatible = "via,vt8500-timer" },
103 - { }
104 -};
105 -
106 -static void __init vt8500_timer_init(void)
107 +static void __init vt8500_timer_init(struct device_node *np)
108 {
109 - struct device_node *np;
110 int timer_irq;
111
112 - np = of_find_matching_node(NULL, vt8500_timer_ids);
113 - if (!np) {
114 - pr_err("%s: Timer description missing from Device Tree\n",
115 - __func__);
116 - return;
117 - }
118 regbase = of_iomap(np, 0);
119 if (!regbase) {
120 pr_err("%s: Missing iobase description in Device Tree\n",