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

can: flexcan: do_bus_err(): convert rx_,tx_errors into bool

This patch converts the rx_errors and tx_errors from int into bool
values, to reflect their actual meaning.
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent a3c11a7a
...@@ -524,41 +524,41 @@ static void do_bus_err(struct net_device *dev, ...@@ -524,41 +524,41 @@ static void do_bus_err(struct net_device *dev,
struct can_frame *cf, u32 reg_esr) struct can_frame *cf, u32 reg_esr)
{ {
struct flexcan_priv *priv = netdev_priv(dev); struct flexcan_priv *priv = netdev_priv(dev);
int rx_errors = 0, tx_errors = 0; bool rx_errors = false, tx_errors = false;
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) {
netdev_dbg(dev, "BIT1_ERR irq\n"); netdev_dbg(dev, "BIT1_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_BIT1; cf->data[2] |= CAN_ERR_PROT_BIT1;
tx_errors = 1; tx_errors = true;
} }
if (reg_esr & FLEXCAN_ESR_BIT0_ERR) { if (reg_esr & FLEXCAN_ESR_BIT0_ERR) {
netdev_dbg(dev, "BIT0_ERR irq\n"); netdev_dbg(dev, "BIT0_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_BIT0; cf->data[2] |= CAN_ERR_PROT_BIT0;
tx_errors = 1; tx_errors = true;
} }
if (reg_esr & FLEXCAN_ESR_ACK_ERR) { if (reg_esr & FLEXCAN_ESR_ACK_ERR) {
netdev_dbg(dev, "ACK_ERR irq\n"); netdev_dbg(dev, "ACK_ERR irq\n");
cf->can_id |= CAN_ERR_ACK; cf->can_id |= CAN_ERR_ACK;
cf->data[3] = CAN_ERR_PROT_LOC_ACK; cf->data[3] = CAN_ERR_PROT_LOC_ACK;
tx_errors = 1; tx_errors = true;
} }
if (reg_esr & FLEXCAN_ESR_CRC_ERR) { if (reg_esr & FLEXCAN_ESR_CRC_ERR) {
netdev_dbg(dev, "CRC_ERR irq\n"); netdev_dbg(dev, "CRC_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_BIT; cf->data[2] |= CAN_ERR_PROT_BIT;
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ; cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
rx_errors = 1; rx_errors = true;
} }
if (reg_esr & FLEXCAN_ESR_FRM_ERR) { if (reg_esr & FLEXCAN_ESR_FRM_ERR) {
netdev_dbg(dev, "FRM_ERR irq\n"); netdev_dbg(dev, "FRM_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_FORM; cf->data[2] |= CAN_ERR_PROT_FORM;
rx_errors = 1; rx_errors = true;
} }
if (reg_esr & FLEXCAN_ESR_STF_ERR) { if (reg_esr & FLEXCAN_ESR_STF_ERR) {
netdev_dbg(dev, "STF_ERR irq\n"); netdev_dbg(dev, "STF_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_STUFF; cf->data[2] |= CAN_ERR_PROT_STUFF;
rx_errors = 1; rx_errors = true;
} }
priv->can.can_stats.bus_error++; priv->can.can_stats.bus_error++;
......
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