diff options
Diffstat (limited to 'drivers/net/can/mcp251x.c')
-rw-r--r-- | drivers/net/can/mcp251x.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index 5eaf47b8e37b..f32b9fc6a983 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
@@ -60,6 +60,7 @@ | |||
60 | 60 | ||
61 | #include <linux/can/core.h> | 61 | #include <linux/can/core.h> |
62 | #include <linux/can/dev.h> | 62 | #include <linux/can/dev.h> |
63 | #include <linux/can/led.h> | ||
63 | #include <linux/can/platform/mcp251x.h> | 64 | #include <linux/can/platform/mcp251x.h> |
64 | #include <linux/completion.h> | 65 | #include <linux/completion.h> |
65 | #include <linux/delay.h> | 66 | #include <linux/delay.h> |
@@ -494,6 +495,9 @@ static void mcp251x_hw_rx(struct spi_device *spi, int buf_idx) | |||
494 | 495 | ||
495 | priv->net->stats.rx_packets++; | 496 | priv->net->stats.rx_packets++; |
496 | priv->net->stats.rx_bytes += frame->can_dlc; | 497 | priv->net->stats.rx_bytes += frame->can_dlc; |
498 | |||
499 | can_led_event(priv->net, CAN_LED_EVENT_RX); | ||
500 | |||
497 | netif_rx_ni(skb); | 501 | netif_rx_ni(skb); |
498 | } | 502 | } |
499 | 503 | ||
@@ -707,6 +711,8 @@ static int mcp251x_stop(struct net_device *net) | |||
707 | 711 | ||
708 | mutex_unlock(&priv->mcp_lock); | 712 | mutex_unlock(&priv->mcp_lock); |
709 | 713 | ||
714 | can_led_event(net, CAN_LED_EVENT_STOP); | ||
715 | |||
710 | return 0; | 716 | return 0; |
711 | } | 717 | } |
712 | 718 | ||
@@ -905,6 +911,7 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id) | |||
905 | if (intf & CANINTF_TX) { | 911 | if (intf & CANINTF_TX) { |
906 | net->stats.tx_packets++; | 912 | net->stats.tx_packets++; |
907 | net->stats.tx_bytes += priv->tx_len - 1; | 913 | net->stats.tx_bytes += priv->tx_len - 1; |
914 | can_led_event(net, CAN_LED_EVENT_TX); | ||
908 | if (priv->tx_len) { | 915 | if (priv->tx_len) { |
909 | can_get_echo_skb(net, 0); | 916 | can_get_echo_skb(net, 0); |
910 | priv->tx_len = 0; | 917 | priv->tx_len = 0; |
@@ -968,6 +975,9 @@ static int mcp251x_open(struct net_device *net) | |||
968 | mcp251x_open_clean(net); | 975 | mcp251x_open_clean(net); |
969 | goto open_unlock; | 976 | goto open_unlock; |
970 | } | 977 | } |
978 | |||
979 | can_led_event(net, CAN_LED_EVENT_OPEN); | ||
980 | |||
971 | netif_wake_queue(net); | 981 | netif_wake_queue(net); |
972 | 982 | ||
973 | open_unlock: | 983 | open_unlock: |
@@ -1077,10 +1087,15 @@ static int mcp251x_can_probe(struct spi_device *spi) | |||
1077 | pdata->transceiver_enable(0); | 1087 | pdata->transceiver_enable(0); |
1078 | 1088 | ||
1079 | ret = register_candev(net); | 1089 | ret = register_candev(net); |
1080 | if (!ret) { | 1090 | if (ret) |
1081 | dev_info(&spi->dev, "probed\n"); | 1091 | goto error_probe; |
1082 | return ret; | 1092 | |
1083 | } | 1093 | devm_can_led_init(net); |
1094 | |||
1095 | dev_info(&spi->dev, "probed\n"); | ||
1096 | |||
1097 | return ret; | ||
1098 | |||
1084 | error_probe: | 1099 | error_probe: |
1085 | if (!mcp251x_enable_dma) | 1100 | if (!mcp251x_enable_dma) |
1086 | kfree(priv->spi_rx_buf); | 1101 | kfree(priv->spi_rx_buf); |