[PATCH 21/68] TTY: serial, use atomic_inc_return in ioc4_serial

From: Jiri Slaby
Date: Mon Mar 05 2012 - 08:58:08 EST


We want to know the value of the atomic variable in intr_connect after
the increment. But atomic_inc doesn't, per definition, return the
value. It is just a pure coincidence that ia64 defines atomic_inc as
atomic_inc_return.

So fix this mistake by using atomic_inc_return properly.

Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
---
drivers/tty/serial/ioc4_serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/ioc4_serial.c b/drivers/tty/serial/ioc4_serial.c
index 6b36c15..dfec69a 100644
--- a/drivers/tty/serial/ioc4_serial.c
+++ b/drivers/tty/serial/ioc4_serial.c
@@ -975,7 +975,7 @@ intr_connect(struct ioc4_soft *soft, int type,
BUG_ON(!((type == IOC4_SIO_INTR_TYPE)
|| (type == IOC4_OTHER_INTR_TYPE)));

- i = atomic_inc(&soft-> is_intr_type[type].is_num_intrs) - 1;
+ i = atomic_inc_return(&soft-> is_intr_type[type].is_num_intrs) - 1;
BUG_ON(!(i < MAX_IOC4_INTR_ENTS || (printk("i %d\n", i), 0)));

/* Save off the lower level interrupt handler */
--
1.7.9.2


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/