can: m_can: add deinit callback

This is added in preparation for calling standby mode in the tcan4x5x
driver or other users of m_can.
For the tcan4x5x; If Vsup 12V, standby mode will save 7-8mA, when the
interface is down.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Link: https://patch.msgid.link/20241122-tcan-standby-v3-1-90bafaf5eccd@geanix.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
Sean Nyekjaer 2024-11-22 15:52:22 +01:00 committed by Marc Kleine-Budde
parent d50c837675
commit baa8aaf797
2 changed files with 8 additions and 0 deletions

View File

@ -1756,6 +1756,13 @@ static void m_can_stop(struct net_device *dev)
/* set the state as STOPPED */
cdev->can.state = CAN_STATE_STOPPED;
if (cdev->ops->deinit) {
ret = cdev->ops->deinit(cdev);
if (ret)
netdev_err(dev, "failed to deinitialize: %pe\n",
ERR_PTR(ret));
}
}
static int m_can_close(struct net_device *dev)

View File

@ -68,6 +68,7 @@ struct m_can_ops {
int (*write_fifo)(struct m_can_classdev *cdev, int addr_offset,
const void *val, size_t val_count);
int (*init)(struct m_can_classdev *cdev);
int (*deinit)(struct m_can_classdev *cdev);
};
struct m_can_tx_op {