IgH EtherCAT Master  1.6.10
smp.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2006-2026 Florian Pose, Ingenieurgemeinschaft IgH
4  *
5  * This file is part of the IgH EtherCAT master.
6  *
7  * The file is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; version 2.1 of the License.
10  *
11  * This file is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this file. If not, see <http://www.gnu.org/licenses/>.
18  *
19  ****************************************************************************/
20 
25 /****************************************************************************/
26 
27 #ifndef MASTER_SMP_H_
28 #define MASTER_SMP_H_
29 
30 #include <linux/version.h>
31 
32 /****************************************************************************/
33 
34 /* Define SMP macros on kernel versions where they did not exist yet.
35  */
36 
37 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 47)
38 
39 #define smp_store_release(p, v) \
40 do { \
41  smp_mb(); \
42  ACCESS_ONCE(*p) = (v); \
43 } while (0)
44 
45 #define smp_load_acquire(p) \
46 ({ \
47  typeof(*p) ___p1 = ACCESS_ONCE(*p); \
48  smp_mb(); \
49  ___p1; \
50 })
51 
52 #endif
53 
54 /****************************************************************************/
55 
56 #endif // MASTER_SMP_H_