Browse Source

can: m_can: make m_can_start and m_can_stop symmetric

This moves clocks gating outside of the m_can_stop function as the
m_can_start function does not (and cannot, at least in current
implementation) ungate clocks. This way, both functions can now be used
symmetrically.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Quentin Schulz 8 years ago
parent
commit
8a3f3f24a8
1 changed files with 2 additions and 3 deletions
  1. 2 3
      drivers/net/can/m_can/m_can.c

+ 2 - 3
drivers/net/can/m_can/m_can.c

@@ -1324,9 +1324,6 @@ static void m_can_stop(struct net_device *dev)
 	/* disable all interrupts */
 	/* disable all interrupts */
 	m_can_disable_all_interrupts(priv);
 	m_can_disable_all_interrupts(priv);
 
 
-	clk_disable_unprepare(priv->hclk);
-	clk_disable_unprepare(priv->cclk);
-
 	/* set the state as STOPPED */
 	/* set the state as STOPPED */
 	priv->can.state = CAN_STATE_STOPPED;
 	priv->can.state = CAN_STATE_STOPPED;
 }
 }
@@ -1338,6 +1335,8 @@ static int m_can_close(struct net_device *dev)
 	netif_stop_queue(dev);
 	netif_stop_queue(dev);
 	napi_disable(&priv->napi);
 	napi_disable(&priv->napi);
 	m_can_stop(dev);
 	m_can_stop(dev);
+	clk_disable_unprepare(priv->hclk);
+	clk_disable_unprepare(priv->cclk);
 	free_irq(dev->irq, dev);
 	free_irq(dev->irq, dev);
 	close_candev(dev);
 	close_candev(dev);
 	can_led_event(dev, CAN_LED_EVENT_STOP);
 	can_led_event(dev, CAN_LED_EVENT_STOP);