From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux-can@vger.kernel.org,
kernel@pengutronix.de,
Matthias Schiffer <matthias.schiffer@ew.tq-group.com>,
stable@vger.kernel.org, Matt Kline <matt@bitbashing.io>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH net 5/9] can: m_can: pci: fix iomap_read_fifo() and iomap_write_fifo()
Date: Tue, 7 Dec 2021 11:24:16 +0100 [thread overview]
Message-ID: <20211207102420.120131-6-mkl@pengutronix.de> (raw)
In-Reply-To: <20211207102420.120131-1-mkl@pengutronix.de>
From: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
The same fix that was previously done in m_can_platform in commit
99d173fbe894 ("can: m_can: fix iomap_read_fifo() and iomap_write_fifo()")
is required in m_can_pci as well to make iomap_read_fifo() and
iomap_write_fifo() work for val_count > 1.
Fixes: 812270e5445b ("can: m_can: Batch FIFO writes during CAN transmit")
Fixes: 1aa6772f64b4 ("can: m_can: Batch FIFO reads during CAN receive")
Link: https://lore.kernel.org/all/20211118144011.10921-1-matthias.schiffer@ew.tq-group.com
Cc: stable@vger.kernel.org
Cc: Matt Kline <matt@bitbashing.io>
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/m_can/m_can_pci.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/m_can/m_can_pci.c b/drivers/net/can/m_can/m_can_pci.c
index 89cc3d41e952..d72c294ac4d3 100644
--- a/drivers/net/can/m_can/m_can_pci.c
+++ b/drivers/net/can/m_can/m_can_pci.c
@@ -42,8 +42,13 @@ static u32 iomap_read_reg(struct m_can_classdev *cdev, int reg)
static int iomap_read_fifo(struct m_can_classdev *cdev, int offset, void *val, size_t val_count)
{
struct m_can_pci_priv *priv = cdev_to_priv(cdev);
+ void __iomem *src = priv->base + offset;
- ioread32_rep(priv->base + offset, val, val_count);
+ while (val_count--) {
+ *(unsigned int *)val = ioread32(src);
+ val += 4;
+ src += 4;
+ }
return 0;
}
@@ -61,8 +66,13 @@ static int iomap_write_fifo(struct m_can_classdev *cdev, int offset,
const void *val, size_t val_count)
{
struct m_can_pci_priv *priv = cdev_to_priv(cdev);
+ void __iomem *dst = priv->base + offset;
- iowrite32_rep(priv->base + offset, val, val_count);
+ while (val_count--) {
+ iowrite32(*(unsigned int *)val, dst);
+ val += 4;
+ dst += 4;
+ }
return 0;
}
--
2.33.0
next prev parent reply other threads:[~2021-12-07 10:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-07 10:24 [PATCH net 0/9] pull-request: can 2021-12-07 Marc Kleine-Budde
2021-12-07 10:24 ` [PATCH net 1/9] can: pch_can: pch_can_rx_normal: fix use after free Marc Kleine-Budde
2021-12-07 18:40 ` patchwork-bot+netdevbpf
2021-12-07 10:24 ` [PATCH net 2/9] can: sja1000: fix use after free in ems_pcmcia_add_card() Marc Kleine-Budde
2021-12-07 10:24 ` [PATCH net 3/9] can: m_can: Disable and ignore ELO interrupt Marc Kleine-Budde
2021-12-07 10:24 ` [PATCH net 4/9] can: m_can: m_can_read_fifo: fix memory leak in error branch Marc Kleine-Budde
2021-12-07 10:24 ` Marc Kleine-Budde [this message]
2021-12-07 10:24 ` [PATCH net 6/9] can: m_can: pci: fix incorrect reference clock rate Marc Kleine-Budde
2021-12-07 10:24 ` [PATCH net 7/9] Revert "can: m_can: remove support for custom bit timing" Marc Kleine-Budde
2021-12-07 10:24 ` [PATCH net 8/9] can: m_can: make custom bittiming fields const Marc Kleine-Budde
2021-12-07 10:24 ` [PATCH net 9/9] can: m_can: pci: use custom bit timings for Elkhart Lake Marc Kleine-Budde
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=20211207102420.120131-6-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=davem@davemloft.net \
--cc=jarkko.nikula@linux.intel.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=matt@bitbashing.io \
--cc=matthias.schiffer@ew.tq-group.com \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.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