Signed-off-by: Bart Hartgers <[email protected]>
---
Index: linux-2.6.32-rc4/drivers/usb/serial/ark3116.c
===================================================================
--- linux-2.6.32-rc4.orig/drivers/usb/serial/ark3116.c 2009-10-18 16:20:13.000000000 +0200
+++ linux-2.6.32-rc4/drivers/usb/serial/ark3116.c 2009-10-18 16:20:17.000000000 +0200
@@ -151,6 +151,33 @@ static inline void ARK3116_RCV_QUIET(str
buf, 0x0000001, 1000);
}
+static inline void ark3116_atomic_set_clear(unsigned set,
+ unsigned clear, atomic_t *at)
+{
+ if ((clear == 0) && (set == 0))
+ return;
+#if defined(atomic_set_mask)
+ if (clear == 0) {
+ atomic_set_mask(set, at);
+ return;
+ }
+#endif
+#if defined(atomic_clear_mask)
+ if (set == 0) {
+ atomic_clear_mask(clear, at);
+ return;
+ }
+#endif
+ /* operation needs to be atomic */
+ for (;;) {
+ register unsigned old = atomic_read(at);
+ register unsigned prev = atomic_cmpxchg(at, old,
+ (old|set)&(~clear));
+ if (likely(prev == old))
+ break;
+ }
+}
+
static inline int calc_divisor(int bps)
{
/* Original ark3116 made some exceptions in rounding here
--