public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
	Felipe Balbi <balbi@ti.com>
Subject: [RFT/RFC/PATCH 08/13] cbus: retu: headset: convert to threaded_irq
Date: Thu,  3 Feb 2011 12:20:23 +0200	[thread overview]
Message-ID: <1296728428-26399-9-git-send-email-balbi@ti.com> (raw)
In-Reply-To: <1296728428-26399-1-git-send-email-balbi@ti.com>

use the new irq_chip added to retu.c.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/cbus/Makefile       |    2 +-
 drivers/cbus/retu-headset.c |   22 ++++++++++++----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/cbus/Makefile b/drivers/cbus/Makefile
index 3375b82..841bed5 100644
--- a/drivers/cbus/Makefile
+++ b/drivers/cbus/Makefile
@@ -12,4 +12,4 @@ obj-$(CONFIG_CBUS_TAHVO_USER)	+= tahvo-user.o
 #obj-$(CONFIG_CBUS_RETU_POWERBUTTON) += retu-pwrbutton.o
 #obj-$(CONFIG_CBUS_RETU_RTC)	+= retu-rtc.o
 #obj-$(CONFIG_CBUS_RETU_WDT)	+= retu-wdt.o
-#obj-$(CONFIG_CBUS_RETU_HEADSET)	+= retu-headset.o
+obj-$(CONFIG_CBUS_RETU_HEADSET)	+= retu-headset.o
diff --git a/drivers/cbus/retu-headset.c b/drivers/cbus/retu-headset.c
index f5fb50c..2aa4d30 100644
--- a/drivers/cbus/retu-headset.c
+++ b/drivers/cbus/retu-headset.c
@@ -22,6 +22,8 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/irq.h>
+#include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/input.h>
@@ -84,7 +86,6 @@ static void retu_headset_det_enable(struct retu_headset *hs)
 	if (!hs->detection_enabled) {
 		hs->detection_enabled = 1;
 		retu_set_clear_reg_bits(RETU_REG_CC1, (1 << 10) | (1 << 8), 0);
-		retu_enable_irq(RETU_INT_HOOK);
 	}
 	mutex_unlock(&hs->mutex);
 }
@@ -96,7 +97,6 @@ static void retu_headset_det_disable(struct retu_headset *hs)
 	mutex_lock(&hs->mutex);
 	if (hs->detection_enabled) {
 		hs->detection_enabled = 0;
-		retu_disable_irq(RETU_INT_HOOK);
 		del_timer_sync(&hs->enable_timer);
 		del_timer_sync(&hs->detect_timer);
 		spin_lock_irqsave(&hs->lock, flags);
@@ -177,12 +177,11 @@ static DEVICE_ATTR(enable_det, S_IRUGO | S_IWUSR | S_IWGRP,
 		   retu_headset_enable_det_show,
 		   retu_headset_enable_det_store);
 
-static void retu_headset_hook_interrupt(unsigned long arg)
+static irqreturn_t retu_headset_hook_interrupt(int irq, void *_hs)
 {
-	struct retu_headset *hs = (struct retu_headset *) arg;
-	unsigned long flags;
+	struct retu_headset	*hs = _hs;
+	unsigned long		flags;
 
-	retu_ack_irq(RETU_INT_HOOK);
 	spin_lock_irqsave(&hs->lock, flags);
 	if (!hs->pressed) {
 		/* Headset button was just pressed down. */
@@ -192,6 +191,8 @@ static void retu_headset_hook_interrupt(unsigned long arg)
 	spin_unlock_irqrestore(&hs->lock, flags);
 	retu_set_clear_reg_bits(RETU_REG_CC1, 0, (1 << 10) | (1 << 8));
 	mod_timer(&hs->enable_timer, jiffies + msecs_to_jiffies(50));
+
+	return IRQ_HANDLED;
 }
 
 static void retu_headset_enable_timer(unsigned long arg)
@@ -257,13 +258,13 @@ static int __init retu_headset_probe(struct platform_device *pdev)
 	setup_timer(&hs->detect_timer, retu_headset_detect_timer,
 		    (unsigned long) hs);
 
-	r = retu_request_irq(RETU_INT_HOOK, retu_headset_hook_interrupt,
-			     (unsigned long) hs, "hookdet");
+	r = request_threaded_irq(RETU_INT_HOOK, NULL,
+			retu_headset_hook_interrupt, 0, "hookdet", hs);
 	if (r != 0) {
 		dev_err(&pdev->dev, "hookdet IRQ not available\n");
 		goto err6;
 	}
-	retu_disable_irq(RETU_INT_HOOK);
+
 	return 0;
 err6:
 	device_remove_file(&pdev->dev, &dev_attr_enable_det);
@@ -289,9 +290,10 @@ static int retu_headset_remove(struct platform_device *pdev)
 	device_remove_file(&pdev->dev, &dev_attr_enable_det);
 	retu_headset_disable(hs);
 	retu_headset_det_disable(hs);
-	retu_free_irq(RETU_INT_HOOK);
+	free_irq(RETU_INT_HOOK, hs);
 	input_unregister_device(hs->idev);
 	input_free_device(hs->idev);
+
 	return 0;
 }
 
-- 
1.7.4.rc2


  parent reply	other threads:[~2011-02-03 10:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03 10:20 [RFT/RFC/PATCH 00/13] CBUS meets GENIRQ Felipe Balbi
2011-02-03 10:20 ` [RFT/RFC/PATCH 01/13] cbus: retu: get rid of retu-user.c Felipe Balbi
2011-02-03 10:20 ` [RFT/RFC/PATCH 02/13] cbus: retu: give it a context structure Felipe Balbi
2011-02-03 10:20 ` [RFT/RFC/PATCH 03/13] cbus: retu: move module_* close to the matching symbol Felipe Balbi
2011-02-03 10:20 ` [RFT/RFC/PATCH 04/13] cbus: retu: cleanup error path Felipe Balbi
2011-02-03 10:20 ` [RFT/RFC/PATCH 05/13] arm: omap: irqs: add CBUS_RETU_IRQ_BASE and CBUS_RETU_IRQ_END Felipe Balbi
2011-02-03 10:20 ` [RFT/RFC/PATCH 06/13] arm: omap: cbus: pass irq_base and irq_end via platform_data Felipe Balbi
2011-02-03 10:20 ` [RFT/RFC/PATCH 07/13] cbus: retu: move to threaded IRQ and GENIRQ Felipe Balbi
2011-02-03 10:20 ` Felipe Balbi [this message]
2011-02-03 10:20 ` [RFT/RFC/PATCH 09/13] cbus: retu-pwrbutton: convert to threaded irq Felipe Balbi
2011-02-03 10:20 ` [RFT/RFC/PATCH 10/13] cbus: retu-rtc: move " Felipe Balbi
2011-02-03 10:20 ` [RFT/RFC/PATCH 11/13] cbus: retu-rtc: drop the reset_occurred flag Felipe Balbi
2011-02-03 10:20 ` [RFT/RFC/PATCH 12/13] cbus: Makefile: re-enable retu-wdt Felipe Balbi
2011-02-03 10:20 ` [RFT/RFC/PATCH 13/13] cbus: tahvo: drop tahvo-user Felipe Balbi
2011-02-10  2:43 ` [RFT/RFC/PATCH 00/13] CBUS meets GENIRQ Tony Lindgren
2011-02-10  9:14   ` 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=1296728428-26399-9-git-send-email-balbi@ti.com \
    --to=balbi@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --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