From: Marek Vasut <marex@denx.de>
To: linux-i2c@vger.kernel.org
Cc: Marek Vasut <marex@denx.de>,
Michal Simek <michal.simek@xilinx.com>,
Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>,
Wolfram Sang <wsa@kernel.org>
Subject: [PATCH 2/5] i2c: xiic: Drop broken interrupt handler
Date: Sat, 13 Jun 2020 17:07:48 +0200 [thread overview]
Message-ID: <20200613150751.114595-2-marex@denx.de> (raw)
In-Reply-To: <20200613150751.114595-1-marex@denx.de>
The interrupt handler is missing locking when reading out registers
and is racing with other threads which might access the driver. Drop
it altogether, so that the threaded interrupt is always executed, as
that one is already serialized by the driver mutex. This also allows
dropping local_irq_save()/local_irq_restore() in xiic_start_recv().
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Cc: Wolfram Sang <wsa@kernel.org>
---
drivers/i2c/busses/i2c-xiic.c | 25 +------------------------
1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 0777e577720db..6db71c0fb6583 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -543,7 +543,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
{
u8 rx_watermark;
struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
- unsigned long flags;
/* Clear and enable Rx full interrupt. */
xiic_irq_clr_en(i2c, XIIC_INTR_RX_FULL_MASK | XIIC_INTR_TX_ERROR_MASK);
@@ -559,7 +558,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
rx_watermark = IIC_RX_FIFO_DEPTH;
xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rx_watermark - 1);
- local_irq_save(flags);
if (!(msg->flags & I2C_M_NOSTART))
/* write the address */
xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET,
@@ -569,7 +567,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET,
msg->len | ((i2c->nmsgs == 1) ? XIIC_TX_DYN_STOP_MASK : 0));
- local_irq_restore(flags);
if (i2c->nmsgs == 1)
/* very last, enable bus not busy as well */
@@ -609,26 +606,6 @@ static void xiic_start_send(struct xiic_i2c *i2c)
XIIC_INTR_BNB_MASK);
}
-static irqreturn_t xiic_isr(int irq, void *dev_id)
-{
- struct xiic_i2c *i2c = dev_id;
- u32 pend, isr, ier;
- 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__);
-
- isr = xiic_getreg32(i2c, XIIC_IISR_OFFSET);
- ier = xiic_getreg32(i2c, XIIC_IIER_OFFSET);
- pend = isr & ier;
- if (pend)
- ret = IRQ_WAKE_THREAD;
-
- return ret;
-}
-
static void __xiic_start_xfer(struct xiic_i2c *i2c)
{
int first = 1;
@@ -807,7 +784,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
pm_runtime_use_autosuspend(i2c->dev);
pm_runtime_set_active(i2c->dev);
pm_runtime_enable(i2c->dev);
- ret = devm_request_threaded_irq(&pdev->dev, irq, xiic_isr,
+ ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
xiic_process, IRQF_ONESHOT,
pdev->name, i2c);
--
2.26.2
next prev parent reply other threads:[~2020-06-13 15:08 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-13 15:07 [PATCH 1/5] i2c: xiic: Fix broken locking on tx_msg Marek Vasut
2020-06-13 15:07 ` Marek Vasut [this message]
2020-06-17 12:25 ` [PATCH 2/5] i2c: xiic: Drop broken interrupt handler Shubhrajyoti Datta
2020-06-17 12:31 ` Marek Vasut
2020-06-26 12:13 ` Raviteja Narayanam
2020-06-28 23:41 ` Marek Vasut
2020-06-29 12:52 ` Raviteja Narayanam
2020-06-29 21:50 ` Marek Vasut
2020-07-08 15:23 ` Raviteja Narayanam
2020-08-19 17:42 ` Marek Vasut
2020-08-24 8:27 ` Raviteja Narayanam
2020-08-24 11:58 ` Marek Vasut
2020-08-25 9:44 ` Raviteja Narayanam
2020-08-25 20:50 ` Marek Vasut
2020-09-07 8:51 ` Raviteja Narayanam
2020-09-08 14:04 ` Marek Vasut
2020-09-11 10:28 ` Michal Simek
2020-06-13 15:07 ` [PATCH 3/5] i2c: xiic: Defer xiic_wakeup() and __xiic_start_xfer() in xiic_process() Marek Vasut
2020-06-26 12:13 ` Raviteja Narayanam
2020-07-08 15:23 ` Raviteja Narayanam
2020-06-13 15:07 ` [PATCH 4/5] i2c: xiic: Switch from waitqueue to completion Marek Vasut
2020-06-26 12:13 ` Raviteja Narayanam
2020-06-28 23:41 ` Marek Vasut
2020-06-29 12:53 ` Raviteja Narayanam
2020-06-29 21:52 ` Marek Vasut
2020-06-13 15:07 ` [PATCH 5/5] i2c: xiic: Only ever transfer single message Marek Vasut
2020-06-13 19:33 ` Wolfram Sang
2020-06-13 19:37 ` Marek Vasut
2020-06-13 19:42 ` Wolfram Sang
2020-07-13 8:37 ` Michal Simek
2020-06-26 12:14 ` Raviteja Narayanam
2020-06-26 12:11 ` [PATCH 1/5] i2c: xiic: Fix broken locking on tx_msg Raviteja Narayanam
2020-06-28 23:18 ` Marek Vasut
2020-06-29 12:52 ` Raviteja Narayanam
2020-07-08 15:23 ` Raviteja Narayanam
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=20200613150751.114595-2-marex@denx.de \
--to=marex@denx.de \
--cc=linux-i2c@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=shubhrajyoti.datta@xilinx.com \
--cc=wsa@kernel.org \
/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).