@@ -231,34 +231,6 @@ static void apbt_restart_clocksource(struct clocksource *cs)
231231 apbt_start_counter (phy_cs_timer_id );
232232}
233233
234- /* Setup IRQ routing via IOAPIC */
235- #ifdef CONFIG_SMP
236- static void apbt_setup_irq (struct apbt_dev * adev )
237- {
238- struct irq_chip * chip ;
239- struct irq_desc * desc ;
240-
241- /* timer0 irq has been setup early */
242- if (adev -> irq == 0 )
243- return ;
244- desc = irq_to_desc (adev -> irq );
245- chip = get_irq_chip (adev -> irq );
246- disable_irq (adev -> irq );
247- desc -> status |= IRQ_MOVE_PCNTXT ;
248- irq_set_affinity (adev -> irq , cpumask_of (adev -> cpu ));
249- /* APB timer irqs are set up as mp_irqs, timer is edge triggerred */
250- set_irq_chip_and_handler_name (adev -> irq , chip , handle_edge_irq , "edge" );
251- enable_irq (adev -> irq );
252- if (system_state == SYSTEM_BOOTING )
253- if (request_irq (adev -> irq , apbt_interrupt_handler ,
254- IRQF_TIMER | IRQF_DISABLED | IRQF_NOBALANCING ,
255- adev -> name , adev )) {
256- printk (KERN_ERR "Failed request IRQ for APBT%d\n" ,
257- adev -> num );
258- }
259- }
260- #endif
261-
262234static void apbt_enable_int (int n )
263235{
264236 unsigned long ctrl = apbt_readl (n , APBTMR_N_CONTROL );
@@ -334,6 +306,27 @@ static int __init apbt_clockevent_register(void)
334306}
335307
336308#ifdef CONFIG_SMP
309+
310+ static void apbt_setup_irq (struct apbt_dev * adev )
311+ {
312+ /* timer0 irq has been setup early */
313+ if (adev -> irq == 0 )
314+ return ;
315+
316+ if (system_state == SYSTEM_BOOTING ) {
317+ irq_modify_status (adev -> irq , 0 , IRQ_MOVE_PCNTXT );
318+ /* APB timer irqs are set up as mp_irqs, timer is edge type */
319+ __set_irq_handler (adev -> irq , handle_edge_irq , 0 , "edge" );
320+ if (request_irq (adev -> irq , apbt_interrupt_handler ,
321+ IRQF_TIMER | IRQF_DISABLED | IRQF_NOBALANCING ,
322+ adev -> name , adev )) {
323+ printk (KERN_ERR "Failed request IRQ for APBT%d\n" ,
324+ adev -> num );
325+ }
326+ } else
327+ enable_irq (adev -> irq );
328+ }
329+
337330/* Should be called with per cpu */
338331void apbt_setup_secondary_clock (void )
339332{
@@ -389,10 +382,11 @@ static int apbt_cpuhp_notify(struct notifier_block *n,
389382
390383 switch (action & 0xf ) {
391384 case CPU_DEAD :
385+ disable_irq (adev -> irq );
392386 apbt_disable_int (cpu );
393- if (system_state == SYSTEM_RUNNING )
387+ if (system_state == SYSTEM_RUNNING ) {
394388 pr_debug ("skipping APBT CPU %lu offline\n" , cpu );
395- else if (adev ) {
389+ } else if (adev ) {
396390 pr_debug ("APBT clockevent for cpu %lu offline\n" , cpu );
397391 free_irq (adev -> irq , adev );
398392 }
0 commit comments