From: Sven Eckelmann <sven.eckelmann@gmx.de>
To: b.a.t.m.a.n@open-mesh.net
Subject: [B.A.T.M.A.N.] [PATCHv2] Use device_create instead of device_create_drvdata in linux modules
Date: Wed, 5 Nov 2008 16:35:01 +0100 [thread overview]
Message-ID: <20081105153501.GA12588@sven-desktop.lazhur.ath.cx> (raw)
The function device_create_drvdata was renamed to device_create in linux
v2.6.26-5782-g4e10673. Until v2.6.27-4446-g7fb6b5d there was a compatibility
define in include/linux/device.h which is removed in linux 2.6.28-rc1.
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
batman-adv-kernelland/batman-core/compat.h | 11 ++++++++++-
batman-adv-kernelland/batman-core/device.c | 2 +-
batman/linux/modules/compat26.h | 12 +++++++++++-
batman/linux/modules/gateway.c | 2 +-
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/batman-adv-kernelland/batman-core/compat.h b/batman-adv-kernelland/batman-core/compat.h
index 5f58f8f..33deec6 100644
--- a/batman-adv-kernelland/batman-core/compat.h
+++ b/batman-adv-kernelland/batman-core/compat.h
@@ -38,10 +38,19 @@
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
-#define device_create_drvdata(_cls, _parent, _devt, _device, _fmt) \
+#define device_create(_cls, _parent, _devt, _device, _fmt) \
class_device_create(_cls, _parent, _devt, _device, _fmt)
#define device_destroy(_cls, _device) \
class_device_destroy(_cls, _device)
+#else
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
+
+#define device_create(_cls, _parent, _devt, _device, _fmt) \
+ device_create_drvdata(_cls, _parent, _devt, _device, _fmt)
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) */
+
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) */
diff --git a/batman-adv-kernelland/batman-core/device.c b/batman-adv-kernelland/batman-core/device.c
index c401634..028cf7d 100644
--- a/batman-adv-kernelland/batman-core/device.c
+++ b/batman-adv-kernelland/batman-core/device.c
@@ -83,7 +83,7 @@ void bat_device_setup(void)
debug_log(LOG_TYPE_WARN, "Could not register class 'batman-adv' \n");
return;
} else {
- device_create_drvdata(batman_class, NULL, MKDEV(tmp_major, 0), NULL, "batman-adv");
+ device_create(batman_class, NULL, MKDEV(tmp_major, 0), NULL, "batman-adv");
}
#endif
diff --git a/batman/linux/modules/compat26.h b/batman/linux/modules/compat26.h
index f1fdc67..3ddbe0a 100644
--- a/batman/linux/modules/compat26.h
+++ b/batman/linux/modules/compat26.h
@@ -34,6 +34,7 @@ static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
#endif /* KERNEL_VERSION(2, 6, 22) */
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
static inline int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen)
@@ -43,12 +44,21 @@ static inline int kernel_bind(struct socket *sock, struct sockaddr *addr, int ad
#endif /* KERNEL_VERSION(2, 6, 19) */
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
-#define device_create_drvdata \
+#define device_create \
class_device_create
#define device_destroy \
class_device_destroy
+#else
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+
+#define device_create \
+ device_create_drvdata
+
+#endif /* KERNEL_VERSION(2,6,27) */
#endif /* KERNEL_VERSION(2,6,26) */
diff --git a/batman/linux/modules/gateway.c b/batman/linux/modules/gateway.c
index fcf4dd2..b1b346c 100644
--- a/batman/linux/modules/gateway.c
+++ b/batman/linux/modules/gateway.c
@@ -91,7 +91,7 @@ int init_module()
if ( IS_ERR( batman_class ) )
DBG( "could not register class 'batgat'" );
else
- device_create_drvdata(batman_class, NULL, MKDEV(Major, 0), NULL, "batgat");
+ device_create(batman_class, NULL, MKDEV(Major, 0), NULL, "batgat");
DBG( "batgat loaded %s", strlen(REVISION_VERSION) > 3 ? REVISION_VERSION : "" );
--
1.6.0.2
reply other threads:[~2008-11-05 15:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081105153501.GA12588@sven-desktop.lazhur.ath.cx \
--to=sven.eckelmann@gmx.de \
--cc=b.a.t.m.a.n@open-mesh.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).