Skip to content

Commit 75f3194

Browse files
geertumarckleinebudde
authored andcommitted
can: rcar_can: TFCR bitfield conversion
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>
1 parent 669abc4 commit 75f3194

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/net/can/rcar/rcar_can.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ static const struct can_bittiming_const rcar_can_bittiming_const = {
145145
/* Transmit FIFO Control Register bits */
146146
#define RCAR_CAN_TFCR_TFUST GENMASK(3, 1) /* Transmit FIFO Unsent Message */
147147
/* Number Status Bits */
148-
#define RCAR_CAN_TFCR_TFUST_SHIFT 1 /* Offset of Transmit FIFO Unsent */
149-
/* Message Number Status Bits */
150148
#define RCAR_CAN_TFCR_TFE BIT(0) /* Transmit FIFO Enable */
151149

152150
#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)
377375
u8 isr;
378376

379377
while (1) {
380-
u8 unsent = readb(&priv->regs->tfcr);
378+
u8 unsent = FIELD_GET(RCAR_CAN_TFCR_TFUST,
379+
readb(&priv->regs->tfcr));
381380

382-
unsent = (unsent & RCAR_CAN_TFCR_TFUST) >>
383-
RCAR_CAN_TFCR_TFUST_SHIFT;
384381
if (priv->tx_head - priv->tx_tail <= unsent)
385382
break;
386383
stats->tx_packets++;

0 commit comments

Comments
 (0)