V4L/DVB (4917): Saa7146: Convert SAA7146_IER_{DIS,EN}ABLE macros to inline functions
authorOliver Endriss <o.endriss@gmx.de>
Fri, 3 Nov 2006 18:13:52 +0000 (15:13 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 10 Dec 2006 11:05:36 +0000 (09:05 -0200)
Convert SAA7146_IER_{DIS,EN}ABLE macros to inline functions.
Fixes a problem with macro expansion (reported by C.Y.M).

Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
include/media/saa7146.h

index afa5ff6..796bcf1 100644 (file)
@@ -42,20 +42,6 @@ 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)                                       \
-       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));
 
@@ -451,4 +437,20 @@ int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop);
 #define SAA7146_I2C_BUS_BIT_RATE_80    (0x200)
 #define SAA7146_I2C_BUS_BIT_RATE_60    (0x300)
 
+static inline void SAA7146_IER_DISABLE(struct saa7146_dev *x, unsigned y)
+{
+       unsigned long flags;
+       spin_lock_irqsave(&x->int_slock, flags);
+       saa7146_write(x, IER, saa7146_read(x, IER) & ~y);
+       spin_unlock_irqrestore(&x->int_slock, flags);
+}
+
+static inline void SAA7146_IER_ENABLE(struct saa7146_dev *x, unsigned y)
+{
+       unsigned long flags;
+       spin_lock_irqsave(&x->int_slock, flags);
+       saa7146_write(x, IER, saa7146_read(x, IER) | y);
+       spin_unlock_irqrestore(&x->int_slock, flags);
+}
+
 #endif