From 1149108e2fbf98899447d4567901bf07825ee576 Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Fri, 23 Aug 2013 13:09:03 +0200 Subject: can: mscan: improve clock API use the .get_clock() callback is run from probe() and might allocate resources, introduce a .put_clock() callback that is run from remove() to undo any allocation activities prepare and enable the clocks in open(), disable and unprepare the clocks in close() if clocks were acquired during probe(), to not assume knowledge about which activities are done in probe() and remove() use devm_get_clk() to lookup the SYS and REF clocks, to have the clocks put upon device shutdown store pointers to data structures upon successful allocation already instead of deferral until complete setup, such that subroutines in the setup sequence may access those data structures as well to track their resource acquisition since clock allocation remains optional, the release callback as well as the enable/disable calls in open/close are optional as well Cc: linux-can@vger.kernel.org Cc: netdev@vger.kernel.org Signed-off-by: Gerhard Sittig Signed-off-by: Anatolij Gustschin Signed-off-by: Marc Kleine-Budde --- drivers/net/can/mscan/mscan.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/net/can/mscan/mscan.h') diff --git a/drivers/net/can/mscan/mscan.h b/drivers/net/can/mscan/mscan.h index af2ed8baf0a3..9c24d60a23b1 100644 --- a/drivers/net/can/mscan/mscan.h +++ b/drivers/net/can/mscan/mscan.h @@ -21,6 +21,7 @@ #ifndef __MSCAN_H__ #define __MSCAN_H__ +#include #include /* MSCAN control register 0 (CANCTL0) bits */ @@ -283,6 +284,8 @@ struct mscan_priv { unsigned int type; /* MSCAN type variants */ unsigned long flags; void __iomem *reg_base; /* ioremap'ed address to registers */ + struct clk *clk_ipg; /* clock for registers */ + struct clk *clk_can; /* clock for bitrates */ u8 shadow_statflg; u8 shadow_canrier; u8 cur_pri; -- cgit v1.2.3