From: Felipe Balbi <balbi@ti.com>
To: Linux OMAP Mailing List <linux-omap@vger.kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Samuel Ortiz <sameo@linux.intel.com>,
Tony Lindgren <tony@atomide.com>,
Thomas Gleixner <tglx@linutronix.de>, Felipe Balbi <balbi@ti.com>
Subject: [PATCH 3/7] mfd: twl4030-irq: drop the kthread
Date: Thu, 30 Jun 2011 12:51:06 +0300 [thread overview]
Message-ID: <1309427470-605-4-git-send-email-balbi@ti.com> (raw)
In-Reply-To: <1309427470-605-1-git-send-email-balbi@ti.com>
... and use threaded IRQ infrastructure. Later
patches will come dropping both workqueues and
setting the nested thread flag.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/mfd/twl4030-irq.c | 94 ++++++++++-----------------------------------
1 files changed, 21 insertions(+), 73 deletions(-)
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index 291364c..e1e0944 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -30,7 +30,6 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
-#include <linux/kthread.h>
#include <linux/slab.h>
#include <linux/i2c/twl.h>
@@ -278,59 +277,6 @@ static const struct sih sih_modules_twl5031[8] = {
static unsigned twl4030_irq_base;
-static struct completion irq_event;
-
-/*
- * This thread processes interrupts reported by the Primary Interrupt Handler.
- */
-static int twl4030_irq_thread(void *data)
-{
- long irq = (long)data;
- static unsigned i2c_errors;
- static const unsigned max_i2c_errors = 100;
-
-
- current->flags |= PF_NOFREEZE;
-
- while (!kthread_should_stop()) {
- int ret;
- int module_irq;
- u8 pih_isr;
-
- /* Wait for IRQ, then read PIH irq status (also blocking) */
- wait_for_completion_interruptible(&irq_event);
-
- ret = twl_i2c_read_u8(TWL4030_MODULE_PIH, &pih_isr,
- REG_PIH_ISR_P1);
- if (ret) {
- pr_warning("twl4030: I2C error %d reading PIH ISR\n",
- ret);
- if (++i2c_errors >= max_i2c_errors) {
- printk(KERN_ERR "Maximum I2C error count"
- " exceeded. Terminating %s.\n",
- __func__);
- break;
- }
- complete(&irq_event);
- continue;
- }
-
- /* these handlers deal with the relevant SIH irq status */
- local_irq_disable();
- for (module_irq = twl4030_irq_base;
- pih_isr;
- pih_isr >>= 1, module_irq++) {
- if (pih_isr & 0x1)
- generic_handle_irq(module_irq);
- }
- local_irq_enable();
-
- enable_irq(irq);
- }
-
- return 0;
-}
-
/*
* handle_twl4030_pih() is the desc->handle method for the twl4030 interrupt.
* This is a chained interrupt, so there is no desc->action method for it.
@@ -342,9 +288,25 @@ static int twl4030_irq_thread(void *data)
*/
static irqreturn_t handle_twl4030_pih(int irq, void *devid)
{
- /* Acknowledge, clear *AND* mask the interrupt... */
- disable_irq_nosync(irq);
- complete(devid);
+ int module_irq;
+ irqreturn_t ret;
+ u8 pih_isr;
+
+ ret = twl_i2c_read_u8(TWL4030_MODULE_PIH, &pih_isr,
+ REG_PIH_ISR_P1);
+ if (ret) {
+ pr_warning("twl4030: I2C error %d reading PIH ISR\n", ret);
+ return IRQ_NONE;
+ }
+
+ /* these handlers deal with the relevant SIH irq status */
+ for (module_irq = twl4030_irq_base;
+ pih_isr;
+ pih_isr >>= 1, module_irq++) {
+ if (pih_isr & 0x1)
+ generic_handle_irq(module_irq);
+ }
+
return IRQ_HANDLED;
}
/*----------------------------------------------------------------------*/
@@ -763,7 +725,6 @@ int twl4030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
int status;
int i;
- struct task_struct *task;
/*
* Mask and clear all TWL4030 interrupts since initially we do
@@ -806,27 +767,14 @@ int twl4030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
}
/* install an irq handler to demultiplex the TWL4030 interrupt */
-
-
- init_completion(&irq_event);
-
- status = request_irq(irq_num, handle_twl4030_pih, IRQF_DISABLED,
- "TWL4030-PIH", &irq_event);
+ status = request_threaded_irq(irq_num, NULL, handle_twl4030_pih,
+ IRQF_DISABLED, "TWL4030-PIH", NULL);
if (status < 0) {
pr_err("twl4030: could not claim irq%d: %d\n", irq_num, status);
goto fail_rqirq;
}
- task = kthread_run(twl4030_irq_thread, (void *)(long)irq_num,
- "twl4030-irq");
- if (IS_ERR(task)) {
- pr_err("twl4030: could not create irq %d thread!\n", irq_num);
- status = PTR_ERR(task);
- goto fail_kthread;
- }
return status;
-fail_kthread:
- free_irq(irq_num, &irq_event);
fail_rqirq:
/* clean up twl4030_sih_setup */
fail:
--
1.7.6
next prev parent reply other threads:[~2011-06-30 9:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-30 9:51 [PATCH 0/7] twl4030: finish threaded IRQ conversion Felipe Balbi
2011-06-30 9:51 ` [PATCH 1/7] mfd: twl4030-irq: remove trailing whitespaces Felipe Balbi
2011-06-30 9:51 ` [PATCH 2/7] mfd: twl4030-irq: implement bus_lock/bus_sync_unlock methods Felipe Balbi
2011-06-30 9:51 ` Felipe Balbi [this message]
2011-12-06 15:28 ` [regression] Re: [PATCH 3/7] mfd: twl4030-irq: drop the kthread Felipe Contreras
2011-12-07 6:51 ` Felipe Balbi
2011-12-07 11:04 ` Felipe Contreras
2011-12-07 11:30 ` NeilBrown
2011-12-07 18:32 ` Felipe Contreras
2011-12-07 13:39 ` Felipe Balbi
2011-12-07 13:59 ` Jarkko Nikula
2011-12-07 18:31 ` Felipe Contreras
2011-12-12 17:48 ` Felipe Contreras
2011-06-30 9:51 ` [PATCH 4/7] mfd: twl4030-irq: drop mask_work Felipe Balbi
2011-06-30 9:51 ` [PATCH 5/7] mfd: twl4030-irq: drop edge_work Felipe Balbi
2011-06-30 9:51 ` [PATCH 6/7] mfd: twl4030-irq: set irq nested flag Felipe Balbi
2011-12-12 17:58 ` Felipe Contreras
2011-06-30 9:51 ` [PATCH 7/7] rtc: twl: move to threaded irq Felipe Balbi
2011-07-09 4:09 ` [PATCH 0/7] twl4030: finish threaded IRQ conversion Mark Brown
2011-08-18 21:36 ` Felipe Balbi
2011-08-18 21:48 ` Felipe Balbi
2011-08-22 14:54 ` Samuel Ortiz
2011-08-22 18:04 ` Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1309427470-605-4-git-send-email-balbi@ti.com \
--to=balbi@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox