]> Pileus Git - ~andy/linux/commit
can: mscan: improve clock API use
authorGerhard Sittig <gsi@denx.de>
Fri, 23 Aug 2013 11:09:03 +0000 (13:09 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 29 Aug 2013 20:49:35 +0000 (22:49 +0200)
commit1149108e2fbf98899447d4567901bf07825ee576
tree640ce11fc641ae4e70c37293e5433ea4fd66632c
parent3a09b12e0c2ef26a0e2230606a6159d3038a1572
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 <gsi@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/mscan/mpc5xxx_can.c
drivers/net/can/mscan/mscan.c
drivers/net/can/mscan/mscan.h