Skip to contentSkip to conversation

can: at91_can: prepare and unprepare the clock

PATCH New David Dueck 2 participants 3 messages Sep 17, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 can: at91_can: prepare and unprepare the clock

This prevents a warning.

---
 drivers/net/can/at91_can.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/at91_can.c +3 -3
index f07fa89..7dcb790 100644
@@ -1123,7 +1123,7 @@ static int at91_open(struct net_device *dev)
 	struct at91_priv *priv = netdev_priv(dev);
 	int err;
 
-	clk_enable(priv->clk);
+	clk_prepare_enable(priv->clk);
 
 	/* check or determine and set bittime */
 	err = open_candev(dev);
@@ -1149,7 +1149,7 @@ static int at91_open(struct net_device *dev)
  out_close:
 	close_candev(dev);
  out:
-	clk_disable(priv->clk);
+	clk_disable_unprepare(priv->clk);
 
 	return err;
 }
@@ -1166,7 +1166,7 @@ static int at91_close(struct net_device *dev)
 	at91_chip_stop(dev, CAN_STATE_STOPPED);
 
 	free_irq(dev->irq, dev);
-	clk_disable(priv->clk);
+	clk_disable_unprepare(priv->clk);
 
 	close_candev(dev);
 
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 can: at91_can: prepare and unprepare the clock

Quoted 1 line · David Dueck

This prevents a warning.

Which warning?

Can you please check the return value of clock_prepare_enbale().

Marc

BTW: Please add linux-can at vger.kernel.org on Cc for CAN related patches.

Quoted 38 lines
---
 drivers/net/can/at91_can.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/at91_can.c +3 -3
index f07fa89..7dcb790 100644
@@ -1123,7 +1123,7 @@ static int at91_open(struct net_device *dev)
 	struct at91_priv *priv = netdev_priv(dev);
 	int err;
 
-	clk_enable(priv->clk);
+	clk_prepare_enable(priv->clk);
 
 	/* check or determine and set bittime */
 	err = open_candev(dev);
@@ -1149,7 +1149,7 @@ static int at91_open(struct net_device *dev)
  out_close:
 	close_candev(dev);
  out:
-	clk_disable(priv->clk);
+	clk_disable_unprepare(priv->clk);
 
 	return err;
 }
@@ -1166,7 +1166,7 @@ static int at91_close(struct net_device *dev)
 	at91_chip_stop(dev, CAN_STATE_STOPPED);
 
 	free_irq(dev->irq, dev);
-	clk_disable(priv->clk);
+	clk_disable_unprepare(priv->clk);
 
 	close_candev(dev);
 
Signature · 14 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140917/e395fcfd/attachment-0001.sig>
author
#2 lore raw

PATCH 1/1 can: at91_can: prepare and unprepare the clock

2014-09-17 11:12 GMT+02:00 Marc Kleine-Budde <[email protected]>:

Quoted 1 line

Which warning?

I will rephrase this. When using COMMON_CLK, for example on sama5d3, we have to prepare the clock first. I will send v2.

Quoted 1 line

Can you please check the return value of clock_prepare_enbale().

Yes, sorry I missed that.

David