aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2016-04-04 09:55:23 -0400
committerWolfram Sang <wsa@the-dreams.de>2016-04-24 16:33:09 -0400
commit126a66caec4a00b8d66dbc3174b0efa905cf68c3 (patch)
tree322ace0f7d425b5e4c663e6bfbced4b9969ba48d /drivers/i2c
parentafc34be05331962c2326c24bd0b47baff193b659 (diff)
i2c: omap: drop the lock hard irq context
The lock is taken while reading two registers. On RT the first lock is taken in hard irq where it might sleep and in the threaded irq. The threaded irq runs in oneshot mode so the hard irq does not run until the thread the completes so there is no reason to grab the lock. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> [grygorii.strashko@ti.com: drop locking from isr completely and remove lock field from struct omap_i2c_dev] Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-omap.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 13c45296ce5b..ab1279b8e240 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -185,7 +185,6 @@ enum {
185#define OMAP_I2C_IP_V2_INTERRUPTS_MASK 0x6FFF 185#define OMAP_I2C_IP_V2_INTERRUPTS_MASK 0x6FFF
186 186
187struct omap_i2c_dev { 187struct omap_i2c_dev {
188 spinlock_t lock; /* IRQ synchronization */
189 struct device *dev; 188 struct device *dev;
190 void __iomem *base; /* virtual */ 189 void __iomem *base; /* virtual */
191 int irq; 190 int irq;
@@ -995,15 +994,12 @@ omap_i2c_isr(int irq, void *dev_id)
995 u16 mask; 994 u16 mask;
996 u16 stat; 995 u16 stat;
997 996
998 spin_lock(&omap->lock);
999 mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG);
1000 stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG); 997 stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG);
998 mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG);
1001 999
1002 if (stat & mask) 1000 if (stat & mask)
1003 ret = IRQ_WAKE_THREAD; 1001 ret = IRQ_WAKE_THREAD;
1004 1002
1005 spin_unlock(&omap->lock);
1006
1007 return ret; 1003 return ret;
1008} 1004}
1009 1005
@@ -1011,12 +1007,10 @@ static irqreturn_t
1011omap_i2c_isr_thread(int this_irq, void *dev_id) 1007omap_i2c_isr_thread(int this_irq, void *dev_id)
1012{ 1008{
1013 struct omap_i2c_dev *omap = dev_id; 1009 struct omap_i2c_dev *omap = dev_id;
1014 unsigned long flags;
1015 u16 bits; 1010 u16 bits;
1016 u16 stat; 1011 u16 stat;
1017 int err = 0, count = 0; 1012 int err = 0, count = 0;
1018 1013
1019 spin_lock_irqsave(&omap->lock, flags);
1020 do { 1014 do {
1021 bits = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG); 1015 bits = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG);
1022 stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG); 1016 stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG);
@@ -1142,8 +1136,6 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
1142 omap_i2c_complete_cmd(omap, err); 1136 omap_i2c_complete_cmd(omap, err);
1143 1137
1144out: 1138out:
1145 spin_unlock_irqrestore(&omap->lock, flags);
1146
1147 return IRQ_HANDLED; 1139 return IRQ_HANDLED;
1148} 1140}
1149 1141
@@ -1330,8 +1322,6 @@ omap_i2c_probe(struct platform_device *pdev)
1330 omap->dev = &pdev->dev; 1322 omap->dev = &pdev->dev;
1331 omap->irq = irq; 1323 omap->irq = irq;
1332 1324
1333 spin_lock_init(&omap->lock);
1334
1335 platform_set_drvdata(pdev, omap); 1325 platform_set_drvdata(pdev, omap);
1336 init_completion(&omap->cmd_complete); 1326 init_completion(&omap->cmd_complete);
1337 1327