can: c_can: Avoid led toggling for every packet.
authorThomas Gleixner <tglx@linutronix.de>
Tue, 18 Mar 2014 17:19:15 +0000 (17:19 +0000)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 1 Apr 2014 09:55:02 +0000 (11:55 +0200)
There is no point to toggle the RX led for every packet. Especially if
we have a full FIFO we want to avoid everything we can.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/c_can/c_can.c

index 42c038d523c98a48ccd8250b43c534114b182601..01dc4941e3d003945f17026d6d47e0e77b227cf4 100644 (file)
@@ -433,9 +433,6 @@ static int c_can_read_msg_object(struct net_device *dev, int iface, int ctrl)
 
        stats->rx_packets++;
        stats->rx_bytes += frame->can_dlc;
-
-       can_led_event(dev, CAN_LED_EVENT_RX);
-
        return 0;
 }
 
@@ -901,6 +898,10 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
                pkts += n;
                quota -= n;
        }
+
+       if (pkts)
+               can_led_event(dev, CAN_LED_EVENT_RX);
+
        return pkts;
 }