9c2dde99a96096ae48e152499620a15d664e839f
[openwrt/staging/adrian.git] /
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
5 needed
6
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
9 rx-offload framework.
10
11 This patch optimizes the function by only reading the timestamp, if a
12 state change is detected.
13
14 Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
15 ---
16 drivers/net/can/flexcan.c | 4 ++--
17 1 file changed, 2 insertions(+), 2 deletions(-)
18
19 --- a/drivers/net/can/flexcan.c
20 +++ b/drivers/net/can/flexcan.c
21 @@ -743,8 +743,6 @@ static void flexcan_irq_state(struct net
22 u32 timestamp;
23 int err;
24
25 - timestamp = priv->read(&regs->timer) << 16;
26 -
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 @@ -764,6 +762,8 @@ static void flexcan_irq_state(struct net
31 if (likely(new_state == priv->can.state))
32 return;
33
34 + timestamp = priv->read(&regs->timer) << 16;
35 +
36 skb = alloc_can_err_skb(dev, &cf);
37 if (unlikely(!skb))
38 return;