// SPDX-License-Identifier: GPL-2.0-or-later/* * Copyright (C) 2006 - 2007 Ivo van Doorn * Copyright (C) 2007 Dmitry Torokhov * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> */#include<linux/kernel.h>#include<linux/module.h>#include<linux/init.h>#include<linux/workqueue.h>#include<linux/capability.h>#include<linux/list.h>#include<linux/mutex.h>#include<linux/rfkill.h>#include<linux/sched.h>#include<linux/spinlock.h>#include<linux/device.h>#include<linux/miscdevice.h>#include<linux/wait.h>#include<linux/poll.h>#include<linux/fs.h>#include<linux/slab.h>#include"rfkill.h"#define POLL_INTERVAL (5 * HZ)#define RFKILL_BLOCK_HW BIT(0)#define RFKILL_BLOCK_SW BIT(1)#define RFKILL_BLOCK_SW_PREV BIT(2)#define RFKILL_BLOCK_ANY (RFKILL_BLOCK_HW |\ RFKILL_BLOCK_SW |\ RFKILL_BLOCK_SW_PREV)#define RFKILL_BLOCK_SW_SETCALL BIT(31)structrfkill{spinlock_tlock;enumrfkill_typetype;unsignedlongstate;unsignedlonghard_block_reasons;u32idx;boolregistered;boolpersistent;boolpolling_paused;boolsuspended;conststructrfkill_ops*ops;void*data;#ifdef CONFIG_RFKILL_LEDSstructled_triggerled_trigger;constchar*ledtrigname;#endifstructdevicedev;structlist_headnode;structdelayed_workpoll_work;structwork_structuevent_work;structwork_structsync_work;charname[];};#define to_rfkill(d) container_of(d, struct rfkill, dev)structrfkill_int_event{structlist_headlist;structrfkill_eventev;};structrfkill_data{structlist_headlist;structlist_headevents;structmutexmtx;wait_queue_head_tread_wait;boolinput_handler;};MODULE_AUTHOR("Ivo van Doorn <IvDoorn@gmail.com>");MODULE_AUTHOR("Johannes Berg <johannes@sipsolutions.net>");MODULE_DESCRIPTION("RF switch support");MODULE_LICENSE("GPL");/* * The locking here should be made much smarter, we currently have * a bit of a stupid situation because drivers might want to register
<