Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88bbdf74 authored by Hartmut Birr's avatar Hartmut Birr Committed by Mauro Carvalho Chehab
Browse files

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: default avatarOliver Endriss <o.endriss@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 122b5dbe
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -43,9 +43,19 @@ extern unsigned int saa7146_debug;
#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));
	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)						\
	saa7146_write(x, IER, saa7146_read(x, IER) | (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));