0141-clocksource-make-clocksource_of_init-pass-a-device_n.patch 3.4 KB

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