802-can-0017-can-flexcan-flexcan_mailbox_read-make-use-of-flexcan.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 6340760d0671e92b15ff92b7eda41bbdd9702437 Mon Sep 17 00:00:00 2001
  2. From: Marc Kleine-Budde <[email protected]>
  3. Date: Fri, 1 Mar 2019 16:27:59 +0100
  4. Subject: [PATCH] can: flexcan: flexcan_mailbox_read() make use of
  5. flexcan_write64() to mark the mailbox as read
  6. In the previous patch the function flexcan_write64() was introduced.
  7. This patch replaces the open coded variant in flexcan_mailbox_read()
  8. that marks a mailbox as read, by a single call to flexcan_write64().
  9. Signed-off-by: Marc Kleine-Budde <[email protected]>
  10. ---
  11. drivers/net/can/flexcan.c | 11 +++--------
  12. 1 file changed, 3 insertions(+), 8 deletions(-)
  13. --- a/drivers/net/can/flexcan.c
  14. +++ b/drivers/net/can/flexcan.c
  15. @@ -885,15 +885,10 @@ static struct sk_buff *flexcan_mailbox_r
  16. }
  17. mark_as_read:
  18. - if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) {
  19. - /* Clear IRQ */
  20. - if (n < 32)
  21. - priv->write(BIT(n), &regs->iflag1);
  22. - else
  23. - priv->write(BIT(n - 32), &regs->iflag2);
  24. - } else {
  25. + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP)
  26. + flexcan_write64(priv, FLEXCAN_IFLAG_MB(n), &regs->iflag1);
  27. + else
  28. priv->write(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, &regs->iflag1);
  29. - }
  30. /* Read the Free Running Timer. It is optional but recommended
  31. * to unlock Mailbox as soon as possible and make it available