From patchwork Wed Nov 5 15:35:01 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 5332 Received: from john.hrz.tu-chemnitz.de (john.hrz.tu-chemnitz.de [134.109.132.2]) by open-mesh.net (8.13.4/8.13.4/Debian-3sarge3) with ESMTP id mA5FeHq5032721 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 5 Nov 2008 16:40:18 +0100 Received: from galba.hrz.tu-chemnitz.de ([134.109.133.156] helo=mailbox.hrz.tu-chemnitz.de) by john.hrz.tu-chemnitz.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1KxkPN-00043j-Bh for b.a.t.m.a.n@open-mesh.net; Wed, 05 Nov 2008 16:35:01 +0100 Received: from vpnclient-079.hrz.tu-chemnitz.de ([134.109.232.79] helo=sven-desktop) by mailbox.hrz.tu-chemnitz.de with smtp (Exim 4.69) (envelope-from ) id 1KxkPM-0001gb-VL for b.a.t.m.a.n@open-mesh.net; Wed, 05 Nov 2008 16:35:01 +0100 Received: by sven-desktop (nbSMTP-1.00) for uid 1000 sven.eckelmann@gmx.de; Wed, 5 Nov 2008 16:35:01 +0100 (CET) Date: Wed, 5 Nov 2008 16:35:01 +0100 From: Sven Eckelmann To: b.a.t.m.a.n@open-mesh.net Message-ID: <20081105153501.GA12588@sven-desktop.lazhur.ath.cx> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Scan-Signature: 4f13e4471bca5f924f497d06c94ddf0f Subject: [B.A.T.M.A.N.] [PATCHv2] Use device_create instead of device_create_drvdata in linux modules X-BeenThere: b.a.t.m.a.n@open-mesh.net X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Nov 2008 15:40:18 -0000 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 --- 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 : "" );