#ifndef __ASM_GENERIC_CMPXCHG_LOCAL_H #define __ASM_GENERIC_CMPXCHG_LOCAL_H #include #include extern unsigned long wrong_size_cmpxchg(volatile void *ptr) __noreturn; /* * Generic version of __cmpxchg_local (disables interrupts). Takes an unsigned * long parameter, supporting various types of architectures. */ static inline unsigned long __cmpxchg_local_generic(volatile void *ptr, unsigned long old, unsigned long new, int size) { unsigned long flags, prev; /* * Sanity checking, compile-time. */ if (size == 8 && sizeof(unsigned long) != 8) wrong_size_cmpxchg(ptr); raw_local_irq_save(flags); switch (size) { case 1: prev = *(u8 *)ptr; if (prev == old) *(u8 *)ptr = (u8)new; break; case 2: prev = *(u16 *)ptr; if (prev == old) *(u16 *)ptr = (u16)new; break; case 4: prev = *(u32 *)ptr; if (prev == old) *(u32 *)ptr = (u32)new; break; case 8: prev = *(u64 *)ptr; if (prev == old) *(u64 *)ptr = (u64)new; break; default: wrong_size_cmpxchg(ptr); } raw_local_irq_restore(flags); return prev; } /* * Generic version of __cmpxchg64_local. Takes an u64 parameter. */ static inline u64 __cmpxchg64_local_generic(volatile void *ptr, u64 old, u64 new) { u64 prev; unsigned long flags; raw_local_irq_save(flags); prev = *(u64 *)ptr; if (prev == old) *(u64 *)ptr = new; raw_local_irq_restore(flags); return prev; } #endif alue='switch'/> net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2016-10-20 15:44:19 +0200
committerTobias Klauser <tklauser@distanz.ch>2017-02-15 10:34:18 +0100
commit5db4992d8f040b8d8db0b86d42806e0c417f7ccf (patch)
tree5b06e952af482d45f3ade64e77824662e34b7fa2 /include/dt-bindings/interrupt-controller
parent370ebb0ef6255132373ed35d13e7b1d8d2eb7003 (diff)
usbnet: pegasus: Use net_device_stats from struct net_devicends-private-remove
Instead of using a private copy of struct net_device_stats in struct pegasus, use stats from struct net_device. Also remove the now unnecessary .ndo_get_stats function. Cc: Petko Manolov <petkan@nucleusys.com> Cc: linux-usb@vger.kernel.org Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'include/dt-bindings/interrupt-controller')