Skip to content

Commit

Permalink
can: c_can: Avoid status register update for D_CAN
Browse files Browse the repository at this point in the history
On D_CAN the RXOK, TXOK and LEC bits are cleared/set on read of the
status register. No need to update them.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Thomas Gleixner authored and Marc Kleine-Budde committed Apr 24, 2014
1 parent 6b48ff8 commit b9011aa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/can/c_can/c_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,8 @@ static int c_can_handle_bus_err(struct net_device *dev,
}

/* set a `lec` value so that we can check for updates later */
priv->write_reg(priv, C_CAN_STS_REG, LEC_UNUSED);
if (priv->type != BOSCH_D_CAN)
priv->write_reg(priv, C_CAN_STS_REG, LEC_UNUSED);

stats->rx_packets++;
stats->rx_bytes += cf->can_dlc;
Expand All @@ -1066,11 +1067,13 @@ static int c_can_poll(struct napi_struct *napi, int quota)
C_CAN_STS_REG);

/* handle Tx/Rx events */
if (priv->current_status & STATUS_TXOK)
if (priv->current_status & STATUS_TXOK &&
priv->type != BOSCH_D_CAN)
priv->write_reg(priv, C_CAN_STS_REG,
priv->current_status & ~STATUS_TXOK);

if (priv->current_status & STATUS_RXOK)
if (priv->current_status & STATUS_RXOK &&
priv->type != BOSCH_D_CAN)
priv->write_reg(priv, C_CAN_STS_REG,
priv->current_status & ~STATUS_RXOK);

Expand Down

0 comments on commit b9011aa

Please sign in to comment.