Commit a5c02f66 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

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: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 238443df
...@@ -520,12 +520,17 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -520,12 +520,17 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
static void do_bus_err(struct net_device *dev, static int flexcan_poll_bus_err(struct net_device *dev, u32 reg_esr)
struct can_frame *cf, u32 reg_esr)
{ {
struct flexcan_priv *priv = netdev_priv(dev); struct flexcan_priv *priv = netdev_priv(dev);
struct sk_buff *skb;
struct can_frame *cf;
bool rx_errors = false, tx_errors = false; 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; cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
if (reg_esr & FLEXCAN_ESR_BIT1_ERR) { if (reg_esr & FLEXCAN_ESR_BIT1_ERR) {
...@@ -566,18 +571,6 @@ static void do_bus_err(struct net_device *dev, ...@@ -566,18 +571,6 @@ static void do_bus_err(struct net_device *dev,
dev->stats.rx_errors++; dev->stats.rx_errors++;
if (tx_errors) if (tx_errors)
dev->stats.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_packets++;
dev->stats.rx_bytes += cf->can_dlc; dev->stats.rx_bytes += cf->can_dlc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment