X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=arch_atomic_s390.h;h=8857d422e2f53d8899bc741778dbe99bf42eebe4;hp=cb85e6a0ae80b83698f2a23ba1630ff53ca3425a;hb=2f873279bc92fac32e6549d6eb72f3197c7048ac;hpb=ac26f1a80b59a596a904a8d3a271460c8eb4334d diff --git a/arch_atomic_s390.h b/arch_atomic_s390.h index cb85e6a..8857d42 100644 --- a/arch_atomic_s390.h +++ b/arch_atomic_s390.h @@ -2,17 +2,30 @@ #define _ARCH_ATOMIC_S390_H /* - * Atomic exchange operations for the S390 architecture. + * Atomic exchange operations for the S390 architecture. Based on information + * taken from the Principles of Operation Appendix A "Conditional Swapping + * Instructions (CS, CDS)". * - * Copyright (C) 2009 Novell, Inc. + * Copyright (c) 2009 Novell, Inc. * Author: Jan Blunck * - * This is taken from the Principles of Operation Appendix A "Conditional - * Swapping Instructions (CS, CDS)". + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License version 2.1 as - * published by the Free Software Foundation. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. */ #ifndef __SIZEOF_LONG__ @@ -29,7 +42,7 @@ #ifndef _INCLUDE_API_H -static __attribute__((always_inline)) +static inline __attribute__((always_inline)) unsigned int atomic_exchange_32(volatile unsigned int *addr, unsigned int val) { unsigned int result; @@ -46,7 +59,7 @@ unsigned int atomic_exchange_32(volatile unsigned int *addr, unsigned int val) #if (BITS_PER_LONG == 64) -static __attribute__((always_inline)) +static inline __attribute__((always_inline)) unsigned long atomic_exchange_64(volatile unsigned long *addr, unsigned long val) { @@ -64,7 +77,7 @@ unsigned long atomic_exchange_64(volatile unsigned long *addr, #endif -static __attribute__((always_inline)) +static inline __attribute__((always_inline)) unsigned long _atomic_exchange(volatile void *addr, unsigned long val, int len) { switch (len) { @@ -81,8 +94,9 @@ unsigned long _atomic_exchange(volatile void *addr, unsigned long val, int len) return 0; } -#define xchg(addr, v) (__typeof__(*(addr))) _atomic_exchange((addr), (v), \ - sizeof(*(addr))) +#define xchg(addr, v) \ + (__typeof__(*(addr))) _atomic_exchange((addr), (unsigned long)(v), \ + sizeof(*(addr))) #endif /* #ifndef _INCLUDE_API_H */