summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/flexcan.c
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2017-01-18 11:38:26 +0100
committerMarc Kleine-Budde <mkl@pengutronix.de>2017-02-06 15:13:34 +0100
commita5c02f668c36c05fbbb29d157507be4868ecd176 (patch)
tree0cf3d75e8b240d9ec31654a07738912bf21a4757 /drivers/net/can/flexcan.c
parent238443df8154696018fd01c1a7c8fb352b9ee49e (diff)
downloadlinux-a5c02f668c36c05fbbb29d157507be4868ecd176.tar.bz2
can: flexcan: flexcan_poll_bus_err(): fold in do_bus_err()
This patch folds in the do_bus_err() function into flexcan_poll_bus_err(). Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/flexcan.c')
-rw-r--r--drivers/net/can/flexcan.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 74715174802f..649d636bc41e 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -520,12 +520,17 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK;
}
-static void do_bus_err(struct net_device *dev,
- struct can_frame *cf, u32 reg_esr)
+static int flexcan_poll_bus_err(struct net_device *dev, u32 reg_esr)
{
struct flexcan_priv *priv = netdev_priv(dev);
+ struct sk_buff *skb;
+ struct can_frame *cf;
bool rx_errors = false, tx_errors = false;
+ skb = alloc_can_err_skb(dev, &cf);
+ if (unlikely(!skb))
+ return 0;
+
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
if (reg_esr & FLEXCAN_ESR_BIT1_ERR) {
@@ -566,18 +571,6 @@ static void do_bus_err(struct net_device *dev,
dev->stats.rx_errors++;
if (tx_errors)
dev->stats.tx_errors++;
-}
-
-static int flexcan_poll_bus_err(struct net_device *dev, u32 reg_esr)
-{
- struct sk_buff *skb;
- struct can_frame *cf;
-
- skb = alloc_can_err_skb(dev, &cf);
- if (unlikely(!skb))
- return 0;
-
- do_bus_err(dev, cf, reg_esr);
dev->stats.rx_packets++;
dev->stats.rx_bytes += cf->can_dlc;