Documentation/feature-removal-schedule.txt | 7 - arch/mips/configs/bcm47xx_defconfig | 1 - arch/mips/configs/lemote2f_defconfig | 1 - net/rfkill/Kconfig | 6 - net/rfkill/Makefile | 1 - net/rfkill/core.c | 202 ---------------- net/rfkill/input.c | 350 ---------------------------- 7 files changed, 0 insertions(+), 568 deletions(-) diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 46679e4..ebf2db4 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -345,13 +345,6 @@ Who: Alex Chiang --------------------------- -What: CONFIG_RFKILL_INPUT -When: 2.6.33 -Why: Should be implemented in userspace, policy daemon. -Who: Johannes Berg - ----------------------------- - What: sound-slot/service-* module aliases and related clutters in sound/sound_core.c When: August 2010 diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig index 22fdf2f..3d724ef 100644 --- a/arch/mips/configs/bcm47xx_defconfig +++ b/arch/mips/configs/bcm47xx_defconfig @@ -268,7 +268,6 @@ CONFIG_MAC80211_RC_PID=y CONFIG_MAC80211_RC_DEFAULT_PID=y CONFIG_MAC80211_MESH=y CONFIG_RFKILL=m -CONFIG_RFKILL_INPUT=y CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" CONFIG_FW_LOADER=m CONFIG_CONNECTOR=m diff --git a/arch/mips/configs/lemote2f_defconfig b/arch/mips/configs/lemote2f_defconfig index 167c1d0..3ffb909 100644 --- a/arch/mips/configs/lemote2f_defconfig +++ b/arch/mips/configs/lemote2f_defconfig @@ -103,7 +103,6 @@ CONFIG_LIB80211_DEBUG=y CONFIG_MAC80211=m CONFIG_MAC80211_LEDS=y CONFIG_RFKILL=m -CONFIG_RFKILL_INPUT=y CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_CRYPTOLOOP=m diff --git a/net/rfkill/Kconfig b/net/rfkill/Kconfig index 48464ca..c192603 100644 --- a/net/rfkill/Kconfig +++ b/net/rfkill/Kconfig @@ -17,12 +17,6 @@ config RFKILL_LEDS depends on LEDS_TRIGGERS = y || RFKILL = LEDS_TRIGGERS default y -config RFKILL_INPUT - bool "RF switch input support" if EXPERT - depends on RFKILL - depends on INPUT = y || RFKILL = INPUT - default y if !EXPERT - config RFKILL_REGULATOR tristate "Generic rfkill regulator driver" depends on RFKILL || !RFKILL diff --git a/net/rfkill/Makefile b/net/rfkill/Makefile index d9a5a58..0d5e3e1 100644 --- a/net/rfkill/Makefile +++ b/net/rfkill/Makefile @@ -3,6 +3,5 @@ # rfkill-y += core.o -rfkill-$(CONFIG_RFKILL_INPUT) += input.o obj-$(CONFIG_RFKILL) += rfkill.o obj-$(CONFIG_RFKILL_REGULATOR) += rfkill-regulator.o diff --git a/net/rfkill/core.c b/net/rfkill/core.c index 0198191..47ab44e 100644 --- a/net/rfkill/core.c +++ b/net/rfkill/core.c @@ -304,153 +304,6 @@ static void rfkill_set_block(struct rfkill *rfkill, bool blocked) rfkill_event(rfkill); } -#ifdef CONFIG_RFKILL_INPUT -static atomic_t rfkill_input_disabled = ATOMIC_INIT(0); - -/** - * __rfkill_switch_all - Toggle state of all switches of given type - * @type: type of interfaces to be affected - * @state: the new state - * - * This function sets the state of all switches of given type, - * unless a specific switch is claimed by userspace (in which case, - * that switch is left alone) or suspended. - * - * Caller must have acquired rfkill_global_mutex. - */ -static void __rfkill_switch_all(const enum rfkill_type type, bool blocked) -{ - struct rfkill *rfkill; - - rfkill_global_states[type].cur = blocked; - list_for_each_entry(rfkill, &rfkill_list, node) { - if (rfkill->type != type) - continue; - - rfkill_set_block(rfkill, blocked); - } -} - -/** - * rfkill_switch_all - Toggle state of all switches of given type - * @type: type of interfaces to be affected - * @state: the new state - * - * Acquires rfkill_global_mutex and calls __rfkill_switch_all(@type, @state). - * Please refer to __rfkill_switch_all() for details. - * - * Does nothing if the EPO lock is active. - */ -void rfkill_switch_all(enum rfkill_type type, bool blocked) -{ - if (atomic_read(&rfkill_input_disabled)) - return; - - mutex_lock(&rfkill_global_mutex); - - if (!rfkill_epo_lock_active) - __rfkill_switch_all(type, blocked); - - mutex_unlock(&rfkill_global_mutex); -} - -/** - * rfkill_epo - emergency power off all transmitters - * - * This kicks all non-suspended rfkill devices to RFKILL_STATE_SOFT_BLOCKED, - * ignoring everything in its path but rfkill_global_mutex and rfkill->mutex. - * - * The global state before the EPO is saved and can be restored later - * using rfkill_restore_states(). - */ -void rfkill_epo(void) -{ - struct rfkill *rfkill; - int i; - - if (atomic_read(&rfkill_input_disabled)) - return; - - mutex_lock(&rfkill_global_mutex); - - rfkill_epo_lock_active = true; - list_for_each_entry(rfkill, &rfkill_list, node) - rfkill_set_block(rfkill, true); - - for (i = 0; i < NUM_RFKILL_TYPES; i++) { - rfkill_global_states[i].sav = rfkill_global_states[i].cur; - rfkill_global_states[i].cur = true; - } - - mutex_unlock(&rfkill_global_mutex); -} - -/** - * rfkill_restore_states - restore global states - * - * Restore (and sync switches to) the global state from the - * states in rfkill_default_states. This can undo the effects of - * a call to rfkill_epo(). - */ -void rfkill_restore_states(void) -{ - int i; - - if (atomic_read(&rfkill_input_disabled)) - return; - - mutex_lock(&rfkill_global_mutex); - - rfkill_epo_lock_active = false; - for (i = 0; i < NUM_RFKILL_TYPES; i++) - __rfkill_switch_all(i, rfkill_global_states[i].sav); - mutex_unlock(&rfkill_global_mutex); -} - -/** - * rfkill_remove_epo_lock - unlock state changes - * - * Used by rfkill-input manually unlock state changes, when - * the EPO switch is deactivated. - */ -void rfkill_remove_epo_lock(void) -{ - if (atomic_read(&rfkill_input_disabled)) - return; - - mutex_lock(&rfkill_global_mutex); - rfkill_epo_lock_active = false; - mutex_unlock(&rfkill_global_mutex); -} - -/** - * rfkill_is_epo_lock_active - returns true EPO is active - * - * Returns 0 (false) if there is NOT an active EPO contidion, - * and 1 (true) if there is an active EPO contition, which - * locks all radios in one of the BLOCKED states. - * - * Can be called in atomic context. - */ -bool rfkill_is_epo_lock_active(void) -{ - return rfkill_epo_lock_active; -} - -/** - * rfkill_get_global_sw_state - returns global state for a type - * @type: the type to get the global state of - * - * Returns the current global state for a given wireless - * device type. - */ -bool rfkill_get_global_sw_state(const enum rfkill_type type) -{ - return rfkill_global_states[type].cur; -} -#endif - - bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked) { bool ret, change; @@ -950,13 +803,6 @@ int __must_check rfkill_register(struct rfkill *rfkill) if (!rfkill->persistent || rfkill_epo_lock_active) { schedule_work(&rfkill->sync_work); - } else { -#ifdef CONFIG_RFKILL_INPUT - bool soft_blocked = !!(rfkill->state & RFKILL_BLOCK_SW); - - if (!atomic_read(&rfkill_input_disabled)) - __rfkill_switch_all(rfkill->type, soft_blocked); -#endif } rfkill_send_events(rfkill, RFKILL_OP_ADD); @@ -1179,43 +1025,11 @@ static int rfkill_fop_release(struct inode *inode, struct file *file) list_for_each_entry_safe(ev, tmp, &data->events, list) kfree(ev); -#ifdef CONFIG_RFKILL_INPUT - if (data->input_handler) - if (atomic_dec_return(&rfkill_input_disabled) == 0) - printk(KERN_DEBUG "rfkill: input handler enabled\n"); -#endif - kfree(data); return 0; } -#ifdef CONFIG_RFKILL_INPUT -static long rfkill_fop_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - struct rfkill_data *data = file->private_data; - - if (_IOC_TYPE(cmd) != RFKILL_IOC_MAGIC) - return -ENOSYS; - - if (_IOC_NR(cmd) != RFKILL_IOC_NOINPUT) - return -ENOSYS; - - mutex_lock(&data->mtx); - - if (!data->input_handler) { - if (atomic_inc_return(&rfkill_input_disabled) == 1) - printk(KERN_DEBUG "rfkill: input handler disabled\n"); - data->input_handler = true; - } - - mutex_unlock(&data->mtx); - - return 0; -} -#endif - static const struct file_operations rfkill_fops = { .owner = THIS_MODULE, .open = rfkill_fop_open, @@ -1223,10 +1037,6 @@ static const struct file_operations rfkill_fops = { .write = rfkill_fop_write, .poll = rfkill_fop_poll, .release = rfkill_fop_release, -#ifdef CONFIG_RFKILL_INPUT - .unlocked_ioctl = rfkill_fop_ioctl, - .compat_ioctl = rfkill_fop_ioctl, -#endif .llseek = no_llseek, }; @@ -1254,15 +1064,6 @@ static int __init rfkill_init(void) goto out; } -#ifdef CONFIG_RFKILL_INPUT - error = rfkill_handler_init(); - if (error) { - misc_deregister(&rfkill_miscdev); - class_unregister(&rfkill_class); - goto out; - } -#endif - out: return error; } @@ -1270,9 +1071,6 @@ subsys_initcall(rfkill_init); static void __exit rfkill_exit(void) { -#ifdef CONFIG_RFKILL_INPUT - rfkill_handler_exit(); -#endif misc_deregister(&rfkill_miscdev); class_unregister(&rfkill_class); } diff --git a/net/rfkill/input.c b/net/rfkill/input.c deleted file mode 100644 index 1bca6d4..0000000 --- a/net/rfkill/input.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Input layer to RF Kill interface connector - * - * Copyright (c) 2007 Dmitry Torokhov - * Copyright 2009 Johannes Berg - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - * If you ever run into a situation in which you have a SW_ type rfkill - * input device, then you can revive code that was removed in the patch - * "rfkill-input: remove unused code". - */ - -#include -#include -#include -#include -#include -#include - -#include "rfkill.h" - -enum rfkill_input_master_mode { - RFKILL_INPUT_MASTER_UNLOCK = 0, - RFKILL_INPUT_MASTER_RESTORE = 1, - RFKILL_INPUT_MASTER_UNBLOCKALL = 2, - NUM_RFKILL_INPUT_MASTER_MODES -}; - -/* Delay (in ms) between consecutive switch ops */ -#define RFKILL_OPS_DELAY 200 - -static enum rfkill_input_master_mode rfkill_master_switch_mode = - RFKILL_INPUT_MASTER_UNBLOCKALL; -module_param_named(master_switch_mode, rfkill_master_switch_mode, uint, 0); -MODULE_PARM_DESC(master_switch_mode, - "SW_RFKILL_ALL ON should: 0=do nothing (only unlock); 1=restore; 2=unblock all"); - -static spinlock_t rfkill_op_lock; -static bool rfkill_op_pending; -static unsigned long rfkill_sw_pending[BITS_TO_LONGS(NUM_RFKILL_TYPES)]; -static unsigned long rfkill_sw_state[BITS_TO_LONGS(NUM_RFKILL_TYPES)]; - -enum rfkill_sched_op { - RFKILL_GLOBAL_OP_EPO = 0, - RFKILL_GLOBAL_OP_RESTORE, - RFKILL_GLOBAL_OP_UNLOCK, - RFKILL_GLOBAL_OP_UNBLOCK, -}; - -static enum rfkill_sched_op rfkill_master_switch_op; -static enum rfkill_sched_op rfkill_op; - -static void __rfkill_handle_global_op(enum rfkill_sched_op op) -{ - unsigned int i; - - switch (op) { - case RFKILL_GLOBAL_OP_EPO: - rfkill_epo(); - break; - case RFKILL_GLOBAL_OP_RESTORE: - rfkill_restore_states(); - break; - case RFKILL_GLOBAL_OP_UNLOCK: - rfkill_remove_epo_lock(); - break; - case RFKILL_GLOBAL_OP_UNBLOCK: - rfkill_remove_epo_lock(); - for (i = 0; i < NUM_RFKILL_TYPES; i++) - rfkill_switch_all(i, false); - break; - default: - /* memory corruption or bug, fail safely */ - rfkill_epo(); - WARN(1, "Unknown requested operation %d! " - "rfkill Emergency Power Off activated\n", - op); - } -} - -static void __rfkill_handle_normal_op(const enum rfkill_type type, - const bool complement) -{ - bool blocked; - - blocked = rfkill_get_global_sw_state(type); - if (complement) - blocked = !blocked; - - rfkill_switch_all(type, blocked); -} - -static void rfkill_op_handler(struct work_struct *work) -{ - unsigned int i; - bool c; - - spin_lock_irq(&rfkill_op_lock); - do { - if (rfkill_op_pending) { - enum rfkill_sched_op op = rfkill_op; - rfkill_op_pending = false; - memset(rfkill_sw_pending, 0, - sizeof(rfkill_sw_pending)); - spin_unlock_irq(&rfkill_op_lock); - - __rfkill_handle_global_op(op); - - spin_lock_irq(&rfkill_op_lock); - - /* - * handle global ops first -- during unlocked period - * we might have gotten a new global op. - */ - if (rfkill_op_pending) - continue; - } - - if (rfkill_is_epo_lock_active()) - continue; - - for (i = 0; i < NUM_RFKILL_TYPES; i++) { - if (__test_and_clear_bit(i, rfkill_sw_pending)) { - c = __test_and_clear_bit(i, rfkill_sw_state); - spin_unlock_irq(&rfkill_op_lock); - - __rfkill_handle_normal_op(i, c); - - spin_lock_irq(&rfkill_op_lock); - } - } - } while (rfkill_op_pending); - spin_unlock_irq(&rfkill_op_lock); -} - -static DECLARE_DELAYED_WORK(rfkill_op_work, rfkill_op_handler); -static unsigned long rfkill_last_scheduled; - -static unsigned long rfkill_ratelimit(const unsigned long last) -{ - const unsigned long delay = msecs_to_jiffies(RFKILL_OPS_DELAY); - return time_after(jiffies, last + delay) ? 0 : delay; -} - -static void rfkill_schedule_ratelimited(void) -{ - if (delayed_work_pending(&rfkill_op_work)) - return; - schedule_delayed_work(&rfkill_op_work, - rfkill_ratelimit(rfkill_last_scheduled)); - rfkill_last_scheduled = jiffies; -} - -static void rfkill_schedule_global_op(enum rfkill_sched_op op) -{ - unsigned long flags; - - spin_lock_irqsave(&rfkill_op_lock, flags); - rfkill_op = op; - rfkill_op_pending = true; - if (op == RFKILL_GLOBAL_OP_EPO && !rfkill_is_epo_lock_active()) { - /* bypass the limiter for EPO */ - cancel_delayed_work(&rfkill_op_work); - schedule_delayed_work(&rfkill_op_work, 0); - rfkill_last_scheduled = jiffies; - } else - rfkill_schedule_ratelimited(); - spin_unlock_irqrestore(&rfkill_op_lock, flags); -} - -static void rfkill_schedule_toggle(enum rfkill_type type) -{ - unsigned long flags; - - if (rfkill_is_epo_lock_active()) - return; - - spin_lock_irqsave(&rfkill_op_lock, flags); - if (!rfkill_op_pending) { - __set_bit(type, rfkill_sw_pending); - __change_bit(type, rfkill_sw_state); - rfkill_schedule_ratelimited(); - } - spin_unlock_irqrestore(&rfkill_op_lock, flags); -} - -static void rfkill_schedule_evsw_rfkillall(int state) -{ - if (state) - rfkill_schedule_global_op(rfkill_master_switch_op); - else - rfkill_schedule_global_op(RFKILL_GLOBAL_OP_EPO); -} - -static void rfkill_event(struct input_handle *handle, unsigned int type, - unsigned int code, int data) -{ - if (type == EV_KEY && data == 1) { - switch (code) { - case KEY_WLAN: - rfkill_schedule_toggle(RFKILL_TYPE_WLAN); - break; - case KEY_BLUETOOTH: - rfkill_schedule_toggle(RFKILL_TYPE_BLUETOOTH); - break; - case KEY_UWB: - rfkill_schedule_toggle(RFKILL_TYPE_UWB); - break; - case KEY_WIMAX: - rfkill_schedule_toggle(RFKILL_TYPE_WIMAX); - break; - case KEY_RFKILL: - rfkill_schedule_toggle(RFKILL_TYPE_ALL); - break; - } - } else if (type == EV_SW && code == SW_RFKILL_ALL) - rfkill_schedule_evsw_rfkillall(data); -} - -static int rfkill_connect(struct input_handler *handler, struct input_dev *dev, - const struct input_device_id *id) -{ - struct input_handle *handle; - int error; - - handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); - if (!handle) - return -ENOMEM; - - handle->dev = dev; - handle->handler = handler; - handle->name = "rfkill"; - - /* causes rfkill_start() to be called */ - error = input_register_handle(handle); - if (error) - goto err_free_handle; - - error = input_open_device(handle); - if (error) - goto err_unregister_handle; - - return 0; - - err_unregister_handle: - input_unregister_handle(handle); - err_free_handle: - kfree(handle); - return error; -} - -static void rfkill_start(struct input_handle *handle) -{ - /* - * Take event_lock to guard against configuration changes, we - * should be able to deal with concurrency with rfkill_event() - * just fine (which event_lock will also avoid). - */ - spin_lock_irq(&handle->dev->event_lock); - - if (test_bit(EV_SW, handle->dev->evbit) && - test_bit(SW_RFKILL_ALL, handle->dev->swbit)) - rfkill_schedule_evsw_rfkillall(test_bit(SW_RFKILL_ALL, - handle->dev->sw)); - - spin_unlock_irq(&handle->dev->event_lock); -} - -static void rfkill_disconnect(struct input_handle *handle) -{ - input_close_device(handle); - input_unregister_handle(handle); - kfree(handle); -} - -static const struct input_device_id rfkill_ids[] = { - { - .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, - .evbit = { BIT_MASK(EV_KEY) }, - .keybit = { [BIT_WORD(KEY_WLAN)] = BIT_MASK(KEY_WLAN) }, - }, - { - .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, - .evbit = { BIT_MASK(EV_KEY) }, - .keybit = { [BIT_WORD(KEY_BLUETOOTH)] = BIT_MASK(KEY_BLUETOOTH) }, - }, - { - .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, - .evbit = { BIT_MASK(EV_KEY) }, - .keybit = { [BIT_WORD(KEY_UWB)] = BIT_MASK(KEY_UWB) }, - }, - { - .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, - .evbit = { BIT_MASK(EV_KEY) }, - .keybit = { [BIT_WORD(KEY_WIMAX)] = BIT_MASK(KEY_WIMAX) }, - }, - { - .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, - .evbit = { BIT_MASK(EV_KEY) }, - .keybit = { [BIT_WORD(KEY_RFKILL)] = BIT_MASK(KEY_RFKILL) }, - }, - { - .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_SWBIT, - .evbit = { BIT(EV_SW) }, - .swbit = { [BIT_WORD(SW_RFKILL_ALL)] = BIT_MASK(SW_RFKILL_ALL) }, - }, - { } -}; - -static struct input_handler rfkill_handler = { - .name = "rfkill", - .event = rfkill_event, - .connect = rfkill_connect, - .start = rfkill_start, - .disconnect = rfkill_disconnect, - .id_table = rfkill_ids, -}; - -int __init rfkill_handler_init(void) -{ - switch (rfkill_master_switch_mode) { - case RFKILL_INPUT_MASTER_UNBLOCKALL: - rfkill_master_switch_op = RFKILL_GLOBAL_OP_UNBLOCK; - break; - case RFKILL_INPUT_MASTER_RESTORE: - rfkill_master_switch_op = RFKILL_GLOBAL_OP_RESTORE; - break; - case RFKILL_INPUT_MASTER_UNLOCK: - rfkill_master_switch_op = RFKILL_GLOBAL_OP_UNLOCK; - break; - default: - return -EINVAL; - } - - spin_lock_init(&rfkill_op_lock); - - /* Avoid delay at first schedule */ - rfkill_last_scheduled = - jiffies - msecs_to_jiffies(RFKILL_OPS_DELAY) - 1; - return input_register_handler(&rfkill_handler); -} - -void __exit rfkill_handler_exit(void) -{ - input_unregister_handler(&rfkill_handler); - cancel_delayed_work_sync(&rfkill_op_work); -}