[kernel] Add compat-wireless patch to define module_usb_driver

John W. Linville linville at fedoraproject.org
Sat Dec 3 19:30:32 UTC 2011


commit e04a21258f017e3552c2c31a1b432a174a36d94a
Author: John W. Linville <linville at tuxdriver.com>
Date:   Sat Dec 3 13:29:53 2011 -0500

    Add compat-wireless patch to define module_usb_driver

 ...ule_usb_driver-and-module_platform_driver.patch |   90 ++++++++++++++++++++
 kernel.spec                                        |    5 +
 2 files changed, 95 insertions(+), 0 deletions(-)
---
diff --git a/compat-add-module_usb_driver-and-module_platform_driver.patch b/compat-add-module_usb_driver-and-module_platform_driver.patch
new file mode 100644
index 0000000..5ef5310
--- /dev/null
+++ b/compat-add-module_usb_driver-and-module_platform_driver.patch
@@ -0,0 +1,90 @@
+From linux-wireless-owner at vger.kernel.org Sat Dec  3 09:49:42 2011
+From:	Hauke Mehrtens <hauke at hauke-m.de>
+To:	mcgrof at gmail.com, mcgrof at qca.qualcomm.com
+Cc:	linux-wireless at vger.kernel.org, Hauke Mehrtens <hauke at hauke-m.de>
+Subject: [PATCH 2/2] compat: add module_usb_driver and module_platform_driver
+Date:	Sat,  3 Dec 2011 15:49:26 +0100
+Message-Id: <1322923766-14379-2-git-send-email-hauke at hauke-m.de>
+
+
+Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
+---
+ include/linux/compat-3.2.h |    9 +++++++++
+ include/linux/compat-3.3.h |   35 +++++++++++++++++++++++++++++++++++
+ 2 files changed, 44 insertions(+), 0 deletions(-)
+
+diff --git a/include/linux/compat-3.2.h b/include/linux/compat-3.2.h
+index db0f648..fb9ef68 100644
+--- a/include/linux/compat-3.2.h
++++ b/include/linux/compat-3.2.h
+@@ -55,6 +55,15 @@ static inline char *hex_byte_pack(char *buf, u8 byte)
+ 	return buf;
+ }
+ 
++/* module_platform_driver() - Helper macro for drivers that don't do
++ * anything special in module init/exit.  This eliminates a lot of
++ * boilerplate.  Each module may only use this macro once, and
++ * calling it replaces module_init() and module_exit()
++ */
++#define module_platform_driver(__platform_driver) \
++        module_driver(__platform_driver, platform_driver_register, \
++                        platform_driver_unregister)
++
+ #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) */
+ 
+ #endif /* LINUX_3_2_COMPAT_H */
+diff --git a/include/linux/compat-3.3.h b/include/linux/compat-3.3.h
+index 9383a6e..821333c 100644
+--- a/include/linux/compat-3.3.h
++++ b/include/linux/compat-3.3.h
+@@ -33,6 +33,41 @@ static inline void skb_complete_wifi_ack(struct sk_buff *skb, bool acked)
+ 
+ typedef u32 netdev_features_t;
+ 
++/* source include/linux/device.h */
++/**
++ * module_driver() - Helper macro for drivers that don't do anything
++ * special in module init/exit. This eliminates a lot of boilerplate.
++ * Each module may only use this macro once, and calling it replaces
++ * module_init() and module_exit().
++ *
++ * Use this macro to construct bus specific macros for registering
++ * drivers, and do not use it on its own.
++ */
++#define module_driver(__driver, __register, __unregister) \
++static int __init __driver##_init(void) \
++{ \
++	return __register(&(__driver)); \
++} \
++module_init(__driver##_init); \
++static void __exit __driver##_exit(void) \
++{ \
++	__unregister(&(__driver)); \
++} \
++module_exit(__driver##_exit);
++
++/* source include/linux/usb.h */
++/**
++ * module_usb_driver() - Helper macro for registering a USB driver
++ * @__usb_driver: usb_driver struct
++ *
++ * Helper macro for USB drivers which do not do anything special in module
++ * init/exit. This eliminates a lot of boilerplate. Each module may only
++ * use this macro once, and calling it replaces module_init() and module_exit()
++ */
++#define module_usb_driver(__usb_driver) \
++	module_driver(__usb_driver, usb_register, \
++		       usb_deregister)
++
+ #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
+ 
+ #endif /* LINUX_3_3_COMPAT_H */
+-- 
+1.7.5.4
+
+--
+To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
+the body of a message to majordomo at vger.kernel.org
+More majordomo info at  http://vger.kernel.org/majordomo-info.html
+
+
diff --git a/kernel.spec b/kernel.spec
index 22223ac..f7a90f3 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -730,6 +730,7 @@ Patch21030: alps.patch
 
 # compat-wireless patches
 Patch50000: compat-wireless-config-fixups.patch
+Patch50001: compat-add-module_usb_driver-and-module_platform_driver.patch
 
 %endif
 
@@ -1467,6 +1468,7 @@ cd ..
 cd compat-wireless-%{cwversion}
 
 ApplyPatch compat-wireless-config-fixups.patch
+ApplyPatch compat-add-module_usb_driver-and-module_platform_driver.patch
 
 # Remove overlap between bcma/b43 and brcmsmac and reenable bcm4331
 ApplyPatch bcma-brcmsmac-compat.patch
@@ -2211,6 +2213,9 @@ fi
 #                 ||----w |
 #                 ||     ||
 %changelog
+* Sat Dec 03 2011 John W. Linville <linville at redhat.com> 
+- Add compat-wireless patch to define module_usb_driver
+
 * Fri Dec 02 2011 John W. Linville <linville at redhat.com> 
 - Revise compat-wireless configuration
 - Update compat-wireless snapshot


More information about the scm-commits mailing list