[PATCH RFC 0/2] Clock unregistration support in the common clock framework
s.nawrocki at samsung.com
Tue Aug 6 11:51:55 EDT 2013
This short patch set aims to fix issues in the common clock framework WRT
support of the clock suppliers as loadable modules. The thread  might
be a good summary and pre-requisiste reading on what this patch series is
trying to achieve.
The first patch adds common implementation of the __clk_get(), __clk_put()
helpers for the common clock framework. Currently these functions are empty
and the modules that registered clocks are prone to removal and leaving
invalid clock references.
The second patch adds implementation of the clk_unregister() function and
is based on patch .
I have some doubts whether we need to be taking reference on a module in
clk_get() _and_ use kref to keep track of references to a clock. Taking
reference on a module only seems insufficient, since a clock supplier
driver can be unbound from its device through sysfs, even if the module
stays in place.
We could be doing only reference counting on the clock, but then there
are issues as Russell clearly explained in . It is not obvious what
to do with a clock when it has consumers and its supplier driver is
being deinitialized/unloaded . IMHO clock suppliers should be normally
prevented from being removed when resources they provide are in use,
otherwise it all may get a bit hairy.
Sylwester Nawrocki (2):
clk: add common __clk_get(), __clk_put() implementations
clk: implement clk_unregister
arch/arm/include/asm/clkdev.h | 2 +
arch/blackfin/include/asm/clkdev.h | 2 +
arch/mips/include/asm/clkdev.h | 2 +
arch/sh/include/asm/clkdev.h | 2 +
drivers/clk/clk.c | 147 +++++++++++++++++++++++++++++++++++-
include/linux/clk-private.h | 5 ++
include/linux/clkdev.h | 5 ++
7 files changed, 162 insertions(+), 3 deletions(-)
More information about the linux-arm-kernel