* mutex_lock in designware-i2c
@ 2016-01-11 11:12 Rongrong Zou
2016-01-11 21:39 ` Baruch Siach
0 siblings, 1 reply; 2+ messages in thread
From: Rongrong Zou @ 2016-01-11 11:12 UTC (permalink / raw)
To: baruch; +Cc: linux-i2c, Andy Shevchenko, Jarkko Nikula, Mika Westerberg
Hi, baruch
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 ?
Regards,
Rongrong
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: mutex_lock in designware-i2c
2016-01-11 11:12 mutex_lock in designware-i2c Rongrong Zou
@ 2016-01-11 21:39 ` Baruch Siach
0 siblings, 0 replies; 2+ messages in thread
From: Baruch Siach @ 2016-01-11 21:39 UTC (permalink / raw)
To: Rongrong Zou; +Cc: linux-i2c, Andy Shevchenko, Jarkko Nikula, Mika Westerberg
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 -
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-11 21:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11 11:12 mutex_lock in designware-i2c Rongrong Zou
2016-01-11 21:39 ` Baruch Siach
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).