linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Wolfram Sang <wsa@the-dreams.de>, Tony Lindgren <tony@atomide.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-omap@vger.kernel.org>,
	<linux-i2c@vger.kernel.org>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	Kevin Hilman <khilman@linaro.org>
Subject: [PATCH 5/5] i2c: omap: remove omap_i2c_isr() hw irq handler
Date: Fri, 7 Jun 2013 21:46:08 +0300	[thread overview]
Message-ID: <1370630768-4077-6-git-send-email-grygorii.strashko@ti.com> (raw)
In-Reply-To: <1370630768-4077-1-git-send-email-grygorii.strashko@ti.com>

The omap_i2c_isr() does the irq check and schedules threaded handler if any of
enabled IRQs is active, but currently the I2C IRQs are enabled just once,
when I2C IP is enabling (transfer started) and they aren't changed after that.
More over, now the I2C INTC IRQ is disabled when I2C IP is idled.
Thus, I2C IRQs will start coming only when we want that, and there is
no sense to have omap_i2c_isr() anymore:
- omap_i2c_isr_thread() does all needed checks
- synchronization is provided IRQ Core.

So, get rid of omap_i2c_isr(), custom locking and
struct omap_i2c_dev->lock variable.

CC: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---

This is clean-up patch.

 drivers/i2c/busses/i2c-omap.c |   33 +--------------------------------
 1 file changed, 1 insertion(+), 32 deletions(-)

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index b3daf3f..749f390 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -183,7 +183,6 @@ enum {
 #define OMAP_I2C_IP_V2_INTERRUPTS_MASK	0x6FFF
 
 struct omap_i2c_dev {
-	spinlock_t		lock;		/* IRQ synchronization */
 	struct device		*dev;
 	void __iomem		*base;		/* virtual */
 	int			irq;
@@ -876,35 +875,10 @@ static int omap_i2c_transmit_data(struct omap_i2c_dev *dev, u8 num_bytes,
 }
 
 static irqreturn_t
-omap_i2c_isr(int irq, void *dev_id)
-{
-	struct omap_i2c_dev *dev = dev_id;
-	irqreturn_t ret = IRQ_HANDLED;
-	u16 mask;
-	u16 stat;
-
-	spin_lock(&dev->lock);
-	if (pm_runtime_suspended(dev->dev)) {
-		WARN_ONCE(true, "We should never be here!\n");
-		return IRQ_NONE;
-	}
 
-	mask = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
-	stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
-
-	if (stat & mask)
-		ret = IRQ_WAKE_THREAD;
-
-	spin_unlock(&dev->lock);
-
-	return ret;
-}
-
-static irqreturn_t
 omap_i2c_isr_thread(int this_irq, void *dev_id)
 {
 	struct omap_i2c_dev *dev = dev_id;
-	unsigned long flags;
 	u16 bits;
 	u16 stat;
 	int err = 0, count = 0;
@@ -914,7 +888,6 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
 		return IRQ_NONE;
 	}
 
-	spin_lock_irqsave(&dev->lock, flags);
 	do {
 		bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
 		stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
@@ -1035,8 +1008,6 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
 	omap_i2c_complete_cmd(dev, err);
 
 out:
-	spin_unlock_irqrestore(&dev->lock, flags);
-
 	return IRQ_HANDLED;
 }
 
@@ -1146,8 +1117,6 @@ omap_i2c_probe(struct platform_device *pdev)
 	dev->dev = &pdev->dev;
 	dev->irq = irq;
 
-	spin_lock_init(&dev->lock);
-
 	platform_set_drvdata(pdev, dev);
 	init_completion(&dev->cmd_complete);
 
@@ -1229,7 +1198,7 @@ omap_i2c_probe(struct platform_device *pdev)
 				IRQF_NO_SUSPEND, pdev->name, dev);
 	else
 		r = devm_request_threaded_irq(&pdev->dev, dev->irq,
-				omap_i2c_isr, omap_i2c_isr_thread,
+				NULL, omap_i2c_isr_thread,
 				IRQF_NO_SUSPEND | IRQF_ONESHOT,
 				pdev->name, dev);
 
-- 
1.7.9.5


  parent reply	other threads:[~2013-06-07 18:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07 18:46 [PATCH 0/5] v3.10-rc4: fix OMAP4 boot failure if CONFIG_SENSORS_LM75=y Grygorii Strashko
2013-06-07 18:46 ` [PATCH 1/5] i2c: omap: fix spurious IRQs: disable/enable IRQ at INTC when idle Grygorii Strashko
2013-06-07 20:51   ` Kevin Hilman
2013-06-19 18:35     ` Grygorii Strashko
2013-06-19 19:31       ` Felipe Balbi
2013-06-19 20:01         ` Kevin Hilman
2013-06-19 20:56           ` Felipe Balbi
2013-06-07 18:46 ` [PATCH 2/5] i2c: omap: add runtime check in isr to be sure that i2c is enabled Grygorii Strashko
2013-06-07 19:02   ` Felipe Balbi
2013-06-19 18:42     ` Grygorii Strashko
2013-06-19 19:39       ` Felipe Balbi
2013-06-07 18:46 ` [PATCH 3/5] i2c: omap: handle all irqs befor unblocking omap_i2c_xfer_msg() Grygorii Strashko
2013-06-07 19:05   ` Felipe Balbi
2013-06-19 18:43     ` Grygorii Strashko
2013-06-19 19:44       ` Felipe Balbi
2013-06-07 18:46 ` [PATCH 4/5] i2c: omap: query STP always when NACK is received Grygorii Strashko
2013-06-07 19:07   ` Felipe Balbi
2013-06-07 18:46 ` Grygorii Strashko [this message]
2013-06-07 19:07   ` [PATCH 5/5] i2c: omap: remove omap_i2c_isr() hw irq handler Felipe Balbi
2013-06-19 18:43     ` Grygorii Strashko
2013-06-19 19:44       ` 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=1370630768-4077-6-git-send-email-grygorii.strashko@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=khilman@linaro.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).