]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
CBUS: Tahvo: add atomic set and clear register bits function
authorImre Deak <imre.deak@solidboot.com>
Fri, 29 Sep 2006 19:09:46 +0000 (15:09 -0400)
committerJuha Yrjola <juha.yrjola@solidboot.com>
Fri, 29 Sep 2006 13:47:38 +0000 (16:47 +0300)
Signed-off-by: Imre Deak <imre.deak@solidboot.com>
Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
drivers/cbus/tahvo.c
drivers/cbus/tahvo.h

index df9c0a0086b8d8e5bb1516c0fdfe053a7decca2b..bb19715e26c1b7efb8636e8119de0397bc6ab7b8 100644 (file)
@@ -91,6 +91,26 @@ void tahvo_write_reg(int reg, u16 val)
        cbus_write_reg(cbus_host, TAHVO_ID, reg, val);
 }
 
+/**
+ * tahvo_set_clear_reg_bits - set and clear register bits atomically
+ * @reg: the register to write to
+ * @bits: the bits to set
+ *
+ * This function sets and clears the specified Tahvo register bits atomically
+ */
+void tahvo_set_clear_reg_bits(int reg, u16 set, u16 clear)
+{
+       unsigned long flags;
+       u16 w;
+
+       spin_lock_irqsave(&tahvo_lock, flags);
+       w = tahvo_read_reg(reg);
+       w &= ~clear;
+       w |= set;
+       tahvo_write_reg(reg, w);
+       spin_unlock_irqrestore(&tahvo_lock, flags);
+}
+
 /*
  * Disable given TAHVO interrupt
  */
index 3cde3662333768ae865103c092604f4f71ba0439..b7a8ee1758e73b9306d1e96137653bae741b7919 100644 (file)
@@ -41,6 +41,7 @@
 
 int tahvo_read_reg(int reg);
 void tahvo_write_reg(int reg, u16 val);
+void tahvo_set_clear_reg_bits(int reg, u16 set, u16 clear);
 int tahvo_request_irq(int id, void *irq_handler, unsigned long arg, char *name);
 void tahvo_free_irq(int id);
 void tahvo_enable_irq(int id);