forked from mirrors/linux
		
	clocksource: Replace setup_irq() by request_irq()
request_irq() is preferred over setup_irq(). The early boot setup_irq() invocations happen either via 'init_IRQ()' or 'time_init()', while memory allocators are ready by 'mm_init()'. Per tglx[1], setup_irq() existed in olden days when allocators were not ready by the time early interrupts were initialized. Hence replace setup_irq() by request_irq(). Seldom remove_irq() usage has been observed coupled with setup_irq(), wherever that has been found, it too has been replaced by free_irq(). A build error that was reported by kbuild test robot <lkp@intel.com> in the previous version of the patch also has been fixed. [1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos Signed-off-by: afzal mohammed <afzal.mohd.ma@gmail.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/91961c77c1cf93d41523f5e1ac52043f32f97077.1582799709.git.afzal.mohd.ma@gmail.com
This commit is contained in:
		
							parent
							
								
									a7cd395521
								
							
						
					
					
						commit
						cc2550b421
					
				
					 23 changed files with 82 additions and 190 deletions
				
			
		|  | @ -31,7 +31,6 @@ struct bcm2835_timer { | ||||||
| 	void __iomem *compare; | 	void __iomem *compare; | ||||||
| 	int match_mask; | 	int match_mask; | ||||||
| 	struct clock_event_device evt; | 	struct clock_event_device evt; | ||||||
| 	struct irqaction act; |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static void __iomem *system_clock __read_mostly; | static void __iomem *system_clock __read_mostly; | ||||||
|  | @ -113,12 +112,9 @@ static int __init bcm2835_timer_init(struct device_node *node) | ||||||
| 	timer->evt.features = CLOCK_EVT_FEAT_ONESHOT; | 	timer->evt.features = CLOCK_EVT_FEAT_ONESHOT; | ||||||
| 	timer->evt.set_next_event = bcm2835_time_set_next_event; | 	timer->evt.set_next_event = bcm2835_time_set_next_event; | ||||||
| 	timer->evt.cpumask = cpumask_of(0); | 	timer->evt.cpumask = cpumask_of(0); | ||||||
| 	timer->act.name = node->name; |  | ||||||
| 	timer->act.flags = IRQF_TIMER | IRQF_SHARED; |  | ||||||
| 	timer->act.dev_id = timer; |  | ||||||
| 	timer->act.handler = bcm2835_time_interrupt; |  | ||||||
| 
 | 
 | ||||||
| 	ret = setup_irq(irq, &timer->act); | 	ret = request_irq(irq, bcm2835_time_interrupt, IRQF_TIMER | IRQF_SHARED, | ||||||
|  | 			  node->name, timer); | ||||||
| 	if (ret) { | 	if (ret) { | ||||||
| 		pr_err("Can't set up timer IRQ\n"); | 		pr_err("Can't set up timer IRQ\n"); | ||||||
| 		goto err_timer_free; | 		goto err_timer_free; | ||||||
|  |  | ||||||
|  | @ -160,12 +160,6 @@ static irqreturn_t kona_timer_interrupt(int irq, void *dev_id) | ||||||
| 	return IRQ_HANDLED; | 	return IRQ_HANDLED; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static struct irqaction kona_timer_irq = { |  | ||||||
| 	.name = "Kona Timer Tick", |  | ||||||
| 	.flags = IRQF_TIMER, |  | ||||||
| 	.handler = kona_timer_interrupt, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int __init kona_timer_init(struct device_node *node) | static int __init kona_timer_init(struct device_node *node) | ||||||
| { | { | ||||||
| 	u32 freq; | 	u32 freq; | ||||||
|  | @ -192,7 +186,9 @@ static int __init kona_timer_init(struct device_node *node) | ||||||
| 	kona_timer_disable_and_clear(timers.tmr_regs); | 	kona_timer_disable_and_clear(timers.tmr_regs); | ||||||
| 
 | 
 | ||||||
| 	kona_timer_clockevents_init(); | 	kona_timer_clockevents_init(); | ||||||
| 	setup_irq(timers.tmr_irq, &kona_timer_irq); | 	if (request_irq(timers.tmr_irq, kona_timer_interrupt, IRQF_TIMER, | ||||||
|  | 			"Kona Timer Tick", NULL)) | ||||||
|  | 		pr_err("%s: request_irq() failed\n", "Kona Timer Tick"); | ||||||
| 	kona_timer_set_next_event((arch_timer_rate / HZ), NULL); | 	kona_timer_set_next_event((arch_timer_rate / HZ), NULL); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
|  |  | ||||||
|  | @ -270,15 +270,10 @@ dw_apb_clockevent_init(int cpu, const char *name, unsigned rating, | ||||||
| 	dw_ced->ced.rating = rating; | 	dw_ced->ced.rating = rating; | ||||||
| 	dw_ced->ced.name = name; | 	dw_ced->ced.name = name; | ||||||
| 
 | 
 | ||||||
| 	dw_ced->irqaction.name		= dw_ced->ced.name; |  | ||||||
| 	dw_ced->irqaction.handler	= dw_apb_clockevent_irq; |  | ||||||
| 	dw_ced->irqaction.dev_id	= &dw_ced->ced; |  | ||||||
| 	dw_ced->irqaction.irq		= irq; |  | ||||||
| 	dw_ced->irqaction.flags		= IRQF_TIMER | IRQF_IRQPOLL | |  | ||||||
| 					  IRQF_NOBALANCING; |  | ||||||
| 
 |  | ||||||
| 	dw_ced->eoi = apbt_eoi; | 	dw_ced->eoi = apbt_eoi; | ||||||
| 	err = setup_irq(irq, &dw_ced->irqaction); | 	err = request_irq(irq, dw_apb_clockevent_irq, | ||||||
|  | 			  IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING, | ||||||
|  | 			  dw_ced->ced.name, &dw_ced->ced); | ||||||
| 	if (err) { | 	if (err) { | ||||||
| 		pr_err("failed to request timer irq\n"); | 		pr_err("failed to request timer irq\n"); | ||||||
| 		kfree(dw_ced); | 		kfree(dw_ced); | ||||||
|  |  | ||||||
|  | @ -329,19 +329,15 @@ static irqreturn_t exynos4_mct_comp_isr(int irq, void *dev_id) | ||||||
| 	return IRQ_HANDLED; | 	return IRQ_HANDLED; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static struct irqaction mct_comp_event_irq = { |  | ||||||
| 	.name		= "mct_comp_irq", |  | ||||||
| 	.flags		= IRQF_TIMER | IRQF_IRQPOLL, |  | ||||||
| 	.handler	= exynos4_mct_comp_isr, |  | ||||||
| 	.dev_id		= &mct_comp_device, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int exynos4_clockevent_init(void) | static int exynos4_clockevent_init(void) | ||||||
| { | { | ||||||
| 	mct_comp_device.cpumask = cpumask_of(0); | 	mct_comp_device.cpumask = cpumask_of(0); | ||||||
| 	clockevents_config_and_register(&mct_comp_device, clk_rate, | 	clockevents_config_and_register(&mct_comp_device, clk_rate, | ||||||
| 					0xf, 0xffffffff); | 					0xf, 0xffffffff); | ||||||
| 	setup_irq(mct_irqs[MCT_G0_IRQ], &mct_comp_event_irq); | 	if (request_irq(mct_irqs[MCT_G0_IRQ], exynos4_mct_comp_isr, | ||||||
|  | 			IRQF_TIMER | IRQF_IRQPOLL, "mct_comp_irq", | ||||||
|  | 			&mct_comp_device)) | ||||||
|  | 		pr_err("%s: request_irq() failed\n", "mct_comp_irq"); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -117,13 +117,6 @@ static irqreturn_t mxs_timer_interrupt(int irq, void *dev_id) | ||||||
| 	return IRQ_HANDLED; | 	return IRQ_HANDLED; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static struct irqaction mxs_timer_irq = { |  | ||||||
| 	.name		= "MXS Timer Tick", |  | ||||||
| 	.dev_id		= &mxs_clockevent_device, |  | ||||||
| 	.flags		= IRQF_TIMER | IRQF_IRQPOLL, |  | ||||||
| 	.handler	= mxs_timer_interrupt, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static void mxs_irq_clear(char *state) | static void mxs_irq_clear(char *state) | ||||||
| { | { | ||||||
| 	/* Disable interrupt in timer module */ | 	/* Disable interrupt in timer module */ | ||||||
|  | @ -277,6 +270,7 @@ static int __init mxs_timer_init(struct device_node *np) | ||||||
| 	if (irq <= 0) | 	if (irq <= 0) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 
 | 
 | ||||||
| 	return setup_irq(irq, &mxs_timer_irq); | 	return request_irq(irq, mxs_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, | ||||||
|  | 			   "MXS Timer Tick", &mxs_clockevent_device); | ||||||
| } | } | ||||||
| TIMER_OF_DECLARE(mxs, "fsl,timrot", mxs_timer_init); | TIMER_OF_DECLARE(mxs, "fsl,timrot", mxs_timer_init); | ||||||
|  |  | ||||||
|  | @ -181,13 +181,6 @@ static irqreturn_t nmdk_timer_interrupt(int irq, void *dev_id) | ||||||
| 	return IRQ_HANDLED; | 	return IRQ_HANDLED; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static struct irqaction nmdk_timer_irq = { |  | ||||||
| 	.name		= "Nomadik Timer Tick", |  | ||||||
| 	.flags		= IRQF_TIMER, |  | ||||||
| 	.handler	= nmdk_timer_interrupt, |  | ||||||
| 	.dev_id		= &nmdk_clkevt, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int __init nmdk_timer_init(void __iomem *base, int irq, | static int __init nmdk_timer_init(void __iomem *base, int irq, | ||||||
| 				   struct clk *pclk, struct clk *clk) | 				   struct clk *pclk, struct clk *clk) | ||||||
| { | { | ||||||
|  | @ -232,7 +225,9 @@ static int __init nmdk_timer_init(void __iomem *base, int irq, | ||||||
| 	sched_clock_register(nomadik_read_sched_clock, 32, rate); | 	sched_clock_register(nomadik_read_sched_clock, 32, rate); | ||||||
| 
 | 
 | ||||||
| 	/* Timer 1 is used for events, register irq and clockevents */ | 	/* Timer 1 is used for events, register irq and clockevents */ | ||||||
| 	setup_irq(irq, &nmdk_timer_irq); | 	if (request_irq(irq, nmdk_timer_interrupt, IRQF_TIMER, | ||||||
|  | 			"Nomadik Timer Tick", &nmdk_clkevt)) | ||||||
|  | 		pr_err("%s: request_irq() failed\n", "Nomadik Timer Tick"); | ||||||
| 	nmdk_clkevt.cpumask = cpumask_of(0); | 	nmdk_clkevt.cpumask = cpumask_of(0); | ||||||
| 	nmdk_clkevt.irq = irq; | 	nmdk_clkevt.irq = irq; | ||||||
| 	clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU); | 	clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU); | ||||||
|  |  | ||||||
|  | @ -256,13 +256,6 @@ static irqreturn_t samsung_clock_event_isr(int irq, void *dev_id) | ||||||
| 	return IRQ_HANDLED; | 	return IRQ_HANDLED; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static struct irqaction samsung_clock_event_irq = { |  | ||||||
| 	.name		= "samsung_time_irq", |  | ||||||
| 	.flags		= IRQF_TIMER | IRQF_IRQPOLL, |  | ||||||
| 	.handler	= samsung_clock_event_isr, |  | ||||||
| 	.dev_id		= &time_event_device, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static void __init samsung_clockevent_init(void) | static void __init samsung_clockevent_init(void) | ||||||
| { | { | ||||||
| 	unsigned long pclk; | 	unsigned long pclk; | ||||||
|  | @ -282,7 +275,10 @@ static void __init samsung_clockevent_init(void) | ||||||
| 						clock_rate, 1, pwm.tcnt_max); | 						clock_rate, 1, pwm.tcnt_max); | ||||||
| 
 | 
 | ||||||
| 	irq_number = pwm.irq[pwm.event_id]; | 	irq_number = pwm.irq[pwm.event_id]; | ||||||
| 	setup_irq(irq_number, &samsung_clock_event_irq); | 	if (request_irq(irq_number, samsung_clock_event_isr, | ||||||
|  | 			IRQF_TIMER | IRQF_IRQPOLL, "samsung_time_irq", | ||||||
|  | 			&time_event_device)) | ||||||
|  | 		pr_err("%s: request_irq() failed\n", "samsung_time_irq"); | ||||||
| 
 | 
 | ||||||
| 	if (pwm.variant.has_tint_cstat) { | 	if (pwm.variant.has_tint_cstat) { | ||||||
| 		u32 mask = (1 << pwm.event_id); | 		u32 mask = (1 << pwm.event_id); | ||||||
|  |  | ||||||
|  | @ -159,29 +159,23 @@ static struct clocksource sirfsoc_clocksource = { | ||||||
| 	.resume = sirfsoc_clocksource_resume, | 	.resume = sirfsoc_clocksource_resume, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static struct irqaction sirfsoc_timer_irq = { | static unsigned int sirfsoc_timer_irq, sirfsoc_timer1_irq; | ||||||
| 	.name = "sirfsoc_timer0", |  | ||||||
| 	.flags = IRQF_TIMER | IRQF_NOBALANCING, |  | ||||||
| 	.handler = sirfsoc_timer_interrupt, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static struct irqaction sirfsoc_timer1_irq = { |  | ||||||
| 	.name = "sirfsoc_timer1", |  | ||||||
| 	.flags = IRQF_TIMER | IRQF_NOBALANCING, |  | ||||||
| 	.handler = sirfsoc_timer_interrupt, |  | ||||||
| }; |  | ||||||
| 
 | 
 | ||||||
| static int sirfsoc_local_timer_starting_cpu(unsigned int cpu) | static int sirfsoc_local_timer_starting_cpu(unsigned int cpu) | ||||||
| { | { | ||||||
| 	struct clock_event_device *ce = per_cpu_ptr(sirfsoc_clockevent, cpu); | 	struct clock_event_device *ce = per_cpu_ptr(sirfsoc_clockevent, cpu); | ||||||
| 	struct irqaction *action; | 	unsigned int irq; | ||||||
|  | 	const char *name; | ||||||
| 
 | 
 | ||||||
| 	if (cpu == 0) | 	if (cpu == 0) { | ||||||
| 		action = &sirfsoc_timer_irq; | 		irq = sirfsoc_timer_irq; | ||||||
| 	else | 		name = "sirfsoc_timer0"; | ||||||
| 		action = &sirfsoc_timer1_irq; | 	} else { | ||||||
|  | 		irq = sirfsoc_timer1_irq; | ||||||
|  | 		name = "sirfsoc_timer1"; | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	ce->irq = action->irq; | 	ce->irq = irq; | ||||||
| 	ce->name = "local_timer"; | 	ce->name = "local_timer"; | ||||||
| 	ce->features = CLOCK_EVT_FEAT_ONESHOT; | 	ce->features = CLOCK_EVT_FEAT_ONESHOT; | ||||||
| 	ce->rating = 200; | 	ce->rating = 200; | ||||||
|  | @ -196,9 +190,9 @@ static int sirfsoc_local_timer_starting_cpu(unsigned int cpu) | ||||||
| 	ce->min_delta_ticks = 2; | 	ce->min_delta_ticks = 2; | ||||||
| 	ce->cpumask = cpumask_of(cpu); | 	ce->cpumask = cpumask_of(cpu); | ||||||
| 
 | 
 | ||||||
| 	action->dev_id = ce; | 	BUG_ON(request_irq(ce->irq, sirfsoc_timer_interrupt, | ||||||
| 	BUG_ON(setup_irq(ce->irq, action)); | 			   IRQF_TIMER | IRQF_NOBALANCING, name, ce)); | ||||||
| 	irq_force_affinity(action->irq, cpumask_of(cpu)); | 	irq_force_affinity(ce->irq, cpumask_of(cpu)); | ||||||
| 
 | 
 | ||||||
| 	clockevents_register_device(ce); | 	clockevents_register_device(ce); | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -206,12 +200,14 @@ static int sirfsoc_local_timer_starting_cpu(unsigned int cpu) | ||||||
| 
 | 
 | ||||||
| static int sirfsoc_local_timer_dying_cpu(unsigned int cpu) | static int sirfsoc_local_timer_dying_cpu(unsigned int cpu) | ||||||
| { | { | ||||||
|  | 	struct clock_event_device *ce = per_cpu_ptr(sirfsoc_clockevent, cpu); | ||||||
|  | 
 | ||||||
| 	sirfsoc_timer_count_disable(1); | 	sirfsoc_timer_count_disable(1); | ||||||
| 
 | 
 | ||||||
| 	if (cpu == 0) | 	if (cpu == 0) | ||||||
| 		remove_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq); | 		free_irq(sirfsoc_timer_irq, ce); | ||||||
| 	else | 	else | ||||||
| 		remove_irq(sirfsoc_timer1_irq.irq, &sirfsoc_timer1_irq); | 		free_irq(sirfsoc_timer1_irq, ce); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -268,14 +264,14 @@ static int __init sirfsoc_of_timer_init(struct device_node *np) | ||||||
| 		return -ENXIO; | 		return -ENXIO; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	sirfsoc_timer_irq.irq = irq_of_parse_and_map(np, 0); | 	sirfsoc_timer_irq = irq_of_parse_and_map(np, 0); | ||||||
| 	if (!sirfsoc_timer_irq.irq) { | 	if (!sirfsoc_timer_irq) { | ||||||
| 		pr_err("No irq passed for timer0 via DT\n"); | 		pr_err("No irq passed for timer0 via DT\n"); | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	sirfsoc_timer1_irq.irq = irq_of_parse_and_map(np, 1); | 	sirfsoc_timer1_irq = irq_of_parse_and_map(np, 1); | ||||||
| 	if (!sirfsoc_timer1_irq.irq) { | 	if (!sirfsoc_timer1_irq) { | ||||||
| 		pr_err("No irq passed for timer1 via DT\n"); | 		pr_err("No irq passed for timer1 via DT\n"); | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -131,12 +131,6 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id) | ||||||
| 	return IRQ_HANDLED; | 	return IRQ_HANDLED; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static struct irqaction mfgptirq  = { |  | ||||||
| 	.handler = mfgpt_tick, |  | ||||||
| 	.flags = IRQF_NOBALANCING | IRQF_TIMER | IRQF_SHARED, |  | ||||||
| 	.name = DRV_NAME, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int __init cs5535_mfgpt_init(void) | static int __init cs5535_mfgpt_init(void) | ||||||
| { | { | ||||||
| 	struct cs5535_mfgpt_timer *timer; | 	struct cs5535_mfgpt_timer *timer; | ||||||
|  | @ -158,7 +152,9 @@ static int __init cs5535_mfgpt_init(void) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* And register it with the kernel */ | 	/* And register it with the kernel */ | ||||||
| 	ret = setup_irq(timer_irq, &mfgptirq); | 	ret = request_irq(timer_irq, mfgpt_tick, | ||||||
|  | 			  IRQF_NOBALANCING | IRQF_TIMER | IRQF_SHARED, | ||||||
|  | 			  DRV_NAME, NULL); | ||||||
| 	if (ret) { | 	if (ret) { | ||||||
| 		printk(KERN_ERR DRV_NAME ": Unable to set up the interrupt.\n"); | 		printk(KERN_ERR DRV_NAME ": Unable to set up the interrupt.\n"); | ||||||
| 		goto err_irq; | 		goto err_irq; | ||||||
|  |  | ||||||
|  | @ -119,13 +119,6 @@ static struct efm32_clock_event_ddata clock_event_ddata = { | ||||||
| 	}, | 	}, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static struct irqaction efm32_clock_event_irq = { |  | ||||||
| 	.name = "efm32 clockevent", |  | ||||||
| 	.flags = IRQF_TIMER, |  | ||||||
| 	.handler = efm32_clock_event_handler, |  | ||||||
| 	.dev_id = &clock_event_ddata, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int __init efm32_clocksource_init(struct device_node *np) | static int __init efm32_clocksource_init(struct device_node *np) | ||||||
| { | { | ||||||
| 	struct clk *clk; | 	struct clk *clk; | ||||||
|  | @ -230,7 +223,8 @@ static int __init efm32_clockevent_init(struct device_node *np) | ||||||
| 					DIV_ROUND_CLOSEST(rate, 1024), | 					DIV_ROUND_CLOSEST(rate, 1024), | ||||||
| 					0xf, 0xffff); | 					0xf, 0xffff); | ||||||
| 
 | 
 | ||||||
| 	ret = setup_irq(irq, &efm32_clock_event_irq); | 	ret = request_irq(irq, efm32_clock_event_handler, IRQF_TIMER, | ||||||
|  | 			  "efm32 clockevent", &clock_event_ddata); | ||||||
| 	if (ret) { | 	if (ret) { | ||||||
| 		pr_err("Failed setup irq\n"); | 		pr_err("Failed setup irq\n"); | ||||||
| 		goto err_setup_irq; | 		goto err_setup_irq; | ||||||
|  |  | ||||||
|  | @ -176,13 +176,6 @@ static struct clock_event_device ftm_clockevent = { | ||||||
| 	.rating			= 300, | 	.rating			= 300, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static struct irqaction ftm_timer_irq = { |  | ||||||
| 	.name		= "Freescale ftm timer", |  | ||||||
| 	.flags		= IRQF_TIMER | IRQF_IRQPOLL, |  | ||||||
| 	.handler	= ftm_evt_interrupt, |  | ||||||
| 	.dev_id		= &ftm_clockevent, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int __init ftm_clockevent_init(unsigned long freq, int irq) | static int __init ftm_clockevent_init(unsigned long freq, int irq) | ||||||
| { | { | ||||||
| 	int err; | 	int err; | ||||||
|  | @ -192,7 +185,8 @@ static int __init ftm_clockevent_init(unsigned long freq, int irq) | ||||||
| 
 | 
 | ||||||
| 	ftm_reset_counter(priv->clkevt_base); | 	ftm_reset_counter(priv->clkevt_base); | ||||||
| 
 | 
 | ||||||
| 	err = setup_irq(irq, &ftm_timer_irq); | 	err = request_irq(irq, ftm_evt_interrupt, IRQF_TIMER | IRQF_IRQPOLL, | ||||||
|  | 			  "Freescale ftm timer", &ftm_clockevent); | ||||||
| 	if (err) { | 	if (err) { | ||||||
| 		pr_err("ftm: setup irq failed: %d\n", err); | 		pr_err("ftm: setup irq failed: %d\n", err); | ||||||
| 		return err; | 		return err; | ||||||
|  |  | ||||||
|  | @ -67,7 +67,6 @@ struct imx_timer { | ||||||
| 	struct clk *clk_ipg; | 	struct clk *clk_ipg; | ||||||
| 	const struct imx_gpt_data *gpt; | 	const struct imx_gpt_data *gpt; | ||||||
| 	struct clock_event_device ced; | 	struct clock_event_device ced; | ||||||
| 	struct irqaction act; |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct imx_gpt_data { | struct imx_gpt_data { | ||||||
|  | @ -273,7 +272,6 @@ static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id) | ||||||
| static int __init mxc_clockevent_init(struct imx_timer *imxtm) | static int __init mxc_clockevent_init(struct imx_timer *imxtm) | ||||||
| { | { | ||||||
| 	struct clock_event_device *ced = &imxtm->ced; | 	struct clock_event_device *ced = &imxtm->ced; | ||||||
| 	struct irqaction *act = &imxtm->act; |  | ||||||
| 
 | 
 | ||||||
| 	ced->name = "mxc_timer1"; | 	ced->name = "mxc_timer1"; | ||||||
| 	ced->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_DYNIRQ; | 	ced->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_DYNIRQ; | ||||||
|  | @ -287,12 +285,8 @@ static int __init mxc_clockevent_init(struct imx_timer *imxtm) | ||||||
| 	clockevents_config_and_register(ced, clk_get_rate(imxtm->clk_per), | 	clockevents_config_and_register(ced, clk_get_rate(imxtm->clk_per), | ||||||
| 					0xff, 0xfffffffe); | 					0xff, 0xfffffffe); | ||||||
| 
 | 
 | ||||||
| 	act->name = "i.MX Timer Tick"; | 	return request_irq(imxtm->irq, mxc_timer_interrupt, | ||||||
| 	act->flags = IRQF_TIMER | IRQF_IRQPOLL; | 			   IRQF_TIMER | IRQF_IRQPOLL, "i.MX Timer Tick", ced); | ||||||
| 	act->handler = mxc_timer_interrupt; |  | ||||||
| 	act->dev_id = ced; |  | ||||||
| 
 |  | ||||||
| 	return setup_irq(imxtm->irq, act); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void imx1_gpt_setup_tctl(struct imx_timer *imxtm) | static void imx1_gpt_setup_tctl(struct imx_timer *imxtm) | ||||||
|  |  | ||||||
|  | @ -123,13 +123,6 @@ static struct clock_event_device integrator_clockevent = { | ||||||
| 	.rating			= 300, | 	.rating			= 300, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static struct irqaction integrator_timer_irq = { |  | ||||||
| 	.name		= "timer", |  | ||||||
| 	.flags		= IRQF_TIMER | IRQF_IRQPOLL, |  | ||||||
| 	.handler	= integrator_timer_interrupt, |  | ||||||
| 	.dev_id		= &integrator_clockevent, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int integrator_clockevent_init(unsigned long inrate, | static int integrator_clockevent_init(unsigned long inrate, | ||||||
| 				      void __iomem *base, int irq) | 				      void __iomem *base, int irq) | ||||||
| { | { | ||||||
|  | @ -149,7 +142,9 @@ static int integrator_clockevent_init(unsigned long inrate, | ||||||
| 	timer_reload = rate / HZ; | 	timer_reload = rate / HZ; | ||||||
| 	writel(ctrl, clkevt_base + TIMER_CTRL); | 	writel(ctrl, clkevt_base + TIMER_CTRL); | ||||||
| 
 | 
 | ||||||
| 	ret = setup_irq(irq, &integrator_timer_irq); | 	ret = request_irq(irq, integrator_timer_interrupt, | ||||||
|  | 			  IRQF_TIMER | IRQF_IRQPOLL, "timer", | ||||||
|  | 			  &integrator_clockevent); | ||||||
| 	if (ret) | 	if (ret) | ||||||
| 		return ret; | 		return ret; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -150,13 +150,6 @@ static irqreturn_t meson6_timer_interrupt(int irq, void *dev_id) | ||||||
| 	return IRQ_HANDLED; | 	return IRQ_HANDLED; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static struct irqaction meson6_timer_irq = { |  | ||||||
| 	.name		= "meson6_timer", |  | ||||||
| 	.flags		= IRQF_TIMER | IRQF_IRQPOLL, |  | ||||||
| 	.handler	= meson6_timer_interrupt, |  | ||||||
| 	.dev_id		= &meson6_clockevent, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int __init meson6_timer_init(struct device_node *node) | static int __init meson6_timer_init(struct device_node *node) | ||||||
| { | { | ||||||
| 	u32 val; | 	u32 val; | ||||||
|  | @ -194,7 +187,9 @@ static int __init meson6_timer_init(struct device_node *node) | ||||||
| 	/* Stop the timer A */ | 	/* Stop the timer A */ | ||||||
| 	meson6_clkevt_time_stop(); | 	meson6_clkevt_time_stop(); | ||||||
| 
 | 
 | ||||||
| 	ret = setup_irq(irq, &meson6_timer_irq); | 	ret = request_irq(irq, meson6_timer_interrupt, | ||||||
|  | 			  IRQF_TIMER | IRQF_IRQPOLL, "meson6_timer", | ||||||
|  | 			  &meson6_clockevent); | ||||||
| 	if (ret) { | 	if (ret) { | ||||||
| 		pr_warn("failed to setup irq %d\n", irq); | 		pr_warn("failed to setup irq %d\n", irq); | ||||||
| 		return ret; | 		return ret; | ||||||
|  |  | ||||||
|  | @ -114,12 +114,6 @@ static irqreturn_t orion_clkevt_irq_handler(int irq, void *dev_id) | ||||||
| 	return IRQ_HANDLED; | 	return IRQ_HANDLED; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static struct irqaction orion_clkevt_irq = { |  | ||||||
| 	.name		= "orion_event", |  | ||||||
| 	.flags		= IRQF_TIMER, |  | ||||||
| 	.handler	= orion_clkevt_irq_handler, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int __init orion_timer_init(struct device_node *np) | static int __init orion_timer_init(struct device_node *np) | ||||||
| { | { | ||||||
| 	unsigned long rate; | 	unsigned long rate; | ||||||
|  | @ -172,7 +166,8 @@ static int __init orion_timer_init(struct device_node *np) | ||||||
| 	sched_clock_register(orion_read_sched_clock, 32, rate); | 	sched_clock_register(orion_read_sched_clock, 32, rate); | ||||||
| 
 | 
 | ||||||
| 	/* setup timer1 as clockevent timer */ | 	/* setup timer1 as clockevent timer */ | ||||||
| 	ret = setup_irq(irq, &orion_clkevt_irq); | 	ret = request_irq(irq, orion_clkevt_irq_handler, IRQF_TIMER, | ||||||
|  | 			  "orion_event", NULL); | ||||||
| 	if (ret) { | 	if (ret) { | ||||||
| 		pr_err("%pOFn: unable to setup irq\n", np); | 		pr_err("%pOFn: unable to setup irq\n", np); | ||||||
| 		return ret; | 		return ret; | ||||||
|  |  | ||||||
|  | @ -165,14 +165,6 @@ static struct clocksource sirfsoc_clocksource = { | ||||||
| 	.resume = sirfsoc_clocksource_resume, | 	.resume = sirfsoc_clocksource_resume, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static struct irqaction sirfsoc_timer_irq = { |  | ||||||
| 	.name = "sirfsoc_timer0", |  | ||||||
| 	.flags = IRQF_TIMER, |  | ||||||
| 	.irq = 0, |  | ||||||
| 	.handler = sirfsoc_timer_interrupt, |  | ||||||
| 	.dev_id = &sirfsoc_clockevent, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /* Overwrite weak default sched_clock with more precise one */ | /* Overwrite weak default sched_clock with more precise one */ | ||||||
| static u64 notrace sirfsoc_read_sched_clock(void) | static u64 notrace sirfsoc_read_sched_clock(void) | ||||||
| { | { | ||||||
|  | @ -190,6 +182,7 @@ static void __init sirfsoc_clockevent_init(void) | ||||||
| static int __init sirfsoc_prima2_timer_init(struct device_node *np) | static int __init sirfsoc_prima2_timer_init(struct device_node *np) | ||||||
| { | { | ||||||
| 	unsigned long rate; | 	unsigned long rate; | ||||||
|  | 	unsigned int irq; | ||||||
| 	struct clk *clk; | 	struct clk *clk; | ||||||
| 	int ret; | 	int ret; | ||||||
| 
 | 
 | ||||||
|  | @ -218,7 +211,7 @@ static int __init sirfsoc_prima2_timer_init(struct device_node *np) | ||||||
| 		return -ENXIO; | 		return -ENXIO; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	sirfsoc_timer_irq.irq = irq_of_parse_and_map(np, 0); | 	irq = irq_of_parse_and_map(np, 0); | ||||||
| 
 | 
 | ||||||
| 	writel_relaxed(rate / PRIMA2_CLOCK_FREQ / 2 - 1, | 	writel_relaxed(rate / PRIMA2_CLOCK_FREQ / 2 - 1, | ||||||
| 		sirfsoc_timer_base + SIRFSOC_TIMER_DIV); | 		sirfsoc_timer_base + SIRFSOC_TIMER_DIV); | ||||||
|  | @ -234,7 +227,8 @@ static int __init sirfsoc_prima2_timer_init(struct device_node *np) | ||||||
| 
 | 
 | ||||||
| 	sched_clock_register(sirfsoc_read_sched_clock, 64, PRIMA2_CLOCK_FREQ); | 	sched_clock_register(sirfsoc_read_sched_clock, 64, PRIMA2_CLOCK_FREQ); | ||||||
| 
 | 
 | ||||||
| 	ret = setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq); | 	ret = request_irq(irq, sirfsoc_timer_interrupt, IRQF_TIMER, | ||||||
|  | 			  "sirfsoc_timer0", &sirfsoc_clockevent); | ||||||
| 	if (ret) { | 	if (ret) { | ||||||
| 		pr_err("Failed to setup irq\n"); | 		pr_err("Failed to setup irq\n"); | ||||||
| 		return ret; | 		return ret; | ||||||
|  |  | ||||||
|  | @ -143,13 +143,6 @@ static struct clock_event_device ckevt_pxa_osmr0 = { | ||||||
| 	.resume			= pxa_timer_resume, | 	.resume			= pxa_timer_resume, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static struct irqaction pxa_ost0_irq = { |  | ||||||
| 	.name		= "ost0", |  | ||||||
| 	.flags		= IRQF_TIMER | IRQF_IRQPOLL, |  | ||||||
| 	.handler	= pxa_ost0_interrupt, |  | ||||||
| 	.dev_id		= &ckevt_pxa_osmr0, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int __init pxa_timer_common_init(int irq, unsigned long clock_tick_rate) | static int __init pxa_timer_common_init(int irq, unsigned long clock_tick_rate) | ||||||
| { | { | ||||||
| 	int ret; | 	int ret; | ||||||
|  | @ -161,7 +154,8 @@ static int __init pxa_timer_common_init(int irq, unsigned long clock_tick_rate) | ||||||
| 
 | 
 | ||||||
| 	ckevt_pxa_osmr0.cpumask = cpumask_of(0); | 	ckevt_pxa_osmr0.cpumask = cpumask_of(0); | ||||||
| 
 | 
 | ||||||
| 	ret = setup_irq(irq, &pxa_ost0_irq); | 	ret = request_irq(irq, pxa_ost0_interrupt, IRQF_TIMER | IRQF_IRQPOLL, | ||||||
|  | 			  "ost0", &ckevt_pxa_osmr0); | ||||||
| 	if (ret) { | 	if (ret) { | ||||||
| 		pr_err("Failed to setup irq\n"); | 		pr_err("Failed to setup irq\n"); | ||||||
| 		return ret; | 		return ret; | ||||||
|  |  | ||||||
|  | @ -168,13 +168,6 @@ static struct clock_event_device sp804_clockevent = { | ||||||
| 	.rating			= 300, | 	.rating			= 300, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static struct irqaction sp804_timer_irq = { |  | ||||||
| 	.name		= "timer", |  | ||||||
| 	.flags		= IRQF_TIMER | IRQF_IRQPOLL, |  | ||||||
| 	.handler	= sp804_timer_interrupt, |  | ||||||
| 	.dev_id		= &sp804_clockevent, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| int __init __sp804_clockevents_init(void __iomem *base, unsigned int irq, struct clk *clk, const char *name) | int __init __sp804_clockevents_init(void __iomem *base, unsigned int irq, struct clk *clk, const char *name) | ||||||
| { | { | ||||||
| 	struct clock_event_device *evt = &sp804_clockevent; | 	struct clock_event_device *evt = &sp804_clockevent; | ||||||
|  | @ -200,7 +193,9 @@ int __init __sp804_clockevents_init(void __iomem *base, unsigned int irq, struct | ||||||
| 
 | 
 | ||||||
| 	writel(0, base + TIMER_CTRL); | 	writel(0, base + TIMER_CTRL); | ||||||
| 
 | 
 | ||||||
| 	setup_irq(irq, &sp804_timer_irq); | 	if (request_irq(irq, sp804_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, | ||||||
|  | 			"timer", &sp804_clockevent)) | ||||||
|  | 		pr_err("%s: request_irq() failed\n", "timer"); | ||||||
| 	clockevents_config_and_register(evt, rate, 0xf, 0xffffffff); | 	clockevents_config_and_register(evt, rate, 0xf, 0xffffffff); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
|  |  | ||||||
|  | @ -330,12 +330,6 @@ static irqreturn_t u300_timer_interrupt(int irq, void *dev_id) | ||||||
| 	return IRQ_HANDLED; | 	return IRQ_HANDLED; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static struct irqaction u300_timer_irq = { |  | ||||||
| 	.name		= "U300 Timer Tick", |  | ||||||
| 	.flags		= IRQF_TIMER | IRQF_IRQPOLL, |  | ||||||
| 	.handler	= u300_timer_interrupt, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| /*
 | /*
 | ||||||
|  * Override the global weak sched_clock symbol with this |  * Override the global weak sched_clock symbol with this | ||||||
|  * local implementation which uses the clocksource to get some |  * local implementation which uses the clocksource to get some | ||||||
|  | @ -420,7 +414,8 @@ static int __init u300_timer_init_of(struct device_node *np) | ||||||
| 		u300_timer_base + U300_TIMER_APP_RGPT1); | 		u300_timer_base + U300_TIMER_APP_RGPT1); | ||||||
| 
 | 
 | ||||||
| 	/* Set up the IRQ handler */ | 	/* Set up the IRQ handler */ | ||||||
| 	ret = setup_irq(irq, &u300_timer_irq); | 	ret = request_irq(irq, u300_timer_interrupt, | ||||||
|  | 			  IRQF_TIMER | IRQF_IRQPOLL, "U300 Timer Tick", NULL); | ||||||
| 	if (ret) | 	if (ret) | ||||||
| 		return ret; | 		return ret; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -123,19 +123,13 @@ static struct clock_event_device clockevent_pit = { | ||||||
| 	.rating		= 300, | 	.rating		= 300, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static struct irqaction pit_timer_irq = { |  | ||||||
| 	.name		= "VF pit timer", |  | ||||||
| 	.flags		= IRQF_TIMER | IRQF_IRQPOLL, |  | ||||||
| 	.handler	= pit_timer_interrupt, |  | ||||||
| 	.dev_id		= &clockevent_pit, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int __init pit_clockevent_init(unsigned long rate, int irq) | static int __init pit_clockevent_init(unsigned long rate, int irq) | ||||||
| { | { | ||||||
| 	__raw_writel(0, clkevt_base + PITTCTRL); | 	__raw_writel(0, clkevt_base + PITTCTRL); | ||||||
| 	__raw_writel(PITTFLG_TIF, clkevt_base + PITTFLG); | 	__raw_writel(PITTFLG_TIF, clkevt_base + PITTFLG); | ||||||
| 
 | 
 | ||||||
| 	BUG_ON(setup_irq(irq, &pit_timer_irq)); | 	BUG_ON(request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, | ||||||
|  | 			   "VF pit timer", &clockevent_pit); | ||||||
| 
 | 
 | ||||||
| 	clockevent_pit.cpumask = cpumask_of(0); | 	clockevent_pit.cpumask = cpumask_of(0); | ||||||
| 	clockevent_pit.irq = irq; | 	clockevent_pit.irq = irq; | ||||||
|  |  | ||||||
|  | @ -101,13 +101,6 @@ static irqreturn_t vt8500_timer_interrupt(int irq, void *dev_id) | ||||||
| 	return IRQ_HANDLED; | 	return IRQ_HANDLED; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static struct irqaction irq = { |  | ||||||
| 	.name    = "vt8500_timer", |  | ||||||
| 	.flags   = IRQF_TIMER | IRQF_IRQPOLL, |  | ||||||
| 	.handler = vt8500_timer_interrupt, |  | ||||||
| 	.dev_id  = &clockevent, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static int __init vt8500_timer_init(struct device_node *np) | static int __init vt8500_timer_init(struct device_node *np) | ||||||
| { | { | ||||||
| 	int timer_irq, ret; | 	int timer_irq, ret; | ||||||
|  | @ -139,7 +132,9 @@ static int __init vt8500_timer_init(struct device_node *np) | ||||||
| 
 | 
 | ||||||
| 	clockevent.cpumask = cpumask_of(0); | 	clockevent.cpumask = cpumask_of(0); | ||||||
| 
 | 
 | ||||||
| 	ret = setup_irq(timer_irq, &irq); | 	ret = request_irq(timer_irq, vt8500_timer_interrupt, | ||||||
|  | 			  IRQF_TIMER | IRQF_IRQPOLL, "vt8500_timer", | ||||||
|  | 			  &clockevent); | ||||||
| 	if (ret) { | 	if (ret) { | ||||||
| 		pr_err("%s: setup_irq failed for %s\n", __func__, | 		pr_err("%s: setup_irq failed for %s\n", __func__, | ||||||
| 							clockevent.name); | 							clockevent.name); | ||||||
|  |  | ||||||
|  | @ -53,7 +53,6 @@ struct zevio_timer { | ||||||
| 
 | 
 | ||||||
| 	struct clk *clk; | 	struct clk *clk; | ||||||
| 	struct clock_event_device clkevt; | 	struct clock_event_device clkevt; | ||||||
| 	struct irqaction clkevt_irq; |  | ||||||
| 
 | 
 | ||||||
| 	char clocksource_name[64]; | 	char clocksource_name[64]; | ||||||
| 	char clockevent_name[64]; | 	char clockevent_name[64]; | ||||||
|  | @ -172,12 +171,12 @@ static int __init zevio_timer_add(struct device_node *node) | ||||||
| 		/* Interrupt to occur when timer value matches 0 */ | 		/* Interrupt to occur when timer value matches 0 */ | ||||||
| 		writel(0, timer->base + IO_MATCH(TIMER_MATCH)); | 		writel(0, timer->base + IO_MATCH(TIMER_MATCH)); | ||||||
| 
 | 
 | ||||||
| 		timer->clkevt_irq.name		= timer->clockevent_name; | 		if (request_irq(irqnr, zevio_timer_interrupt, | ||||||
| 		timer->clkevt_irq.handler	= zevio_timer_interrupt; | 				IRQF_TIMER | IRQF_IRQPOLL, | ||||||
| 		timer->clkevt_irq.dev_id	= timer; | 				timer->clockevent_name, timer)) { | ||||||
| 		timer->clkevt_irq.flags		= IRQF_TIMER | IRQF_IRQPOLL; | 			pr_err("%s: request_irq() failed\n", | ||||||
| 
 | 			       timer->clockevent_name); | ||||||
| 		setup_irq(irqnr, &timer->clkevt_irq); | 		} | ||||||
| 
 | 
 | ||||||
| 		clockevents_config_and_register(&timer->clkevt, | 		clockevents_config_and_register(&timer->clkevt, | ||||||
| 				clk_get_rate(timer->clk), 0x0001, 0xffff); | 				clk_get_rate(timer->clk), 0x0001, 0xffff); | ||||||
|  |  | ||||||
|  | @ -25,7 +25,6 @@ struct dw_apb_timer { | ||||||
| struct dw_apb_clock_event_device { | struct dw_apb_clock_event_device { | ||||||
| 	struct clock_event_device		ced; | 	struct clock_event_device		ced; | ||||||
| 	struct dw_apb_timer			timer; | 	struct dw_apb_timer			timer; | ||||||
| 	struct irqaction			irqaction; |  | ||||||
| 	void					(*eoi)(struct dw_apb_timer *); | 	void					(*eoi)(struct dw_apb_timer *); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 afzal mohammed
						afzal mohammed