[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1918100.pYljUktTbF@avalon>
Date: Mon, 28 Oct 2013 21:26:22 +0100
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Sylwester Nawrocki <sylvester.nawrocki@...il.com>
Cc: linux@....linux.org.uk, mturquette@...aro.org,
Sylwester Nawrocki <s.nawrocki@...sung.com>,
linux-arm-kernel@...ts.infradead.org, jiada_wang@...tor.com,
kyungmin.park@...sung.com, myungjoo.ham@...sung.com,
t.figa@...sung.com, g.liakhovetski@....de,
linux-kernel@...r.kernel.org, linux-mips@...ux-mips.org,
linux-sh@...r.kernel.org, LMML <linux-media@...r.kernel.org>
Subject: Re: [PATCH v6 0/5] clk: clock deregistration support
Hi Sylwester,
On Tuesday 15 October 2013 22:04:17 Sylwester Nawrocki wrote:
> Hi,
>
> (adding linux-media mailing list at Cc)
>
> On 09/25/2013 11:47 AM, Laurent Pinchart wrote:
> > On Tuesday 24 September 2013 23:38:44 Sylwester Nawrocki wrote:
> [...]
>
> >> The only issue I found might be at the omap3isp driver, which provides
> >> clock to its sub-drivers and takes reference on the sub-driver modules.
> >> When sub-driver calls clk_get() all modules would get locked in memory,
> >> due to circular reference. One solution to that could be to pass NULL
> >> struct device pointer, as in the below patch.
> >
> > Doesn't that introduce race conditions ? If the sub-drivers require the
> > clock, they want to be sure that the clock won't disappear beyond their
> > backs. I agree that the circular dependency needs to be solved somehow,
> > but we probably need a more generic solution. The problem will become
> > more widespread in the future with DT-based device instantiation in both
> > V4L2 and KMS.
>
> I'm wondering whether subsystems and drivers itself should be written so
> they deal with such dependencies they are aware of.
>
> There is similar situation in the regulator API, regulator_get() simply
> takes a reference on a module providing the regulator object.
>
> Before a "more generic solution" is available, what do you think about
> keeping obtaining a reference on a clock provider module in clk_get() and
> doing clk_get(), clk_prepare_enable(), ..., clk_unprepare_disable(),
> clk_put() in sub-driver whenever a clock is actively used, to avoid
> permanent circular reference ?
That's a workaround I can live with in the short term, as long as we work on a
generic solution to this problem. It will bite us back in the not too distant
future if we pretend to forget about it.
--
Regards,
Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists