From 4292914d15181ad06aba9db77cc706c0374ada0a Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 28 Nov 2012 23:57:40 +0100 Subject: [PATCH] compat: move config_enabled to compat-3.4.h config_enabled() was introduced in kernel version 3.4 and not in version 3.1. Now some driver uses this directly and this fails without this patch. Signed-off-by: Hauke Mehrtens Signed-off-by: Luis R. Rodriguez --- include/linux/compat-3.1.h | 13 ------------- include/linux/compat-3.4.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/linux/compat-3.1.h b/include/linux/compat-3.1.h index fc052453a27b..3afca9a6b607 100644 --- a/include/linux/compat-3.1.h +++ b/include/linux/compat-3.1.h @@ -42,19 +42,6 @@ static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev return skb; } -/* - * Getting something that works in C and CPP for an arg that may or may - * not be defined is tricky. Here, if we have "#define CONFIG_BOOGER 1" - * we match on the placeholder define, insert the "0," for arg1 and generate - * the triplet (0, 1, 0). Then the last step cherry picks the 2nd arg (a one). - * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when - * the last step cherry picks the 2nd arg, we get a zero. - */ -#define __ARG_PLACEHOLDER_1 0, -#define config_enabled(cfg) _config_enabled(cfg) -#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value) -#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) -#define ___config_enabled(__ignored, val, ...) val #define genl_dump_check_consistent(cb, user_hdr, family) /* diff --git a/include/linux/compat-3.4.h b/include/linux/compat-3.4.h index 887293da0096..fbd92a2a95b0 100644 --- a/include/linux/compat-3.4.h +++ b/include/linux/compat-3.4.h @@ -123,6 +123,20 @@ static inline void eth_hw_addr_random(struct net_device *dev) module_driver(__pci_driver, pci_register_driver, \ pci_unregister_driver) +/* + * Getting something that works in C and CPP for an arg that may or may + * not be defined is tricky. Here, if we have "#define CONFIG_BOOGER 1" + * we match on the placeholder define, insert the "0," for arg1 and generate + * the triplet (0, 1, 0). Then the last step cherry picks the 2nd arg (a one). + * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when + * the last step cherry picks the 2nd arg, we get a zero. + */ +#define __ARG_PLACEHOLDER_1 0, +#define config_enabled(cfg) _config_enabled(cfg) +#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value) +#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) +#define ___config_enabled(__ignored, val, ...) val + #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) */ #endif /* LINUX_5_4_COMPAT_H */ -- 2.30.2