Skip to content

Commit

Permalink
can: m_can: m_can_stop(): set device to software init mode before clo…
Browse files Browse the repository at this point in the history
…sing

[ Upstream commit a584e9b ]

There might be some requests pending in the buffer when the interface close
sequence occurs. In some devices, these pending requests might lead to the
module not shutting down properly when m_can_clk_stop() is called.

Therefore, move the device to init state before potentially powering it down.

Fixes: e0d1f48 ("can: m_can: add Bosch M_CAN controller support")
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Acked-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200825055442.16994-1-faiz_abbas@ti.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Faiz-Abbas authored and gregkh committed Nov 24, 2020
1 parent ca9929a commit 7db7f6c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/can/m_can/m_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,9 @@ static void m_can_stop(struct net_device *dev)
/* disable all interrupts */
m_can_disable_all_interrupts(cdev);

/* Set init mode to disengage from the network */
m_can_config_endisable(cdev, true);

/* set the state as STOPPED */
cdev->can.state = CAN_STATE_STOPPED;
}
Expand Down

0 comments on commit 7db7f6c

Please sign in to comment.