aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-24 14:09:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-24 14:09:47 -0400
commita75eda7bce5e8ffdebe6ddfe513b31e5ec3527d2 (patch)
treee2539a59258b863aa9c6cf95cd8d9cd9f75ed6b9
parentf6cc519b6aed437d61ca19c0e0031553925ff257 (diff)
parent2a6a8e2d9004b5303fcb494588ba3a3b87a256c3 (diff)
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Thomas Gleixner: "A set of small fixes plus the removal of stale board support code: - Remove the board support code from the clpx711x clocksource driver. This change had fallen through the cracks and I'm sending it now rather than dealing with people who want to improve that stale code for 3 month. - Use the proper clocksource mask on RICSV - Make local scope functions and variables static" * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: clocksource/drivers/clps711x: Remove board support clocksource/drivers/riscv: Fix clocksource mask clocksource/drivers/mips-gic-timer: Make gic_compare_irqaction static clocksource/drivers/timer-ti-dm: Make omap_dm_timer_set_load_start() static clocksource/drivers/tcb_clksrc: Make tc_clksrc_suspend/resume() static clocksource/drivers/clps711x: Make clps711x_clksrc_init() static time/jiffies: Make refined_jiffies static
-rw-r--r--drivers/clocksource/clps711x-timer.c44
-rw-r--r--drivers/clocksource/mips-gic-timer.c2
-rw-r--r--drivers/clocksource/tcb_clksrc.c4
-rw-r--r--drivers/clocksource/timer-riscv.c5
-rw-r--r--drivers/clocksource/timer-ti-dm.c4
-rw-r--r--kernel/time/jiffies.c2
6 files changed, 21 insertions, 40 deletions
diff --git a/drivers/clocksource/clps711x-timer.c b/drivers/clocksource/clps711x-timer.c
index a8dd80576c95..857f8c086274 100644
--- a/drivers/clocksource/clps711x-timer.c
+++ b/drivers/clocksource/clps711x-timer.c
@@ -31,16 +31,9 @@ static u64 notrace clps711x_sched_clock_read(void)
31 return ~readw(tcd); 31 return ~readw(tcd);
32} 32}
33 33
34static int __init _clps711x_clksrc_init(struct clk *clock, void __iomem *base) 34static void __init clps711x_clksrc_init(struct clk *clock, void __iomem *base)
35{ 35{
36 unsigned long rate; 36 unsigned long rate = clk_get_rate(clock);
37
38 if (!base)
39 return -ENOMEM;
40 if (IS_ERR(clock))
41 return PTR_ERR(clock);
42
43 rate = clk_get_rate(clock);
44 37
45 tcd = base; 38 tcd = base;
46 39
@@ -48,8 +41,6 @@ static int __init _clps711x_clksrc_init(struct clk *clock, void __iomem *base)
48 clocksource_mmio_readw_down); 41 clocksource_mmio_readw_down);
49 42
50 sched_clock_register(clps711x_sched_clock_read, 16, rate); 43 sched_clock_register(clps711x_sched_clock_read, 16, rate);
51
52 return 0;
53} 44}
54 45
55static irqreturn_t clps711x_timer_interrupt(int irq, void *dev_id) 46static irqreturn_t clps711x_timer_interrupt(int irq, void *dev_id)
@@ -67,13 +58,6 @@ static int __init _clps711x_clkevt_init(struct clk *clock, void __iomem *base,
67 struct clock_event_device *clkevt; 58 struct clock_event_device *clkevt;
68 unsigned long rate; 59 unsigned long rate;
69 60
70 if (!irq)
71 return -EINVAL;
72 if (!base)
73 return -ENOMEM;
74 if (IS_ERR(clock))
75 return PTR_ERR(clock);
76
77 clkevt = kzalloc(sizeof(*clkevt), GFP_KERNEL); 61 clkevt = kzalloc(sizeof(*clkevt), GFP_KERNEL);
78 if (!clkevt) 62 if (!clkevt)
79 return -ENOMEM; 63 return -ENOMEM;
@@ -93,31 +77,29 @@ static int __init _clps711x_clkevt_init(struct clk *clock, void __iomem *base,
93 "clps711x-timer", clkevt); 77 "clps711x-timer", clkevt);
94} 78}
95 79
96void __init clps711x_clksrc_init(void __iomem *tc1_base, void __iomem *tc2_base,
97 unsigned int irq)
98{
99 struct clk *tc1 = clk_get_sys("clps711x-timer.0", NULL);
100 struct clk *tc2 = clk_get_sys("clps711x-timer.1", NULL);
101
102 BUG_ON(_clps711x_clksrc_init(tc1, tc1_base));
103 BUG_ON(_clps711x_clkevt_init(tc2, tc2_base, irq));
104}
105
106#ifdef CONFIG_TIMER_OF
107static int __init clps711x_timer_init(struct device_node *np) 80static int __init clps711x_timer_init(struct device_node *np)
108{ 81{
109 unsigned int irq = irq_of_parse_and_map(np, 0); 82 unsigned int irq = irq_of_parse_and_map(np, 0);
110 struct clk *clock = of_clk_get(np, 0); 83 struct clk *clock = of_clk_get(np, 0);
111 void __iomem *base = of_iomap(np, 0); 84 void __iomem *base = of_iomap(np, 0);
112 85
86 if (!base)
87 return -ENOMEM;
88 if (!irq)
89 return -EINVAL;
90 if (IS_ERR(clock))
91 return PTR_ERR(clock);
92
113 switch (of_alias_get_id(np, "timer")) { 93 switch (of_alias_get_id(np, "timer")) {
114 case CLPS711X_CLKSRC_CLOCKSOURCE: 94 case CLPS711X_CLKSRC_CLOCKSOURCE:
115 return _clps711x_clksrc_init(clock, base); 95 clps711x_clksrc_init(clock, base);
96 break;
116 case CLPS711X_CLKSRC_CLOCKEVENT: 97 case CLPS711X_CLKSRC_CLOCKEVENT:
117 return _clps711x_clkevt_init(clock, base, irq); 98 return _clps711x_clkevt_init(clock, base, irq);
118 default: 99 default:
119 return -EINVAL; 100 return -EINVAL;
120 } 101 }
102
103 return 0;
121} 104}
122TIMER_OF_DECLARE(clps711x, "cirrus,ep7209-timer", clps711x_timer_init); 105TIMER_OF_DECLARE(clps711x, "cirrus,ep7209-timer", clps711x_timer_init);
123#endif
diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c
index 54f8a331b53a..37671a5d4ed9 100644
--- a/drivers/clocksource/mips-gic-timer.c
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -67,7 +67,7 @@ static irqreturn_t gic_compare_interrupt(int irq, void *dev_id)
67 return IRQ_HANDLED; 67 return IRQ_HANDLED;
68} 68}
69 69
70struct irqaction gic_compare_irqaction = { 70static struct irqaction gic_compare_irqaction = {
71 .handler = gic_compare_interrupt, 71 .handler = gic_compare_interrupt,
72 .percpu_dev_id = &gic_clockevent_device, 72 .percpu_dev_id = &gic_clockevent_device,
73 .flags = IRQF_PERCPU | IRQF_TIMER, 73 .flags = IRQF_PERCPU | IRQF_TIMER,
diff --git a/drivers/clocksource/tcb_clksrc.c b/drivers/clocksource/tcb_clksrc.c
index 43f4d5c4d6fa..f987027ca566 100644
--- a/drivers/clocksource/tcb_clksrc.c
+++ b/drivers/clocksource/tcb_clksrc.c
@@ -71,7 +71,7 @@ static u64 tc_get_cycles32(struct clocksource *cs)
71 return readl_relaxed(tcaddr + ATMEL_TC_REG(0, CV)); 71 return readl_relaxed(tcaddr + ATMEL_TC_REG(0, CV));
72} 72}
73 73
74void tc_clksrc_suspend(struct clocksource *cs) 74static void tc_clksrc_suspend(struct clocksource *cs)
75{ 75{
76 int i; 76 int i;
77 77
@@ -86,7 +86,7 @@ void tc_clksrc_suspend(struct clocksource *cs)
86 bmr_cache = readl(tcaddr + ATMEL_TC_BMR); 86 bmr_cache = readl(tcaddr + ATMEL_TC_BMR);
87} 87}
88 88
89void tc_clksrc_resume(struct clocksource *cs) 89static void tc_clksrc_resume(struct clocksource *cs)
90{ 90{
91 int i; 91 int i;
92 92
diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c
index e8163693e936..5e6038fbf115 100644
--- a/drivers/clocksource/timer-riscv.c
+++ b/drivers/clocksource/timer-riscv.c
@@ -58,7 +58,7 @@ static u64 riscv_sched_clock(void)
58static DEFINE_PER_CPU(struct clocksource, riscv_clocksource) = { 58static DEFINE_PER_CPU(struct clocksource, riscv_clocksource) = {
59 .name = "riscv_clocksource", 59 .name = "riscv_clocksource",
60 .rating = 300, 60 .rating = 300,
61 .mask = CLOCKSOURCE_MASK(BITS_PER_LONG), 61 .mask = CLOCKSOURCE_MASK(64),
62 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 62 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
63 .read = riscv_clocksource_rdtime, 63 .read = riscv_clocksource_rdtime,
64}; 64};
@@ -120,8 +120,7 @@ static int __init riscv_timer_init_dt(struct device_node *n)
120 return error; 120 return error;
121 } 121 }
122 122
123 sched_clock_register(riscv_sched_clock, 123 sched_clock_register(riscv_sched_clock, 64, riscv_timebase);
124 BITS_PER_LONG, riscv_timebase);
125 124
126 error = cpuhp_setup_state(CPUHP_AP_RISCV_TIMER_STARTING, 125 error = cpuhp_setup_state(CPUHP_AP_RISCV_TIMER_STARTING,
127 "clockevents/riscv/timer:starting", 126 "clockevents/riscv/timer:starting",
diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index c364027638e1..3352da6ed61f 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -586,8 +586,8 @@ static int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
586} 586}
587 587
588/* Optimized set_load which removes costly spin wait in timer_start */ 588/* Optimized set_load which removes costly spin wait in timer_start */
589int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, 589static int omap_dm_timer_set_load_start(struct omap_dm_timer *timer,
590 unsigned int load) 590 int autoreload, unsigned int load)
591{ 591{
592 u32 l; 592 u32 l;
593 593
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index dc1b6f1929f9..ac9c03dd6c7d 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -89,7 +89,7 @@ struct clocksource * __init __weak clocksource_default_clock(void)
89 return &clocksource_jiffies; 89 return &clocksource_jiffies;
90} 90}
91 91
92struct clocksource refined_jiffies; 92static struct clocksource refined_jiffies;
93 93
94int register_refined_jiffies(long cycles_per_second) 94int register_refined_jiffies(long cycles_per_second)
95{ 95{