123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- From ec2ed8cdbe8b3d24261f0d88eb039e9d71e5d588 Mon Sep 17 00:00:00 2001
- From: John Crispin <[email protected]>
- Date: Thu, 23 May 2013 16:58:12 +0200
- Subject: [PATCH 141/164] clocksource: make clocksource_of_init() pass a
- device_node pointer
- If we look at the clocksources that are OF enabled we will notice, that they
- all do a of_find_matching_node() when being called. This patch changes
- clocksource_of_init() to always pass the struct device_node pointer to the
- init function.
- Signed-off-by: John Crispin <[email protected]>
- ---
- drivers/clocksource/bcm2835_timer.c | 12 +-----------
- drivers/clocksource/clksrc-of.c | 4 ++--
- drivers/clocksource/tegra20_timer.c | 14 +-------------
- drivers/clocksource/vt8500_timer.c | 14 +-------------
- 4 files changed, 5 insertions(+), 39 deletions(-)
- --- a/drivers/clocksource/bcm2835_timer.c
- +++ b/drivers/clocksource/bcm2835_timer.c
- @@ -95,23 +95,13 @@ static irqreturn_t bcm2835_time_interrup
- }
- }
-
- -static struct of_device_id bcm2835_time_match[] __initconst = {
- - { .compatible = "brcm,bcm2835-system-timer" },
- - {}
- -};
- -
- -static void __init bcm2835_timer_init(void)
- +static void __init bcm2835_timer_init(struct device_node *node)
- {
- - struct device_node *node;
- void __iomem *base;
- u32 freq;
- int irq;
- struct bcm2835_timer *timer;
-
- - node = of_find_matching_node(NULL, bcm2835_time_match);
- - if (!node)
- - panic("No bcm2835 timer node");
- -
- base = of_iomap(node, 0);
- if (!base)
- panic("Can't remap registers");
- --- a/drivers/clocksource/clksrc-of.c
- +++ b/drivers/clocksource/clksrc-of.c
- @@ -26,10 +26,10 @@ void __init clocksource_of_init(void)
- {
- struct device_node *np;
- const struct of_device_id *match;
- - void (*init_func)(void);
- + void (*init_func)(struct device_node *);
-
- for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
- init_func = match->data;
- - init_func();
- + init_func(np);
- }
- }
- --- a/drivers/clocksource/tegra20_timer.c
- +++ b/drivers/clocksource/tegra20_timer.c
- @@ -154,29 +154,17 @@ static struct irqaction tegra_timer_irq
- .dev_id = &tegra_clockevent,
- };
-
- -static const struct of_device_id timer_match[] __initconst = {
- - { .compatible = "nvidia,tegra20-timer" },
- - {}
- -};
- -
- static const struct of_device_id rtc_match[] __initconst = {
- { .compatible = "nvidia,tegra20-rtc" },
- {}
- };
-
- -static void __init tegra20_init_timer(void)
- +static void __init tegra20_init_timer(struct device_node *np)
- {
- - struct device_node *np;
- struct clk *clk;
- unsigned long rate;
- int ret;
-
- - np = of_find_matching_node(NULL, timer_match);
- - if (!np) {
- - pr_err("Failed to find timer DT node\n");
- - BUG();
- - }
- -
- timer_reg_base = of_iomap(np, 0);
- if (!timer_reg_base) {
- pr_err("Can't map timer registers\n");
- --- a/drivers/clocksource/vt8500_timer.c
- +++ b/drivers/clocksource/vt8500_timer.c
- @@ -129,22 +129,10 @@ static struct irqaction irq = {
- .dev_id = &clockevent,
- };
-
- -static struct of_device_id vt8500_timer_ids[] = {
- - { .compatible = "via,vt8500-timer" },
- - { }
- -};
- -
- -static void __init vt8500_timer_init(void)
- +static void __init vt8500_timer_init(struct device_node *np)
- {
- - struct device_node *np;
- int timer_irq;
-
- - np = of_find_matching_node(NULL, vt8500_timer_ids);
- - if (!np) {
- - pr_err("%s: Timer description missing from Device Tree\n",
- - __func__);
- - return;
- - }
- regbase = of_iomap(np, 0);
- if (!regbase) {
- pr_err("%s: Missing iobase description in Device Tree\n",
|