mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 00:34:52 +00:00
can: flexcan: move enabling/disabling of interrupts from flexcan_chip_{start,stop}() to callers
The function flexcan_chip_start() first configures the CAN controller and then enables the interrupt, flexcan_chip_stop() does the opposite. In an upcoming patch the order of operations in flexcan_open() and flexcan_close() are changed. This requires flexcan_chip_start()/flexcan_chip_stop_disable_on_error() and flexcan_chip_interrupts_{enable,disable}() to be independent of each other. This patch moves the enabling of the interrupts from flexcan_chip_start() to its callers flexcan_open() and flexcan_resume(). Likewise the disabling of the interrupts is moved from __flexcan_chip_stop() to its indirect callers flexcan_close() and flexcan_suspend(). Link: https://lore.kernel.org/r/20201119100917.3013281-3-mkl@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
1c5e6dbe4c
commit
49dea04439
1 changed files with 9 additions and 4 deletions
|
@ -1598,8 +1598,6 @@ static int flexcan_chip_start(struct net_device *dev)
|
|||
|
||||
priv->can.state = CAN_STATE_ERROR_ACTIVE;
|
||||
|
||||
flexcan_chip_interrupts_enable(dev);
|
||||
|
||||
/* print chip status */
|
||||
netdev_dbg(dev, "%s: reading mcr=0x%08x ctrl=0x%08x\n", __func__,
|
||||
priv->read(®s->mcr), priv->read(®s->ctrl));
|
||||
|
@ -1628,8 +1626,6 @@ static int __flexcan_chip_stop(struct net_device *dev, bool disable_on_error)
|
|||
if (err && !disable_on_error)
|
||||
goto out_chip_unfreeze;
|
||||
|
||||
flexcan_chip_interrupts_disable(dev);
|
||||
|
||||
priv->can.state = CAN_STATE_STOPPED;
|
||||
|
||||
return 0;
|
||||
|
@ -1719,6 +1715,8 @@ static int flexcan_open(struct net_device *dev)
|
|||
if (err)
|
||||
goto out_offload_del;
|
||||
|
||||
flexcan_chip_interrupts_enable(dev);
|
||||
|
||||
can_led_event(dev, CAN_LED_EVENT_OPEN);
|
||||
|
||||
can_rx_offload_enable(&priv->offload);
|
||||
|
@ -1747,6 +1745,7 @@ static int flexcan_close(struct net_device *dev)
|
|||
netif_stop_queue(dev);
|
||||
can_rx_offload_disable(&priv->offload);
|
||||
flexcan_chip_stop_disable_on_error(dev);
|
||||
flexcan_chip_interrupts_disable(dev);
|
||||
|
||||
can_rx_offload_del(&priv->offload);
|
||||
free_irq(dev->irq, dev);
|
||||
|
@ -1770,6 +1769,8 @@ static int flexcan_set_mode(struct net_device *dev, enum can_mode mode)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
flexcan_chip_interrupts_enable(dev);
|
||||
|
||||
netif_wake_queue(dev);
|
||||
break;
|
||||
|
||||
|
@ -2108,6 +2109,8 @@ static int __maybe_unused flexcan_suspend(struct device *device)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
flexcan_chip_interrupts_disable(dev);
|
||||
|
||||
err = pinctrl_pm_select_sleep_state(device);
|
||||
if (err)
|
||||
return err;
|
||||
|
@ -2143,6 +2146,8 @@ static int __maybe_unused flexcan_resume(struct device *device)
|
|||
err = flexcan_chip_start(dev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
flexcan_chip_interrupts_enable(dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue