From: Imre Deak Date: Fri, 29 Sep 2006 19:09:46 +0000 (-0400) Subject: CBUS: Tahvo: add atomic set and clear register bits function X-Git-Tag: v2.6.18-omap1~23 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=d2db44bd92af99576cdf976f7dfc95f54884b14d;p=linux-2.6-omap-h63xx.git CBUS: Tahvo: add atomic set and clear register bits function Signed-off-by: Imre Deak Signed-off-by: Juha Yrjola --- diff --git a/drivers/cbus/tahvo.c b/drivers/cbus/tahvo.c index df9c0a0086b..bb19715e26c 100644 --- a/drivers/cbus/tahvo.c +++ b/drivers/cbus/tahvo.c @@ -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 */ diff --git a/drivers/cbus/tahvo.h b/drivers/cbus/tahvo.h index 3cde3662333..b7a8ee1758e 100644 --- a/drivers/cbus/tahvo.h +++ b/drivers/cbus/tahvo.h @@ -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);