summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorOliver Endriss <o.endriss@gmx.de>2006-11-01 16:46:32 +0100
committerOliver Endriss <o.endriss@gmx.de>2006-11-01 16:46:32 +0100
commit5a28d075b42d4401327ab95bf98acee440ae8f24 (patch)
tree8e4036c47dde3fcd422e6081e25d10f16ed1d68d /linux
parente7a7daa18b1bd11471400b9a2e8dbf0468a5ebcc (diff)
downloadmediapointer-dvb-s2-5a28d075b42d4401327ab95bf98acee440ae8f24.tar.gz
mediapointer-dvb-s2-5a28d075b42d4401327ab95bf98acee440ae8f24.tar.bz2
saa7146: Protect access to the IER register by a spinlock
From: Hartmut Birr <e9hack@googlemail.com> Protect the access to the IER register of the SAA7146 by the device spinlock. I2C transfers may use interrupt mode now. Signed-of-by: Hartmut Birr <e9hack@googlemail.com> Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Diffstat (limited to 'linux')
-rw-r--r--linux/include/media/saa7146.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/linux/include/media/saa7146.h b/linux/include/media/saa7146.h
index be8b003c0..6f3d14306 100644
--- a/linux/include/media/saa7146.h
+++ b/linux/include/media/saa7146.h
@@ -54,10 +54,20 @@ extern unsigned int saa7146_debug;
#define DEB_INT(x) if (0!=(DEBUG_VARIABLE&0x20)) { DEBUG_PROLOG; printk x; } /* interrupt debug messages */
#define DEB_CAP(x) if (0!=(DEBUG_VARIABLE&0x40)) { DEBUG_PROLOG; printk x; } /* capture debug messages */
-#define SAA7146_IER_DISABLE(x,y) \
- saa7146_write(x, IER, saa7146_read(x, IER) & ~(y));
-#define SAA7146_IER_ENABLE(x,y) \
- saa7146_write(x, IER, saa7146_read(x, IER) | (y));
+#define SAA7146_IER_DISABLE(x,y) \
+ do { \
+ unsigned int flags; \
+ spin_lock_irqsave(&x->int_slock, flags); \
+ saa7146_write(x, IER, saa7146_read(x, IER) & ~(y)); \
+ spin_unlock_irqrestore(&x->int_slock, flags); \
+ } while(0)
+#define SAA7146_IER_ENABLE(x,y) \
+ do { \
+ unsigned int flags; \
+ spin_lock_irqsave(&x->int_slock, flags); \
+ saa7146_write(x, IER, saa7146_read(x, IER) | (y)); \
+ spin_unlock_irqrestore(&x->int_slock, flags); \
+ } while(0)
#define SAA7146_ISR_CLEAR(x,y) \
saa7146_write(x, ISR, (y));