Hi G. B.,

Let's see...

On 10.10.2014 18:32, G. B. wrote:

[snip]

> 
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:926 __clk_enable+0x28/0x98()

                         ^ Note this             ^

> Modules linked in:
> CPU: 0 PID: 1 Comm: swapper Not tainted 3.14.19-ptx-master #21
> [<c00134c8>] (unwind_backtrace) from [<c0011084>] (show_stack+0x10/0x14)
> [<c0011084>] (show_stack) from [<c001c37c>]
> (warn_slowpath_common+0x60/0x80) [<c001c37c>] (warn_slowpath_common) from
> [<c001c3b4>]
> (warn_slowpath_null+0x18/0
> x1c)
> [<c001c3b4>] (warn_slowpath_null) from [<c02a2be8>]
> (__clk_enable+0x28/0x98) [<c02a2be8>] (__clk_enable) from [<c02a3084>]
> (clk_enable+0x18/0x2c) [<c02a3084>] (clk_enable) from [<c0018a28>]
> (s3c_adc_probe+0x12c/0x1a4) [<c0018a28>] (s3c_adc_probe) from [<c020f9ac>]
> (platform_drv_probe+0x1c/0x4c)

As you pointed out, the problem manifests when s3c_adc_probe() is
calling clk_enable(). Now if you look at the warning message, it tells
you the location of the call to WARN(_ON) macro. Looking at the code,
you can find that it's because clk->prepare_count == 0, which means that
nobody called clk_prepare() on the clock before.

Looking at the ADC driver, this seems to be apparently true, as only
operations called on ADC clock are enables and disables. Apparently
nobody has used this driver since a long time and the issue went unnoticed.

As a fix, I'd suggest:

s/clk_enable/clk_prepare_enable/
s/clk_disable/clk_disable_unprepare/

in arch/arm/plat-samsung/adc.c, which should be fine for this particular
driver. (You can read-up more on CCF semantics in Documentation/ and/or
kerneldoc of CCF source files.)

Best regards,
Tomasz

Reply via email to