diff options
author | hselasky <hselasky@FreeBSD.org> | 2016-01-26 15:26:35 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2016-01-26 15:26:35 +0000 |
commit | 6c822626b7cb0e8fa301dbcad29f08d6dfd4bf32 (patch) | |
tree | f67227408f55e8b4c09fdadf6264a43e41ba34ad /sys/compat | |
parent | f3d0abf0fdf238654a7b38dd0eaf59227a61ead8 (diff) | |
download | FreeBSD-src-6c822626b7cb0e8fa301dbcad29f08d6dfd4bf32.zip FreeBSD-src-6c822626b7cb0e8fa301dbcad29f08d6dfd4bf32.tar.gz |
Update and add various macros to the LinuxKPI and resolve a macro
redefinition issue in the cxgb driver.
MFC after: 1 week
Sponsored by: Mellanox Technologies
Reviewed by: np @
Diffstat (limited to 'sys/compat')
5 files changed, 17 insertions, 9 deletions
diff --git a/sys/compat/linuxkpi/common/include/asm/atomic.h b/sys/compat/linuxkpi/common/include/asm/atomic.h index ee85624..70560f1 100644 --- a/sys/compat/linuxkpi/common/include/asm/atomic.h +++ b/sys/compat/linuxkpi/common/include/asm/atomic.h @@ -35,6 +35,8 @@ #include <sys/types.h> #include <machine/atomic.h> +#define ATOMIC_INIT(x) { .counter = (x) } + typedef struct { volatile int counter; } atomic_t; diff --git a/sys/compat/linuxkpi/common/include/linux/clocksource.h b/sys/compat/linuxkpi/common/include/linux/clocksource.h index f4d17f1..5e2cd5e 100644 --- a/sys/compat/linuxkpi/common/include/linux/clocksource.h +++ b/sys/compat/linuxkpi/common/include/linux/clocksource.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,12 +29,13 @@ * $FreeBSD$ */ #ifndef _LINUX_CLOCKSOURCE_H -#define _LINUX_CLOCKSOURCE_H +#define _LINUX_CLOCKSOURCE_H #include <asm/types.h> +#define CLOCKSOURCE_MASK(x) ((cycle_t)(-1ULL >> ((-(x)) & 63))) + /* clocksource cycle base type */ typedef u64 cycle_t; - -#endif /* _LINUX_CLOCKSOURCE_H */ +#endif /* _LINUX_CLOCKSOURCE_H */ diff --git a/sys/compat/linuxkpi/common/include/linux/completion.h b/sys/compat/linuxkpi/common/include/linux/completion.h index 7cfb10d..92ccc61 100644 --- a/sys/compat/linuxkpi/common/include/linux/completion.h +++ b/sys/compat/linuxkpi/common/include/linux/completion.h @@ -40,7 +40,9 @@ struct completion { #define INIT_COMPLETION(c) \ ((c).done = 0) #define init_completion(c) \ - ((c)->done = 0) + do { (c)->done = 0; } while (0) +#define reinit_completion(c) \ + do { (c)->done = 0; } while (0) #define complete(c) \ linux_complete_common((c), 0) #define complete_all(c) \ diff --git a/sys/compat/linuxkpi/common/include/linux/gfp.h b/sys/compat/linuxkpi/common/include/linux/gfp.h index 38a0222..d0fb0ac 100644 --- a/sys/compat/linuxkpi/common/include/linux/gfp.h +++ b/sys/compat/linuxkpi/common/include/linux/gfp.h @@ -54,6 +54,7 @@ #define GFP_HIGHUSER M_WAITOK #define GFP_HIGHUSER_MOVABLE M_WAITOK #define GFP_IOFS M_NOWAIT +#define GFP_NOIO M_NOWAIT static inline void * page_address(struct page *page) diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index bfc3b7d..6b6c0af 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * Copyright (c) 2014-2015 François Tigeot * All rights reserved. * @@ -159,9 +159,10 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#define simple_strtoul strtoul -#define simple_strtol strtol -#define kstrtol(a,b,c) ({*(c) = strtol(a,0,b);}) +#define simple_strtoul(...) strtoul(__VA_ARGS__) +#define simple_strtol(...) strtol(__VA_ARGS__) +#define kstrtol(a,b,c) ({*(c) = strtol(a,0,b); 0;}) +#define kstrtoint(a,b,c) ({*(c) = strtol(a,0,b); 0;}) #define min(x, y) ((x) < (y) ? (x) : (y)) #define max(x, y) ((x) > (y) ? (x) : (y)) @@ -185,6 +186,7 @@ #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) #define round_down(x, y) ((x) & ~__round_mask(x, y)) +#define smp_processor_id() PCPU_GET(cpuid) #define num_possible_cpus() mp_ncpus #define num_online_cpus() mp_ncpus |