Commit 77c68019 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Wolfram Sang

i2c: xiic: Replace spinlock with mutex

All protected sections are only called from sleep-able context, so there is
no need to use a spinlock.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Reviewed-by: default avatarShubhrajyoti Datta <shubhraj@xilinx.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent c4c696fa
...@@ -70,7 +70,7 @@ struct xiic_i2c { ...@@ -70,7 +70,7 @@ struct xiic_i2c {
wait_queue_head_t wait; wait_queue_head_t wait;
struct i2c_adapter adap; struct i2c_adapter adap;
struct i2c_msg *tx_msg; struct i2c_msg *tx_msg;
spinlock_t lock; struct mutex lock;
unsigned int tx_pos; unsigned int tx_pos;
unsigned int nmsgs; unsigned int nmsgs;
enum xilinx_i2c_state state; enum xilinx_i2c_state state;
...@@ -369,7 +369,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id) ...@@ -369,7 +369,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
* To find which interrupts are pending; AND interrupts pending with * To find which interrupts are pending; AND interrupts pending with
* interrupts masked. * interrupts masked.
*/ */
spin_lock(&i2c->lock); mutex_lock(&i2c->lock);
isr = xiic_getreg32(i2c, XIIC_IISR_OFFSET); isr = xiic_getreg32(i2c, XIIC_IISR_OFFSET);
ier = xiic_getreg32(i2c, XIIC_IIER_OFFSET); ier = xiic_getreg32(i2c, XIIC_IIER_OFFSET);
pend = isr & ier; pend = isr & ier;
...@@ -497,7 +497,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id) ...@@ -497,7 +497,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
dev_dbg(i2c->adap.dev.parent, "%s clr: 0x%x\n", __func__, clr); dev_dbg(i2c->adap.dev.parent, "%s clr: 0x%x\n", __func__, clr);
xiic_setreg32(i2c, XIIC_IISR_OFFSET, clr); xiic_setreg32(i2c, XIIC_IISR_OFFSET, clr);
spin_unlock(&i2c->lock); mutex_unlock(&i2c->lock);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -662,10 +662,10 @@ static void __xiic_start_xfer(struct xiic_i2c *i2c) ...@@ -662,10 +662,10 @@ static void __xiic_start_xfer(struct xiic_i2c *i2c)
static void xiic_start_xfer(struct xiic_i2c *i2c) static void xiic_start_xfer(struct xiic_i2c *i2c)
{ {
spin_lock(&i2c->lock); mutex_lock(&i2c->lock);
xiic_reinit(i2c); xiic_reinit(i2c);
__xiic_start_xfer(i2c); __xiic_start_xfer(i2c);
spin_unlock(&i2c->lock); mutex_unlock(&i2c->lock);
} }
static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
...@@ -745,7 +745,7 @@ static int xiic_i2c_probe(struct platform_device *pdev) ...@@ -745,7 +745,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
i2c->adap.dev.parent = &pdev->dev; i2c->adap.dev.parent = &pdev->dev;
i2c->adap.dev.of_node = pdev->dev.of_node; i2c->adap.dev.of_node = pdev->dev.of_node;
spin_lock_init(&i2c->lock); mutex_init(&i2c->lock);
init_waitqueue_head(&i2c->wait); init_waitqueue_head(&i2c->wait);
ret = devm_request_threaded_irq(&pdev->dev, irq, xiic_isr, ret = devm_request_threaded_irq(&pdev->dev, irq, xiic_isr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment