]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
can: rcar_can: TFCR bitfield conversion
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 22 Aug 2025 10:17:08 +0000 (12:17 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Fri, 19 Sep 2025 17:25:16 +0000 (19:25 +0200)
Convert CAN Transmit FIFO Control Register field accesses to use the
FIELD_GET() bitfield access macro.

This gets rid of an explicit shift.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/a8b1dc6f1249a01af9b691ca59e2e5cc2dba6d44.1755857536.git.geert+renesas@glider.be
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/rcar/rcar_can.c

index 8b4356fcd7d2fddb74c1fa9b42cee665c307b0e4..6f28dc9354511120571f36d35eb1e9f7df3ec78f 100644 (file)
@@ -145,8 +145,6 @@ static const struct can_bittiming_const rcar_can_bittiming_const = {
 /* Transmit FIFO Control Register bits */
 #define RCAR_CAN_TFCR_TFUST    GENMASK(3, 1)   /* Transmit FIFO Unsent Message */
                                                /* Number Status Bits */
-#define RCAR_CAN_TFCR_TFUST_SHIFT 1            /* Offset of Transmit FIFO Unsent */
-                                               /* Message Number Status Bits */
 #define RCAR_CAN_TFCR_TFE      BIT(0)          /* Transmit FIFO Enable */
 
 #define RCAR_CAN_N_RX_MKREGS1  2               /* Number of mask registers */
@@ -377,10 +375,9 @@ static void rcar_can_tx_done(struct net_device *ndev)
        u8 isr;
 
        while (1) {
-               u8 unsent = readb(&priv->regs->tfcr);
+               u8 unsent = FIELD_GET(RCAR_CAN_TFCR_TFUST,
+                           readb(&priv->regs->tfcr));
 
-               unsent = (unsent & RCAR_CAN_TFCR_TFUST) >>
-                         RCAR_CAN_TFCR_TFUST_SHIFT;
                if (priv->tx_head - priv->tx_tail <= unsent)
                        break;
                stats->tx_packets++;