public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cbus-retu: Acquire mutex on write operation
@ 2011-02-26 23:34 Michael Buesch
  2011-02-28  8:33 ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Buesch @ 2011-02-26 23:34 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, Felipe Balbi

The mutex has to be acquired on register write to avoid interference
with a simultaneous retu_set_clear_reg_bits operation.

Signed-off-by: Michael Buesch <mb@bu3sch.de>

---

Tested on n810.


Index: linux-omap-2.6/drivers/cbus/retu.c
===================================================================
--- linux-omap-2.6.orig/drivers/cbus/retu.c	2011-02-23 23:32:26.388763324 +0100
+++ linux-omap-2.6/drivers/cbus/retu.c	2011-02-26 23:27:08.772462280 +0100
@@ -120,7 +120,9 @@
 {
 	struct retu		*retu = dev_get_drvdata(child->parent);
 
+	mutex_lock(&retu->mutex);
 	__retu_write_reg(retu, reg, val);
+	mutex_unlock(&retu->mutex);
 }
 EXPORT_SYMBOL_GPL(retu_write_reg);
 





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cbus-retu: Acquire mutex on write operation
  2011-02-26 23:34 [PATCH] cbus-retu: Acquire mutex on write operation Michael Buesch
@ 2011-02-28  8:33 ` Felipe Balbi
  2011-02-28 14:10   ` Michael Büsch
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2011-02-28  8:33 UTC (permalink / raw)
  To: Michael Buesch; +Cc: Tony Lindgren, linux-omap, Felipe Balbi

On Sun, Feb 27, 2011 at 12:34:33AM +0100, Michael Buesch wrote:
> The mutex has to be acquired on register write to avoid interference
> with a simultaneous retu_set_clear_reg_bits operation.
> 
> Signed-off-by: Michael Buesch <mb@bu3sch.de>

good catch, please do the same for retu_read_reg()

-- 
balbi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cbus-retu: Acquire mutex on write operation
  2011-02-28  8:33 ` Felipe Balbi
@ 2011-02-28 14:10   ` Michael Büsch
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Büsch @ 2011-02-28 14:10 UTC (permalink / raw)
  To: balbi; +Cc: Tony Lindgren, linux-omap

On Mon, 2011-02-28 at 10:33 +0200, Felipe Balbi wrote: 
> On Sun, Feb 27, 2011 at 12:34:33AM +0100, Michael Buesch wrote:
> > The mutex has to be acquired on register write to avoid interference
> > with a simultaneous retu_set_clear_reg_bits operation.
> > 
> > Signed-off-by: Michael Buesch <mb@bu3sch.de>
> 
> good catch, please do the same for retu_read_reg()

I don't think this is necessary, because cbus_read_reg() and
cbus_write_reg() are atomic due to the cbus host->lock.
I think we can depend on this.
We could probably improve the comment on the lock in
cbus_transfer(), though.

-- 
Greetings Michael.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-28 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-26 23:34 [PATCH] cbus-retu: Acquire mutex on write operation Michael Buesch
2011-02-28  8:33 ` Felipe Balbi
2011-02-28 14:10   ` Michael Büsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox