From: Baruch Siach <baruch@tkos.co.il>
To: Rongrong Zou <zourongrong@gmail.com>
Cc: linux-i2c@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: mutex_lock in designware-i2c
Date: Mon, 11 Jan 2016 23:39:17 +0200 [thread overview]
Message-ID: <20160111213917.GB2957@tarshish> (raw)
In-Reply-To: <56938E0A.5080303@gmail.com>
Hi Rongrong Zou,
On Mon, Jan 11, 2016 at 07:12:10PM +0800, Rongrong Zou wrote:
> I found a mutex lock in dw_i2c_dev for each adapter,
> struct dw_i2c_dev {
> struct device *dev;
> void __iomem *base;
> struct completion cmd_complete;
> struct mutex lock;
> struct clk *clk;
>
> but there is another lock: adapter->bus_lock, this lock is also
> for each adapter, why we need both of them ?
As far as I can see from the code the master_xfer callback is never called
concurrently for the same adaptor. So indeed the internal lock looks
redundant. I can't remember why I put it there.
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
prev parent reply other threads:[~2016-01-11 21:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 11:12 mutex_lock in designware-i2c Rongrong Zou
2016-01-11 21:39 ` Baruch Siach [this message]
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=20160111213917.GB2957@tarshish \
--to=baruch@tkos.co.il \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=linux-i2c@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=zourongrong@gmail.com \
/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).