diff options
author | Brian Swetland <swetland@google.com> | 2009-12-07 18:28:08 -0500 |
---|---|---|
committer | Daniel Walker <dwalker@codeaurora.org> | 2010-05-12 12:15:31 -0400 |
commit | 636eb9cbaef7989ce7809a0d842bf78470a0a1f4 (patch) | |
tree | 1a12088ad69cb37d5e3f3f25bdf03c7c9e8a7846 /arch/arm/mach-msm/smd.c | |
parent | 1207babdcdfe5501d1528c86b445a9d1045ecc01 (diff) |
msm: smd: provide atomic channel writes
Some smd clients may write from multiple threads, in which case it's
not safe to call smd_write without holding a lock. smd_write_atomic()
provides the same functionality as smd_write() but obtains the smd
lock first.
Signed-off-by: Brian Swetland <swetland@google.com>
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
Diffstat (limited to 'arch/arm/mach-msm/smd.c')
-rw-r--r-- | arch/arm/mach-msm/smd.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c index 655fe42506ca..086fd77dc891 100644 --- a/arch/arm/mach-msm/smd.c +++ b/arch/arm/mach-msm/smd.c | |||
@@ -804,6 +804,16 @@ int smd_write(smd_channel_t *ch, const void *data, int len) | |||
804 | return ch->write(ch, data, len); | 804 | return ch->write(ch, data, len); |
805 | } | 805 | } |
806 | 806 | ||
807 | int smd_write_atomic(smd_channel_t *ch, const void *data, int len) | ||
808 | { | ||
809 | unsigned long flags; | ||
810 | int res; | ||
811 | spin_lock_irqsave(&smd_lock, flags); | ||
812 | res = ch->write(ch, data, len); | ||
813 | spin_unlock_irqrestore(&smd_lock, flags); | ||
814 | return res; | ||
815 | } | ||
816 | |||
807 | int smd_read_avail(smd_channel_t *ch) | 817 | int smd_read_avail(smd_channel_t *ch) |
808 | { | 818 | { |
809 | return ch->read_avail(ch); | 819 | return ch->read_avail(ch); |