* [PATCH] mfd: twl6030-irq: Make sure to call request_irq before using the irq_num
@ 2011-08-11 7:21 Axel Lin
2011-08-22 13:32 ` Samuel Ortiz
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-08-11 7:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Rajendra Nayak, Balaji T K, Santosh Shilimkar, Samuel Ortiz
I was trying to fix the error handling part because in the case of
request_irq failure, it should call kthread_stop instead of free_irq.
But it seems more reasonable to do request_irq before calling kthread_run.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mfd/twl6030-irq.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
index b57383b..e0baff8 100644
--- a/drivers/mfd/twl6030-irq.c
+++ b/drivers/mfd/twl6030-irq.c
@@ -332,12 +332,6 @@ int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
/* install an irq handler to demultiplex the TWL6030 interrupt */
init_completion(&irq_event);
- task = kthread_run(twl6030_irq_thread, (void *)irq_num, "twl6030-irq");
- if (IS_ERR(task)) {
- pr_err("twl6030: could not create irq %d thread!\n", irq_num);
- status = PTR_ERR(task);
- goto fail_kthread;
- }
status = request_irq(irq_num, handle_twl6030_pih, IRQF_DISABLED,
"TWL6030-PIH", &irq_event);
@@ -345,11 +339,19 @@ int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
pr_err("twl6030: could not claim irq%d: %d\n", irq_num, status);
goto fail_irq;
}
+
+ task = kthread_run(twl6030_irq_thread, (void *)irq_num, "twl6030-irq");
+ if (IS_ERR(task)) {
+ pr_err("twl6030: could not create irq %d thread!\n", irq_num);
+ status = PTR_ERR(task);
+ goto fail_kthread;
+ }
return status;
-fail_irq:
- free_irq(irq_num, &irq_event);
fail_kthread:
+ free_irq(irq_num, &irq_event);
+
+fail_irq:
for (i = irq_base; i < irq_end; i++)
irq_set_chip_and_handler(i, NULL, NULL);
return status;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] mfd: twl6030-irq: Make sure to call request_irq before using the irq_num
2011-08-11 7:21 [PATCH] mfd: twl6030-irq: Make sure to call request_irq before using the irq_num Axel Lin
@ 2011-08-22 13:32 ` Samuel Ortiz
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2011-08-22 13:32 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Rajendra Nayak, Balaji T K, Santosh Shilimkar
Hi Axel,
On Thu, Aug 11, 2011 at 03:21:00PM +0800, Axel Lin wrote:
> I was trying to fix the error handling part because in the case of
> request_irq failure, it should call kthread_stop instead of free_irq.
> But it seems more reasonable to do request_irq before calling kthread_run.
I don't have the hardware, but that makes sense to me.
Unless some from TI NACK this patch, I'm applying it.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-22 13:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-11 7:21 [PATCH] mfd: twl6030-irq: Make sure to call request_irq before using the irq_num Axel Lin
2011-08-22 13:32 ` Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox