Skip to content

Commit effbfdd

Browse files
author
Rob Herring
committed
clocksource: pass DT node pointer to init functions
In cases where we have multiple nodes of the same type, we may need the node pointer to know which node was matched. Passing the node pointer also keeps the init function from having to match the node a 2nd time. Update bcm2835, vt8500, and tegra20 init functions for the new function prototype. Further tegra20 clean-ups are in follow-up commit. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Cc: John Stultz <johnstul@us.ibm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Tony Prisk <linux@prisktech.co.nz> Tested-by: Michal Simek <michal.simek@xilinx.com>
1 parent e0c2536 commit effbfdd

4 files changed

Lines changed: 5 additions & 28 deletions

File tree

‎drivers/clocksource/bcm2835_timer.c‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,13 @@ static irqreturn_t bcm2835_time_interrupt(int irq, void *dev_id)
9595
}
9696
}
9797

98-
static struct of_device_id bcm2835_time_match[] __initconst = {
99-
{ .compatible = "brcm,bcm2835-system-timer" },
100-
{}
101-
};
102-
103-
static void __init bcm2835_timer_init(void)
98+
static void __init bcm2835_timer_init(struct device_node *node)
10499
{
105-
struct device_node *node;
106100
void __iomem *base;
107101
u32 freq;
108102
int irq;
109103
struct bcm2835_timer *timer;
110104

111-
node = of_find_matching_node(NULL, bcm2835_time_match);
112-
if (!node)
113-
panic("No bcm2835 timer node");
114-
115105
base = of_iomap(node, 0);
116106
if (!base)
117107
panic("Can't remap registers");

‎drivers/clocksource/clksrc-of.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ void __init clocksource_of_init(void)
2626
{
2727
struct device_node *np;
2828
const struct of_device_id *match;
29-
void (*init_func)(void);
29+
void (*init_func)(struct device_node *);
3030

3131
for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
3232
init_func = match->data;
33-
init_func();
33+
init_func(np);
3434
}
3535
}

‎drivers/clocksource/tegra20_timer.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,8 @@ static const struct of_device_id rtc_match[] __initconst = {
164164
{}
165165
};
166166

167-
static void __init tegra20_init_timer(void)
167+
static void __init tegra20_init_timer(struct device_node *np)
168168
{
169-
struct device_node *np;
170169
struct clk *clk;
171170
unsigned long rate;
172171
int ret;

‎drivers/clocksource/vt8500_timer.c‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,10 @@ static struct irqaction irq = {
129129
.dev_id = &clockevent,
130130
};
131131

132-
static struct of_device_id vt8500_timer_ids[] = {
133-
{ .compatible = "via,vt8500-timer" },
134-
{ }
135-
};
136-
137-
static void __init vt8500_timer_init(void)
132+
static void __init vt8500_timer_init(struct device_node *np)
138133
{
139-
struct device_node *np;
140134
int timer_irq;
141135

142-
np = of_find_matching_node(NULL, vt8500_timer_ids);
143-
if (!np) {
144-
pr_err("%s: Timer description missing from Device Tree\n",
145-
__func__);
146-
return;
147-
}
148136
regbase = of_iomap(np, 0);
149137
if (!regbase) {
150138
pr_err("%s: Missing iobase description in Device Tree\n",

0 commit comments

Comments
 (0)