i2c: xiic: move the xiic_process to thread context
The xiic_process is a 154 line code that runs in isr context currently move it to thread context. Also the name xiic_process suggests that the intension was to run in process context. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> [wsa: initialized irqreturn_t to IRQ_NONE instead of IRQ_HANDLED] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
0387fc1645
commit
fcc2fac60a
1 changed files with 20 additions and 13 deletions
|
@ -358,8 +358,9 @@ static void xiic_wakeup(struct xiic_i2c *i2c, int code)
|
||||||
wake_up(&i2c->wait);
|
wake_up(&i2c->wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xiic_process(struct xiic_i2c *i2c)
|
static irqreturn_t xiic_process(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
|
struct xiic_i2c *i2c = dev_id;
|
||||||
u32 pend, isr, ier;
|
u32 pend, isr, ier;
|
||||||
u32 clr = 0;
|
u32 clr = 0;
|
||||||
|
|
||||||
|
@ -368,6 +369,7 @@ static void xiic_process(struct xiic_i2c *i2c)
|
||||||
* 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);
|
||||||
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;
|
||||||
|
@ -378,11 +380,6 @@ static void xiic_process(struct xiic_i2c *i2c)
|
||||||
__func__, xiic_getreg8(i2c, XIIC_SR_REG_OFFSET),
|
__func__, xiic_getreg8(i2c, XIIC_SR_REG_OFFSET),
|
||||||
i2c->tx_msg, i2c->nmsgs);
|
i2c->tx_msg, i2c->nmsgs);
|
||||||
|
|
||||||
/* Do not processes a devices interrupts if the device has no
|
|
||||||
* interrupts pending
|
|
||||||
*/
|
|
||||||
if (!pend)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Service requesting interrupt */
|
/* Service requesting interrupt */
|
||||||
if ((pend & XIIC_INTR_ARB_LOST_MASK) ||
|
if ((pend & XIIC_INTR_ARB_LOST_MASK) ||
|
||||||
|
@ -502,6 +499,8 @@ out:
|
||||||
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);
|
||||||
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xiic_bus_busy(struct xiic_i2c *i2c)
|
static int xiic_bus_busy(struct xiic_i2c *i2c)
|
||||||
|
@ -602,16 +601,21 @@ static void xiic_start_send(struct xiic_i2c *i2c)
|
||||||
static irqreturn_t xiic_isr(int irq, void *dev_id)
|
static irqreturn_t xiic_isr(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
struct xiic_i2c *i2c = dev_id;
|
struct xiic_i2c *i2c = dev_id;
|
||||||
|
u32 pend, isr, ier;
|
||||||
spin_lock(&i2c->lock);
|
irqreturn_t ret = IRQ_NONE;
|
||||||
|
/* Do not processes a devices interrupts if the device has no
|
||||||
|
* interrupts pending
|
||||||
|
*/
|
||||||
|
|
||||||
dev_dbg(i2c->adap.dev.parent, "%s entry\n", __func__);
|
dev_dbg(i2c->adap.dev.parent, "%s entry\n", __func__);
|
||||||
|
|
||||||
xiic_process(i2c);
|
isr = xiic_getreg32(i2c, XIIC_IISR_OFFSET);
|
||||||
|
ier = xiic_getreg32(i2c, XIIC_IIER_OFFSET);
|
||||||
|
pend = isr & ier;
|
||||||
|
if (pend)
|
||||||
|
ret = IRQ_WAKE_THREAD;
|
||||||
|
|
||||||
spin_unlock(&i2c->lock);
|
return ret;
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __xiic_start_xfer(struct xiic_i2c *i2c)
|
static void __xiic_start_xfer(struct xiic_i2c *i2c)
|
||||||
|
@ -752,7 +756,10 @@ static int xiic_i2c_probe(struct platform_device *pdev)
|
||||||
spin_lock_init(&i2c->lock);
|
spin_lock_init(&i2c->lock);
|
||||||
init_waitqueue_head(&i2c->wait);
|
init_waitqueue_head(&i2c->wait);
|
||||||
|
|
||||||
ret = devm_request_irq(&pdev->dev, irq, xiic_isr, 0, pdev->name, i2c);
|
ret = devm_request_threaded_irq(&pdev->dev, irq, xiic_isr,
|
||||||
|
xiic_process, IRQF_ONESHOT,
|
||||||
|
pdev->name, i2c);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&pdev->dev, "Cannot claim IRQ\n");
|
dev_err(&pdev->dev, "Cannot claim IRQ\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue