* [PATCH] ASoC: fsi: Add spin lock operation for accessing shared area
@ 2010-01-28 4:46 Kuninori Morimoto
2010-01-28 10:23 ` Liam Girdwood
2010-01-28 12:44 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Kuninori Morimoto @ 2010-01-28 4:46 UTC (permalink / raw)
To: Mark Brown; +Cc: Linux-ALSA
fsi_master_xxx function should be protected by spin lock,
because it are used from both FSI-A and FSI-B.
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
---
sound/soc/sh/fsi.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 5f9f269..ebf3588 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -110,6 +110,7 @@ struct fsi_master {
struct fsi_priv fsia;
struct fsi_priv fsib;
struct sh_fsi_platform_info *info;
+ spinlock_t lock;
};
/************************************************************************
@@ -168,30 +169,51 @@ static int fsi_reg_mask_set(struct fsi_priv *fsi, u32 reg, u32 mask, u32 data)
static int fsi_master_write(struct fsi_master *master, u32 reg, u32 data)
{
+ int ret;
+ unsigned long flags;
+
if ((reg < MREG_START) ||
(reg > MREG_END))
return -1;
- return __fsi_reg_write((u32)(master->base + reg), data);
+ spin_lock_irqsave(&master->lock, flags);
+ ret = __fsi_reg_write((u32)(master->base + reg), data);
+ spin_unlock_irqrestore(&master->lock, flags);
+
+ return ret;
}
static u32 fsi_master_read(struct fsi_master *master, u32 reg)
{
+ u32 ret;
+ unsigned long flags;
+
if ((reg < MREG_START) ||
(reg > MREG_END))
return 0;
- return __fsi_reg_read((u32)(master->base + reg));
+ spin_lock_irqsave(&master->lock, flags);
+ ret = __fsi_reg_read((u32)(master->base + reg));
+ spin_unlock_irqrestore(&master->lock, flags);
+
+ return ret;
}
static int fsi_master_mask_set(struct fsi_master *master,
u32 reg, u32 mask, u32 data)
{
+ int ret;
+ unsigned long flags;
+
if ((reg < MREG_START) ||
(reg > MREG_END))
return -1;
- return __fsi_reg_mask_set((u32)(master->base + reg), mask, data);
+ spin_lock_irqsave(&master->lock, flags);
+ ret = __fsi_reg_mask_set((u32)(master->base + reg), mask, data);
+ spin_unlock_irqrestore(&master->lock, flags);
+
+ return ret;
}
/************************************************************************
@@ -929,6 +951,7 @@ static int fsi_probe(struct platform_device *pdev)
master->fsia.master = master;
master->fsib.base = master->base + 0x40;
master->fsib.master = master;
+ spin_lock_init(&master->lock);
pm_runtime_enable(&pdev->dev);
pm_runtime_resume(&pdev->dev);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: fsi: Add spin lock operation for accessing shared area
2010-01-28 4:46 [PATCH] ASoC: fsi: Add spin lock operation for accessing shared area Kuninori Morimoto
@ 2010-01-28 10:23 ` Liam Girdwood
2010-01-28 12:44 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2010-01-28 10:23 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Linux-ALSA, Mark Brown
On Thu, 2010-01-28 at 13:46 +0900, Kuninori Morimoto wrote:
> fsi_master_xxx function should be protected by spin lock,
> because it are used from both FSI-A and FSI-B.
>
> Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
> ---
Acked-by: Liam Girdwood <lrg@slimlgic.co.uk>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: fsi: Add spin lock operation for accessing shared area
2010-01-28 4:46 [PATCH] ASoC: fsi: Add spin lock operation for accessing shared area Kuninori Morimoto
2010-01-28 10:23 ` Liam Girdwood
@ 2010-01-28 12:44 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-01-28 12:44 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Linux-ALSA
On Thu, Jan 28, 2010 at 01:46:16PM +0900, Kuninori Morimoto wrote:
> fsi_master_xxx function should be protected by spin lock,
> because it are used from both FSI-A and FSI-B.
>
> Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-28 12:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-28 4:46 [PATCH] ASoC: fsi: Add spin lock operation for accessing shared area Kuninori Morimoto
2010-01-28 10:23 ` Liam Girdwood
2010-01-28 12:44 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.