Commit cd9f13c
committed
can: flexcan: flexcan_chip_start(): fix erroneous flexcan_transceiver_enable() during bus-off recovery
If the CAN controller goes into bus off, the do_set_mode() callback with
CAN_MODE_START can be used to recover the controller, which then calls
flexcan_chip_start(). If configured, this is done automatically by the
framework or manually by the user.
In flexcan_chip_start() there is an explicit call to
flexcan_transceiver_enable(), which does a regulator_enable() on the
transceiver regulator. This results in a net usage counter increase, as there
is no corresponding flexcan_transceiver_disable() in the bus off code path.
This further leads to the transceiver stuck enabled, even if the CAN interface
is shut down.
To fix this problem the
flexcan_transceiver_enable()/flexcan_transceiver_disable() are moved out of
flexcan_chip_start()/flexcan_chip_stop() into flexcan_open()/flexcan_close().
Fixes: e955cea ("CAN: Add Flexcan CAN controller driver")
Link: https://lore.kernel.org/r/20201118150148.2664024-1-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>1 parent d003868 commit cd9f13c
1 file changed
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1567 | 1567 | | |
1568 | 1568 | | |
1569 | 1569 | | |
1570 | | - | |
1571 | | - | |
1572 | | - | |
1573 | | - | |
1574 | 1570 | | |
1575 | 1571 | | |
1576 | 1572 | | |
1577 | | - | |
| 1573 | + | |
1578 | 1574 | | |
1579 | 1575 | | |
1580 | 1576 | | |
| |||
1592 | 1588 | | |
1593 | 1589 | | |
1594 | 1590 | | |
1595 | | - | |
1596 | | - | |
1597 | 1591 | | |
1598 | 1592 | | |
1599 | 1593 | | |
| |||
1623 | 1617 | | |
1624 | 1618 | | |
1625 | 1619 | | |
1626 | | - | |
1627 | 1620 | | |
1628 | 1621 | | |
1629 | 1622 | | |
| |||
1665 | 1658 | | |
1666 | 1659 | | |
1667 | 1660 | | |
1668 | | - | |
| 1661 | + | |
1669 | 1662 | | |
1670 | 1663 | | |
1671 | 1664 | | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
1672 | 1669 | | |
1673 | 1670 | | |
1674 | 1671 | | |
| |||
1720 | 1717 | | |
1721 | 1718 | | |
1722 | 1719 | | |
| 1720 | + | |
| 1721 | + | |
1723 | 1722 | | |
1724 | 1723 | | |
1725 | 1724 | | |
| |||
1738 | 1737 | | |
1739 | 1738 | | |
1740 | 1739 | | |
| 1740 | + | |
1741 | 1741 | | |
1742 | 1742 | | |
1743 | 1743 | | |
| |||
0 commit comments