1 From 1a92e5a9109963e2491eec111b84b35b4e2adc8f Mon Sep 17 00:00:00 2001
2 From: Marc Kleine-Budde <mkl@pengutronix.de>
3 Date: Wed, 9 Oct 2019 15:15:37 +0200
4 Subject: [PATCH] can: flexcan: flexcan_irq_state(): only read timestamp if
7 The function flexcan_irq_state() checks the controller for CAN state
8 changes and pushes a skb with the new state and a timestamp into the
11 This patch optimizes the function by only reading the timestamp, if a
12 state change is detected.
14 Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
16 drivers/net/can/flexcan.c | 4 ++--
17 1 file changed, 2 insertions(+), 2 deletions(-)
19 --- a/drivers/net/can/flexcan.c
20 +++ b/drivers/net/can/flexcan.c
21 @@ -745,8 +745,6 @@ static void flexcan_irq_state(struct net
25 - timestamp = priv->read(®s->timer) << 16;
27 flt = reg_esr & FLEXCAN_ESR_FLT_CONF_MASK;
28 if (likely(flt == FLEXCAN_ESR_FLT_CONF_ACTIVE)) {
29 tx_state = unlikely(reg_esr & FLEXCAN_ESR_TX_WRN) ?
30 @@ -766,6 +764,8 @@ static void flexcan_irq_state(struct net
31 if (likely(new_state == priv->can.state))
34 + timestamp = priv->read(®s->timer) << 16;
36 skb = alloc_can_err_skb(dev, &cf);