diff options
author | Kees Cook <keescook@chromium.org> | 2017-10-19 17:24:01 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-11-02 18:50:33 -0400 |
commit | 2c513d4f7da7d5616d9e19232376edd4e18fef24 (patch) | |
tree | 410fbf45c3eecee4e03477566d42182d26db0e8d | |
parent | d8479a21a98baf1bb50426986d15605cee96ec36 (diff) |
ia64: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.
One less trivial change was removing the repeated casting for callers
of bte_error_handler() by fixing its function declaration and adding a
small wrapper for the timer callback instead.
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-ia64@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r-- | arch/ia64/include/asm/sn/bte.h | 4 | ||||
-rw-r--r-- | arch/ia64/kernel/mca.c | 8 | ||||
-rw-r--r-- | arch/ia64/kernel/salinfo.c | 5 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/bte.c | 12 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/bte_error.c | 17 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/huberror.c | 2 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/mca.c | 5 |
7 files changed, 26 insertions, 27 deletions
diff --git a/arch/ia64/include/asm/sn/bte.h b/arch/ia64/include/asm/sn/bte.h index cc6c4dbf53af..cd71ab5faf62 100644 --- a/arch/ia64/include/asm/sn/bte.h +++ b/arch/ia64/include/asm/sn/bte.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <asm/sn/types.h> | 17 | #include <asm/sn/types.h> |
18 | #include <asm/sn/shub_mmr.h> | 18 | #include <asm/sn/shub_mmr.h> |
19 | 19 | ||
20 | struct nodepda_s; | ||
21 | |||
20 | #define IBCT_NOTIFY (0x1UL << 4) | 22 | #define IBCT_NOTIFY (0x1UL << 4) |
21 | #define IBCT_ZFIL_MODE (0x1UL << 0) | 23 | #define IBCT_ZFIL_MODE (0x1UL << 0) |
22 | 24 | ||
@@ -210,7 +212,7 @@ struct bteinfo_s { | |||
210 | */ | 212 | */ |
211 | extern bte_result_t bte_copy(u64, u64, u64, u64, void *); | 213 | extern bte_result_t bte_copy(u64, u64, u64, u64, void *); |
212 | extern bte_result_t bte_unaligned_copy(u64, u64, u64, u64); | 214 | extern bte_result_t bte_unaligned_copy(u64, u64, u64, u64); |
213 | extern void bte_error_handler(unsigned long); | 215 | extern void bte_error_handler(struct nodepda_s *); |
214 | 216 | ||
215 | #define bte_zero(dest, len, mode, notification) \ | 217 | #define bte_zero(dest, len, mode, notification) \ |
216 | bte_copy(0, dest, len, ((mode) | BTE_ZERO_FILL), notification) | 218 | bte_copy(0, dest, len, ((mode) | BTE_ZERO_FILL), notification) |
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c index 555b11180156..6115464d5f03 100644 --- a/arch/ia64/kernel/mca.c +++ b/arch/ia64/kernel/mca.c | |||
@@ -1513,7 +1513,7 @@ ia64_mca_cmc_int_caller(int cmc_irq, void *arg) | |||
1513 | * | 1513 | * |
1514 | */ | 1514 | */ |
1515 | static void | 1515 | static void |
1516 | ia64_mca_cmc_poll (unsigned long dummy) | 1516 | ia64_mca_cmc_poll (struct timer_list *unused) |
1517 | { | 1517 | { |
1518 | /* Trigger a CMC interrupt cascade */ | 1518 | /* Trigger a CMC interrupt cascade */ |
1519 | platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CMCP_VECTOR, | 1519 | platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CMCP_VECTOR, |
@@ -1590,7 +1590,7 @@ ia64_mca_cpe_int_caller(int cpe_irq, void *arg) | |||
1590 | * | 1590 | * |
1591 | */ | 1591 | */ |
1592 | static void | 1592 | static void |
1593 | ia64_mca_cpe_poll (unsigned long dummy) | 1593 | ia64_mca_cpe_poll (struct timer_list *unused) |
1594 | { | 1594 | { |
1595 | /* Trigger a CPE interrupt cascade */ | 1595 | /* Trigger a CPE interrupt cascade */ |
1596 | platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CPEP_VECTOR, | 1596 | platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CPEP_VECTOR, |
@@ -2098,7 +2098,7 @@ ia64_mca_late_init(void) | |||
2098 | return 0; | 2098 | return 0; |
2099 | 2099 | ||
2100 | /* Setup the CMCI/P vector and handler */ | 2100 | /* Setup the CMCI/P vector and handler */ |
2101 | setup_timer(&cmc_poll_timer, ia64_mca_cmc_poll, 0UL); | 2101 | timer_setup(&cmc_poll_timer, ia64_mca_cmc_poll, 0); |
2102 | 2102 | ||
2103 | /* Unmask/enable the vector */ | 2103 | /* Unmask/enable the vector */ |
2104 | cmc_polling_enabled = 0; | 2104 | cmc_polling_enabled = 0; |
@@ -2109,7 +2109,7 @@ ia64_mca_late_init(void) | |||
2109 | #ifdef CONFIG_ACPI | 2109 | #ifdef CONFIG_ACPI |
2110 | /* Setup the CPEI/P vector and handler */ | 2110 | /* Setup the CPEI/P vector and handler */ |
2111 | cpe_vector = acpi_request_vector(ACPI_INTERRUPT_CPEI); | 2111 | cpe_vector = acpi_request_vector(ACPI_INTERRUPT_CPEI); |
2112 | setup_timer(&cpe_poll_timer, ia64_mca_cpe_poll, 0UL); | 2112 | timer_setup(&cpe_poll_timer, ia64_mca_cpe_poll, 0); |
2113 | 2113 | ||
2114 | { | 2114 | { |
2115 | unsigned int irq; | 2115 | unsigned int irq; |
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c index 63dc9cdc95c5..52c404b08904 100644 --- a/arch/ia64/kernel/salinfo.c +++ b/arch/ia64/kernel/salinfo.c | |||
@@ -263,7 +263,7 @@ salinfo_timeout_check(struct salinfo_data *data) | |||
263 | } | 263 | } |
264 | 264 | ||
265 | static void | 265 | static void |
266 | salinfo_timeout (unsigned long arg) | 266 | salinfo_timeout(struct timer_list *unused) |
267 | { | 267 | { |
268 | ia64_mlogbuf_dump(); | 268 | ia64_mlogbuf_dump(); |
269 | salinfo_timeout_check(salinfo_data + SAL_INFO_TYPE_MCA); | 269 | salinfo_timeout_check(salinfo_data + SAL_INFO_TYPE_MCA); |
@@ -623,9 +623,8 @@ salinfo_init(void) | |||
623 | 623 | ||
624 | *sdir++ = salinfo_dir; | 624 | *sdir++ = salinfo_dir; |
625 | 625 | ||
626 | init_timer(&salinfo_timer); | 626 | timer_setup(&salinfo_timer, salinfo_timeout, 0); |
627 | salinfo_timer.expires = jiffies + SALINFO_TIMER_DELAY; | 627 | salinfo_timer.expires = jiffies + SALINFO_TIMER_DELAY; |
628 | salinfo_timer.function = &salinfo_timeout; | ||
629 | add_timer(&salinfo_timer); | 628 | add_timer(&salinfo_timer); |
630 | 629 | ||
631 | i = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "ia64/salinfo:online", | 630 | i = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "ia64/salinfo:online", |
diff --git a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c index b2eb48490754..9146192b86f5 100644 --- a/arch/ia64/sn/kernel/bte.c +++ b/arch/ia64/sn/kernel/bte.c | |||
@@ -219,7 +219,7 @@ retry_bteop: | |||
219 | BTE_LNSTAT_LOAD(bte), *bte->most_rcnt_na) ); | 219 | BTE_LNSTAT_LOAD(bte), *bte->most_rcnt_na) ); |
220 | bte->bte_error_count++; | 220 | bte->bte_error_count++; |
221 | bte->bh_error = IBLS_ERROR; | 221 | bte->bh_error = IBLS_ERROR; |
222 | bte_error_handler((unsigned long)NODEPDA(bte->bte_cnode)); | 222 | bte_error_handler(NODEPDA(bte->bte_cnode)); |
223 | *bte->most_rcnt_na = BTE_WORD_AVAILABLE; | 223 | *bte->most_rcnt_na = BTE_WORD_AVAILABLE; |
224 | goto retry_bteop; | 224 | goto retry_bteop; |
225 | } | 225 | } |
@@ -414,6 +414,12 @@ EXPORT_SYMBOL(bte_unaligned_copy); | |||
414 | * Block Transfer Engine initialization functions. | 414 | * Block Transfer Engine initialization functions. |
415 | * | 415 | * |
416 | ***********************************************************************/ | 416 | ***********************************************************************/ |
417 | static void bte_recovery_timeout(struct timer_list *t) | ||
418 | { | ||
419 | struct nodepda_s *nodepda = from_timer(nodepda, t, bte_recovery_timer); | ||
420 | |||
421 | bte_error_handler(nodepda); | ||
422 | } | ||
417 | 423 | ||
418 | /* | 424 | /* |
419 | * bte_init_node(nodepda, cnode) | 425 | * bte_init_node(nodepda, cnode) |
@@ -436,9 +442,7 @@ void bte_init_node(nodepda_t * mynodepda, cnodeid_t cnode) | |||
436 | * will point at this one bte_recover structure to get the lock. | 442 | * will point at this one bte_recover structure to get the lock. |
437 | */ | 443 | */ |
438 | spin_lock_init(&mynodepda->bte_recovery_lock); | 444 | spin_lock_init(&mynodepda->bte_recovery_lock); |
439 | init_timer(&mynodepda->bte_recovery_timer); | 445 | timer_setup(&mynodepda->bte_recovery_timer, bte_recovery_timeout, 0); |
440 | mynodepda->bte_recovery_timer.function = bte_error_handler; | ||
441 | mynodepda->bte_recovery_timer.data = (unsigned long)mynodepda; | ||
442 | 446 | ||
443 | for (i = 0; i < BTES_PER_NODE; i++) { | 447 | for (i = 0; i < BTES_PER_NODE; i++) { |
444 | u64 *base_addr; | 448 | u64 *base_addr; |
diff --git a/arch/ia64/sn/kernel/bte_error.c b/arch/ia64/sn/kernel/bte_error.c index 4cb09f3f1efc..d92786c09b34 100644 --- a/arch/ia64/sn/kernel/bte_error.c +++ b/arch/ia64/sn/kernel/bte_error.c | |||
@@ -27,15 +27,12 @@ | |||
27 | * transfers to be queued. | 27 | * transfers to be queued. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | void bte_error_handler(unsigned long); | ||
31 | |||
32 | /* | 30 | /* |
33 | * Wait until all BTE related CRBs are completed | 31 | * Wait until all BTE related CRBs are completed |
34 | * and then reset the interfaces. | 32 | * and then reset the interfaces. |
35 | */ | 33 | */ |
36 | int shub1_bte_error_handler(unsigned long _nodepda) | 34 | static int shub1_bte_error_handler(struct nodepda_s *err_nodepda) |
37 | { | 35 | { |
38 | struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda; | ||
39 | struct timer_list *recovery_timer = &err_nodepda->bte_recovery_timer; | 36 | struct timer_list *recovery_timer = &err_nodepda->bte_recovery_timer; |
40 | nasid_t nasid; | 37 | nasid_t nasid; |
41 | int i; | 38 | int i; |
@@ -131,9 +128,8 @@ int shub1_bte_error_handler(unsigned long _nodepda) | |||
131 | * Wait until all BTE related CRBs are completed | 128 | * Wait until all BTE related CRBs are completed |
132 | * and then reset the interfaces. | 129 | * and then reset the interfaces. |
133 | */ | 130 | */ |
134 | int shub2_bte_error_handler(unsigned long _nodepda) | 131 | static int shub2_bte_error_handler(struct nodepda_s *err_nodepda) |
135 | { | 132 | { |
136 | struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda; | ||
137 | struct timer_list *recovery_timer = &err_nodepda->bte_recovery_timer; | 133 | struct timer_list *recovery_timer = &err_nodepda->bte_recovery_timer; |
138 | struct bteinfo_s *bte; | 134 | struct bteinfo_s *bte; |
139 | nasid_t nasid; | 135 | nasid_t nasid; |
@@ -170,9 +166,8 @@ int shub2_bte_error_handler(unsigned long _nodepda) | |||
170 | * Wait until all BTE related CRBs are completed | 166 | * Wait until all BTE related CRBs are completed |
171 | * and then reset the interfaces. | 167 | * and then reset the interfaces. |
172 | */ | 168 | */ |
173 | void bte_error_handler(unsigned long _nodepda) | 169 | void bte_error_handler(struct nodepda_s *err_nodepda) |
174 | { | 170 | { |
175 | struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda; | ||
176 | spinlock_t *recovery_lock = &err_nodepda->bte_recovery_lock; | 171 | spinlock_t *recovery_lock = &err_nodepda->bte_recovery_lock; |
177 | int i; | 172 | int i; |
178 | unsigned long irq_flags; | 173 | unsigned long irq_flags; |
@@ -199,12 +194,12 @@ void bte_error_handler(unsigned long _nodepda) | |||
199 | } | 194 | } |
200 | 195 | ||
201 | if (is_shub1()) { | 196 | if (is_shub1()) { |
202 | if (shub1_bte_error_handler(_nodepda)) { | 197 | if (shub1_bte_error_handler(err_nodepda)) { |
203 | spin_unlock_irqrestore(recovery_lock, irq_flags); | 198 | spin_unlock_irqrestore(recovery_lock, irq_flags); |
204 | return; | 199 | return; |
205 | } | 200 | } |
206 | } else { | 201 | } else { |
207 | if (shub2_bte_error_handler(_nodepda)) { | 202 | if (shub2_bte_error_handler(err_nodepda)) { |
208 | spin_unlock_irqrestore(recovery_lock, irq_flags); | 203 | spin_unlock_irqrestore(recovery_lock, irq_flags); |
209 | return; | 204 | return; |
210 | } | 205 | } |
@@ -255,6 +250,6 @@ bte_crb_error_handler(cnodeid_t cnode, int btenum, | |||
255 | 250 | ||
256 | BTE_PRINTK(("Got an error on cnode %d bte %d: HW error type 0x%x\n", | 251 | BTE_PRINTK(("Got an error on cnode %d bte %d: HW error type 0x%x\n", |
257 | bte->bte_cnode, bte->bte_num, ioe->ie_errortype)); | 252 | bte->bte_cnode, bte->bte_num, ioe->ie_errortype)); |
258 | bte_error_handler((unsigned long) NODEPDA(cnode)); | 253 | bte_error_handler(NODEPDA(cnode)); |
259 | } | 254 | } |
260 | 255 | ||
diff --git a/arch/ia64/sn/kernel/huberror.c b/arch/ia64/sn/kernel/huberror.c index f925dec2da92..97fa56dddf50 100644 --- a/arch/ia64/sn/kernel/huberror.c +++ b/arch/ia64/sn/kernel/huberror.c | |||
@@ -50,7 +50,7 @@ static irqreturn_t hub_eint_handler(int irq, void *arg) | |||
50 | if ((int)ret_stuff.v0) | 50 | if ((int)ret_stuff.v0) |
51 | panic("%s: Fatal TIO Error", __func__); | 51 | panic("%s: Fatal TIO Error", __func__); |
52 | } else | 52 | } else |
53 | bte_error_handler((unsigned long)NODEPDA(nasid_to_cnodeid(nasid))); | 53 | bte_error_handler(NODEPDA(nasid_to_cnodeid(nasid))); |
54 | 54 | ||
55 | return IRQ_HANDLED; | 55 | return IRQ_HANDLED; |
56 | } | 56 | } |
diff --git a/arch/ia64/sn/kernel/mca.c b/arch/ia64/sn/kernel/mca.c index 5b799d4deb74..bc3bd930c74c 100644 --- a/arch/ia64/sn/kernel/mca.c +++ b/arch/ia64/sn/kernel/mca.c | |||
@@ -72,7 +72,7 @@ static void sn_cpei_handler(int irq, void *devid, struct pt_regs *regs) | |||
72 | ia64_sn_plat_cpei_handler(); | 72 | ia64_sn_plat_cpei_handler(); |
73 | } | 73 | } |
74 | 74 | ||
75 | static void sn_cpei_timer_handler(unsigned long dummy) | 75 | static void sn_cpei_timer_handler(struct timer_list *unused) |
76 | { | 76 | { |
77 | sn_cpei_handler(-1, NULL, NULL); | 77 | sn_cpei_handler(-1, NULL, NULL); |
78 | mod_timer(&sn_cpei_timer, jiffies + CPEI_INTERVAL); | 78 | mod_timer(&sn_cpei_timer, jiffies + CPEI_INTERVAL); |
@@ -80,9 +80,8 @@ static void sn_cpei_timer_handler(unsigned long dummy) | |||
80 | 80 | ||
81 | void sn_init_cpei_timer(void) | 81 | void sn_init_cpei_timer(void) |
82 | { | 82 | { |
83 | init_timer(&sn_cpei_timer); | 83 | timer_setup(&sn_cpei_timer, sn_cpei_timer_handler, 0); |
84 | sn_cpei_timer.expires = jiffies + CPEI_INTERVAL; | 84 | sn_cpei_timer.expires = jiffies + CPEI_INTERVAL; |
85 | sn_cpei_timer.function = sn_cpei_timer_handler; | ||
86 | add_timer(&sn_cpei_timer); | 85 | add_timer(&sn_cpei_timer); |
87 | } | 86 | } |
88 | 87 | ||