From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: Common clock framework: mutex recursion when calling clk_prepare from prepare handler
Date: Mon, 07 Jan 2013 01:49:02 +0100 [thread overview]
Message-ID: <3826517.zOi8FASM36@avalon> (raw)
Hello,
I ran into a mutex recursion issue while trying to port the OMAP3 ISP driver
(drivers/media/platform/omap3isp) over to the common clock framework.
The OMAP3 ISP generates two programmable clocks named xclka and xclkb that are
routed out of the SoC. My goal is to expose them as common clock instances
through the common clock framework.
The xclk[ab] clocks are children of the cam_mclk clock. They are controlled
through ISP registers that sit in the cam_fclk clock domain. The cam_mclk and
cam_fclk clocks sit in separate power domains.
To program the xclk clocks I need to enable the cam_fclk clock. As xclk[ab]
are not descendants of the cam_fclk clock, this operation needs to be
performed manually. I thus call clk_prepare_enable on the cam_fclk clock in
the xclk[ab] prepare handler. This is where things break, as the common clock
framework takes the prepare_lock mutex in clk_prepare, which results in a
mutex recursion deadlock as the prepare_lock mutex isn't recursive.
What's the best way to solve this ? __clk_prepare (the unlocked version of
clk_prepare) isn't exported to drivers, and I'm not convinced it should be.
Turning prepare_lock into a recursive mutex might also work, but I'm not sure
what drawbacks this would have. Advices would be appreciated.
--
Regards,
Laurent Pinchart
reply other threads:[~2013-01-07 0:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3826517.zOi8FASM36@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).