linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iw: add kernel version checks for pending upstream kernel features
@ 2008-09-18 14:35 John W. Linville
  2008-09-18 15:13 ` Pavel Roskin
  2008-09-18 15:41 ` Johannes Berg
  0 siblings, 2 replies; 9+ messages in thread
From: John W. Linville @ 2008-09-18 14:35 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, John W. Linville

Add checks for kernel version to enable features in the iw tool.  This
allows packagers to get pre-package the tool without requiring precise
timing to stage the tool into their distributions.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 info.c |    4 ++++
 reg.c  |    6 ++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/info.c b/info.c
index 0dc05c1..4b7d191 100644
--- a/info.c
+++ b/info.c
@@ -1,4 +1,5 @@
 #include <errno.h>
+#include <linux/version.h>
 #include <linux/nl80211.h>
 #include <net/if.h>
 
@@ -105,12 +106,15 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
 		}
 	}
 
+/* This funcionality first appears "officially" in 2.6.28... */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
 	if (!tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES])
 		return NL_SKIP;
 
 	printf("\tSupported interface modes:\n");
 	nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES], rem_mode)
 		printf("\t\t * %s\n", iftype_name(nl_mode->nla_type));
+#endif
 
 	return NL_SKIP;
 }
diff --git a/reg.c b/reg.c
index 2892117..ce039ae 100644
--- a/reg.c
+++ b/reg.c
@@ -1,3 +1,4 @@
+#include <linux/version.h>
 #include <linux/nl80211.h>
 #include <net/if.h>
 #include <errno.h>
@@ -11,6 +12,9 @@
 
 #include "iw.h"
 
+/* This funcionality first appears "officially" in 2.6.28... */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
+
 int isalpha_upper(char letter)
 {
 	if (letter >= 65 && letter <= 90)
@@ -67,3 +71,5 @@ static int handle_reg_set(struct nl_cb *cb,
 }
 COMMAND(reg, set, "<ISO/IEC 3166-1 alpha2>",
 	NL80211_CMD_REQ_SET_REG, 0, CIB_NONE, handle_reg_set);
+
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) */
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-09-19  1:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-18 14:35 [PATCH] iw: add kernel version checks for pending upstream kernel features John W. Linville
2008-09-18 15:13 ` Pavel Roskin
2008-09-18 15:41 ` Johannes Berg
2008-09-18 16:10   ` Pavel Roskin
2008-09-18 17:26   ` Marcel Holtmann
2008-09-18 17:28     ` Johannes Berg
2008-09-18 20:43       ` Marcel Holtmann
2008-09-18 19:19     ` Pavel Roskin
2008-09-19  1:25   ` John W. Linville

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).