diff options
author | Hartmut Birr <e9hack@googlemail.com> | 2006-11-01 10:46:32 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-10 06:05:33 -0500 |
commit | 88bbdf74fcfa7ed1fd1a3c825ee5575752344326 (patch) | |
tree | 64e6af972746c4b952e2fe498ea209e789b83c11 /include/media | |
parent | 122b5dbea6fa3727fc99fbdc2cf5e4d9b8a5bb00 (diff) |
V4L/DVB (4914): Saa7146: Protect access to the IER register by a spinlock
Protect the access to the IER register of the SAA7146 by the device
spinlock. I2C transfers may use interrupt mode now.
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/saa7146.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/include/media/saa7146.h b/include/media/saa7146.h index fee579f10b32..afa5ff6469b3 100644 --- a/include/media/saa7146.h +++ b/include/media/saa7146.h | |||
@@ -42,10 +42,20 @@ extern unsigned int saa7146_debug; | |||
42 | #define DEB_INT(x) if (0!=(DEBUG_VARIABLE&0x20)) { DEBUG_PROLOG; printk x; } /* interrupt debug messages */ | 42 | #define DEB_INT(x) if (0!=(DEBUG_VARIABLE&0x20)) { DEBUG_PROLOG; printk x; } /* interrupt debug messages */ |
43 | #define DEB_CAP(x) if (0!=(DEBUG_VARIABLE&0x40)) { DEBUG_PROLOG; printk x; } /* capture debug messages */ | 43 | #define DEB_CAP(x) if (0!=(DEBUG_VARIABLE&0x40)) { DEBUG_PROLOG; printk x; } /* capture debug messages */ |
44 | 44 | ||
45 | #define SAA7146_IER_DISABLE(x,y) \ | 45 | #define SAA7146_IER_DISABLE(x,y) \ |
46 | saa7146_write(x, IER, saa7146_read(x, IER) & ~(y)); | 46 | do { \ |
47 | #define SAA7146_IER_ENABLE(x,y) \ | 47 | unsigned int flags; \ |
48 | saa7146_write(x, IER, saa7146_read(x, IER) | (y)); | 48 | spin_lock_irqsave(&x->int_slock, flags); \ |
49 | saa7146_write(x, IER, saa7146_read(x, IER) & ~(y)); \ | ||
50 | spin_unlock_irqrestore(&x->int_slock, flags); \ | ||
51 | } while(0) | ||
52 | #define SAA7146_IER_ENABLE(x,y) \ | ||
53 | do { \ | ||
54 | unsigned int flags; \ | ||
55 | spin_lock_irqsave(&x->int_slock, flags); \ | ||
56 | saa7146_write(x, IER, saa7146_read(x, IER) | (y)); \ | ||
57 | spin_unlock_irqrestore(&x->int_slock, flags); \ | ||
58 | } while(0) | ||
49 | #define SAA7146_ISR_CLEAR(x,y) \ | 59 | #define SAA7146_ISR_CLEAR(x,y) \ |
50 | saa7146_write(x, ISR, (y)); | 60 | saa7146_write(x, ISR, (y)); |
51 | 61 | ||