With this we can get rid of some of the rfkill related patching mess.
Signed-off-by: Felix Fietkau <[email protected]>
---
--- /dev/null
+++ b/include/linux/rfkill.h
@@ -0,0 +1,32 @@
+#ifndef __COMPAT_RFKILL_H
+#define __COMPAT_RFKILL_H
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
+
+#include_next <linux/rfkill.h>
+
+#else
+
+#include <linux/compat-2.6.h>
+
+#undef CONFIG_RFKILL
+#undef CONFIG_RFKILL_INPUT
+#undef CONFIG_RFKILL_LEDS
+
+#ifdef CONFIG_RFKILL_BACKPORT
+#define CONFIG_RFKILL 1
+#endif
+
+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
+#define CONFIG_RFKILL_INPUT
+#endif
+
+#ifdef CONFIG_RFKILL_BACKPORT_LEDS
+#define CONFIG_RFKILL_LEDS
+#endif
+
+#include <linux/rfkill_backport.h>
+
+#endif
+
+#endif
Signed-off-by: Felix Fietkau <[email protected]>
---
--- a/patches/03-rfkill.patch
+++ b/patches/03-rfkill.patch
@@ -42,19 +42,7 @@ This would do the policing from within mac80211.
+obj-$(CONFIG_RFKILL_BACKPORT) += rfkill_backport.o
--- a/net/rfkill/input.c
+++ b/net/rfkill/input.c
-@@ -17,7 +17,11 @@
- #include <linux/slab.h>
- #include <linux/workqueue.h>
- #include <linux/init.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
- #include <linux/rfkill.h>
-+#else
-+#include <linux/rfkill_backport.h>
-+#endif
- #include <linux/sched.h>
-
- #include "rfkill.h"
-@@ -232,7 +236,7 @@ static int rfkill_connect(struct input_h
+@@ -232,7 +232,7 @@ static int rfkill_connect(struct input_h
handle->dev = dev;
handle->handler = handler;
@@ -65,42 +53,6 @@ This would do the policing from within mac80211.
error = input_register_handle(handle);
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
-@@ -26,7 +26,7 @@
- #include <linux/capability.h>
- #include <linux/list.h>
- #include <linux/mutex.h>
--#include <linux/rfkill.h>
-+#include <linux/rfkill_backport.h>
- #include <linux/sched.h>
- #include <linux/spinlock.h>
- #include <linux/miscdevice.h>
-@@ -63,7 +63,7 @@ struct rfkill {
- const struct rfkill_ops *ops;
- void *data;
-
--#ifdef CONFIG_RFKILL_LEDS
-+#ifdef CONFIG_RFKILL_BACKPORT_LEDS
- struct led_trigger led_trigger;
- const char *ledtrigname;
- #endif
-@@ -124,7 +124,7 @@ static struct {
- static bool rfkill_epo_lock_active;
-
-
--#ifdef CONFIG_RFKILL_LEDS
-+#ifdef CONFIG_RFKILL_BACKPORT_LEDS
- static void rfkill_led_trigger_event(struct rfkill *rfkill)
- {
- struct led_trigger *trigger;
-@@ -304,7 +304,7 @@ static void rfkill_set_block(struct rfki
- rfkill_event(rfkill);
- }
-
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- static atomic_t rfkill_input_disabled = ATOMIC_INIT(0);
-
- /**
@@ -805,7 +805,7 @@ static int rfkill_resume(struct device *
}
@@ -110,115 +62,3 @@ This would do the policing from within mac80211.
.dev_release = rfkill_release,
.dev_attrs = rfkill_dev_attrs,
.dev_uevent = rfkill_dev_uevent,
-@@ -951,7 +951,7 @@ int __must_check rfkill_register(struct
- if (!rfkill->persistent || rfkill_epo_lock_active) {
- schedule_work(&rfkill->sync_work);
- } else {
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- bool soft_blocked = !!(rfkill->state & RFKILL_BLOCK_SW);
-
- if (!atomic_read(&rfkill_input_disabled))
-@@ -1179,7 +1179,7 @@ static int rfkill_fop_release(struct ino
- list_for_each_entry_safe(ev, tmp, &data->events, list)
- kfree(ev);
-
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- if (data->input_handler)
- if (atomic_dec_return(&rfkill_input_disabled) == 0)
- printk(KERN_DEBUG "rfkill: input handler enabled\n");
-@@ -1190,7 +1190,7 @@ static int rfkill_fop_release(struct ino
- return 0;
- }
-
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- static long rfkill_fop_ioctl(struct file *file, unsigned int cmd,
- unsigned long arg)
- {
-@@ -1223,7 +1223,7 @@ static const struct file_operations rfki
- .write = rfkill_fop_write,
- .poll = rfkill_fop_poll,
- .release = rfkill_fop_release,
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- .unlocked_ioctl = rfkill_fop_ioctl,
- .compat_ioctl = rfkill_fop_ioctl,
- #endif
-@@ -1254,7 +1254,7 @@ static int __init rfkill_init(void)
- goto out;
- }
-
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- error = rfkill_handler_init();
- if (error) {
- misc_deregister(&rfkill_miscdev);
-@@ -1270,7 +1270,7 @@ subsys_initcall(rfkill_init);
-
- static void __exit rfkill_exit(void)
- {
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- rfkill_handler_exit();
- #endif
- misc_deregister(&rfkill_miscdev);
---- a/include/linux/rfkill_backport.h
-+++ b/include/linux/rfkill_backport.h
-@@ -20,6 +20,7 @@
- */
-
- #include <linux/types.h>
-+#include <linux/compat-2.6.h>
-
- /* define userspace visible states */
- #define RFKILL_STATE_SOFT_BLOCKED 0
-@@ -148,7 +149,7 @@ struct rfkill_ops {
- int (*set_block)(void *data, bool blocked);
- };
-
--#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-+#if defined(CONFIG_RFKILL_BACKPORT) ||
defined(CONFIG_RFKILL_BACKPORT_MODULE)
- /**
- * rfkill_alloc - allocate rfkill structure
- * @name: name of the struct -- the string is not copied internally
---- a/net/wireless/core.h
-+++ b/net/wireless/core.h
-@@ -11,7 +11,11 @@
- #include <linux/kref.h>
- #include <linux/rbtree.h>
- #include <linux/debugfs.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
- #include <linux/rfkill.h>
-+#else
-+#include <linux/rfkill_backport.h>
-+#endif
- #include <linux/workqueue.h>
- #include <net/genetlink.h>
- #include <net/cfg80211.h>
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1883,7 +1883,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw
-
- pCap->hw_caps |= ATH9K_HW_CAP_ENHANCEDPM;
-
--#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-+#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) &&
defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)) ||
((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) &&
defined(CONFIG_RFKILL_BACKPORT) || defined(CONFIG_RFKILL_BACKPORT_MODULE))
- ah->rfsilent = ah->eep_ops->get_eeprom(ah, EEP_RF_SILENT);
- if (ah->rfsilent & EEP_RFSILENT_ENABLED) {
- ah->rfkill_gpio =
---- a/drivers/net/wireless/ath/ath5k/base.h
-+++ b/drivers/net/wireless/ath/ath5k/base.h
-@@ -46,7 +46,11 @@
- #include <linux/wireless.h>
- #include <linux/if_ether.h>
- #include <linux/leds.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
- #include <linux/rfkill.h>
-+#else
-+#include <linux/rfkill_backport.h>
-+#endif
- #include <linux/workqueue.h>
-
- #include "ath5k.h"
On Wed, Nov 10, 2010 at 3:23 PM, Felix Fietkau <[email protected]> wrote:
> With this we can get rid of some of the rfkill related patching mess.
Applied and pushed, thanks!
Luis
Signed-off-by: Felix Fietkau <[email protected]>
---
--- a/patches/03-rfkill.patch
+++ b/patches/03-rfkill.patch
@@ -42,18 +42,6 @@ This would do the policing from within mac80211.
+obj-$(CONFIG_RFKILL_BACKPORT) += rfkill_backport.o
--- a/net/rfkill/input.c
+++ b/net/rfkill/input.c
-@@ -17,7 +17,11 @@
- #include <linux/slab.h>
- #include <linux/workqueue.h>
- #include <linux/init.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
- #include <linux/rfkill.h>
-+#else
-+#include <linux/rfkill_backport.h>
-+#endif
- #include <linux/sched.h>
-
- #include "rfkill.h"
@@ -232,7 +236,7 @@ static int rfkill_connect(struct input_h
handle->dev = dev;
@@ -65,43 +53,7 @@ This would do the policing from within mac80211.
error = input_register_handle(handle);
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
-@@ -26,7 +26,7 @@
- #include <linux/capability.h>
- #include <linux/list.h>
- #include <linux/mutex.h>
--#include <linux/rfkill.h>
-+#include <linux/rfkill_backport.h>
- #include <linux/sched.h>
- #include <linux/spinlock.h>
- #include <linux/miscdevice.h>
-@@ -63,7 +63,7 @@ struct rfkill {
- const struct rfkill_ops *ops;
- void *data;
-
--#ifdef CONFIG_RFKILL_LEDS
-+#ifdef CONFIG_RFKILL_BACKPORT_LEDS
- struct led_trigger led_trigger;
- const char *ledtrigname;
- #endif
-@@ -124,7 +124,7 @@ static struct {
- static bool rfkill_epo_lock_active;
-
-
--#ifdef CONFIG_RFKILL_LEDS
-+#ifdef CONFIG_RFKILL_BACKPORT_LEDS
- static void rfkill_led_trigger_event(struct rfkill *rfkill)
- {
- struct led_trigger *trigger;
-@@ -304,7 +304,7 @@ static void rfkill_set_block(struct rfki
- rfkill_event(rfkill);
- }
-
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- static atomic_t rfkill_input_disabled = ATOMIC_INIT(0);
-
- /**
-@@ -805,7 +805,7 @@ static int rfkill_resume(struct device *
+@@ -819,7 +819,7 @@ static int rfkill_resume(struct device *
}
static struct class rfkill_class = {
@@ -110,115 +62,4 @@ This would do the policing from within mac80211.
.dev_release = rfkill_release,
.dev_attrs = rfkill_dev_attrs,
.dev_uevent = rfkill_dev_uevent,
-@@ -951,7 +951,7 @@ int __must_check rfkill_register(struct
- if (!rfkill->persistent || rfkill_epo_lock_active) {
- schedule_work(&rfkill->sync_work);
- } else {
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- bool soft_blocked = !!(rfkill->state & RFKILL_BLOCK_SW);
-
- if (!atomic_read(&rfkill_input_disabled))
-@@ -1179,7 +1179,7 @@ static int rfkill_fop_release(struct ino
- list_for_each_entry_safe(ev, tmp, &data->events, list)
- kfree(ev);
-
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- if (data->input_handler)
- if (atomic_dec_return(&rfkill_input_disabled) == 0)
- printk(KERN_DEBUG "rfkill: input handler enabled\n");
-@@ -1190,7 +1190,7 @@ static int rfkill_fop_release(struct ino
- return 0;
- }
-
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- static long rfkill_fop_ioctl(struct file *file, unsigned int cmd,
- unsigned long arg)
- {
-@@ -1223,7 +1223,7 @@ static const struct file_operations rfki
- .write = rfkill_fop_write,
- .poll = rfkill_fop_poll,
- .release = rfkill_fop_release,
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- .unlocked_ioctl = rfkill_fop_ioctl,
- .compat_ioctl = rfkill_fop_ioctl,
- #endif
-@@ -1254,7 +1254,7 @@ static int __init rfkill_init(void)
- goto out;
- }
-
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- error = rfkill_handler_init();
- if (error) {
- misc_deregister(&rfkill_miscdev);
-@@ -1270,7 +1270,7 @@ subsys_initcall(rfkill_init);
-
- static void __exit rfkill_exit(void)
- {
--#ifdef CONFIG_RFKILL_INPUT
-+#ifdef CONFIG_RFKILL_BACKPORT_INPUT
- rfkill_handler_exit();
- #endif
- misc_deregister(&rfkill_miscdev);
---- a/include/linux/rfkill_backport.h
-+++ b/include/linux/rfkill_backport.h
-@@ -20,6 +20,7 @@
- */
-
- #include <linux/types.h>
-+#include <linux/compat-2.6.h>
-
- /* define userspace visible states */
- #define RFKILL_STATE_SOFT_BLOCKED 0
-@@ -148,7 +149,7 @@ struct rfkill_ops {
- int (*set_block)(void *data, bool blocked);
- };
-
--#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-+#if defined(CONFIG_RFKILL_BACKPORT) || defined(CONFIG_RFKILL_BACKPORT_MODULE)
- /**
- * rfkill_alloc - allocate rfkill structure
- * @name: name of the struct -- the string is not copied internally
---- a/net/wireless/core.h
-+++ b/net/wireless/core.h
-@@ -11,7 +11,11 @@
- #include <linux/kref.h>
- #include <linux/rbtree.h>
- #include <linux/debugfs.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
- #include <linux/rfkill.h>
-+#else
-+#include <linux/rfkill_backport.h>
-+#endif
- #include <linux/workqueue.h>
- #include <net/genetlink.h>
- #include <net/cfg80211.h>
---- a/drivers/net/wireless/ath/ath9k/hw.c
-+++ b/drivers/net/wireless/ath/ath9k/hw.c
-@@ -1883,7 +1883,7 @@ int ath9k_hw_fill_cap_info(struct ath_hw
-
- pCap->hw_caps |= ATH9K_HW_CAP_ENHANCEDPM;
-
--#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-+#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) && defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) && defined(CONFIG_RFKILL_BACKPORT) || defined(CONFIG_RFKILL_BACKPORT_MODULE))
- ah->rfsilent = ah->eep_ops->get_eeprom(ah, EEP_RF_SILENT);
- if (ah->rfsilent & EEP_RFSILENT_ENABLED) {
- ah->rfkill_gpio =
---- a/drivers/net/wireless/ath/ath5k/base.h
-+++ b/drivers/net/wireless/ath/ath5k/base.h
-@@ -46,7 +46,11 @@
- #include <linux/wireless.h>
- #include <linux/if_ether.h>
- #include <linux/leds.h>
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
- #include <linux/rfkill.h>
-+#else
-+#include <linux/rfkill_backport.h>
-+#endif
- #include <linux/workqueue.h>
-
- #include "ath5k.h"
+
On Wed, Nov 10, 2010 at 4:04 PM, Felix Fietkau <[email protected]> wrote:
> Signed-off-by: Felix Fietkau <[email protected]>
applied an pushed, thanks!
Luis
On Wed, Nov 10, 2010 at 3:24 PM, Felix Fietkau <[email protected]> wrote:
> Signed-off-by: Felix Fietkau <[email protected]>
This didn't apply at all, hrm. Can you
git fetch; git rebase origin/master
$ git describe
compat-wireless-2010-11-10-1-gbf23d4b