#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 …
#define RFKILL_BLOCK_HW …
#define RFKILL_BLOCK_SW …
#define RFKILL_BLOCK_SW_PREV …
#define RFKILL_BLOCK_ANY …
#define RFKILL_BLOCK_SW_SETCALL …
struct rfkill { … };
#define to_rfkill(d) …
struct rfkill_int_event { … };
struct rfkill_data { … };
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static LIST_HEAD(rfkill_list);
static DEFINE_MUTEX(rfkill_global_mutex);
static LIST_HEAD(rfkill_fds);
static unsigned int rfkill_default_state = …;
module_param_named(default_state, rfkill_default_state, uint, 0444);
MODULE_PARM_DESC(…) …;
static struct { … } rfkill_global_states[NUM_RFKILL_TYPES];
static bool rfkill_epo_lock_active;
#ifdef CONFIG_RFKILL_LEDS
static void rfkill_led_trigger_event(struct rfkill *rfkill)
{ … }
static int rfkill_led_trigger_activate(struct led_classdev *led)
{ … }
const char *rfkill_get_led_trigger_name(struct rfkill *rfkill)
{ … }
EXPORT_SYMBOL(…);
void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name)
{ … }
EXPORT_SYMBOL(…);
static int rfkill_led_trigger_register(struct rfkill *rfkill)
{ … }
static void rfkill_led_trigger_unregister(struct rfkill *rfkill)
{ … }
static struct led_trigger rfkill_any_led_trigger;
static struct led_trigger rfkill_none_led_trigger;
static struct work_struct rfkill_global_led_trigger_work;
static void rfkill_global_led_trigger_worker(struct work_struct *work)
{ … }
static void rfkill_global_led_trigger_event(void)
{ … }
static int rfkill_global_led_trigger_register(void)
{ … }
static void rfkill_global_led_trigger_unregister(void)
{ … }
#else
static void rfkill_led_trigger_event(struct rfkill *rfkill)
{
}
static inline int rfkill_led_trigger_register(struct rfkill *rfkill)
{
return 0;
}
static inline void rfkill_led_trigger_unregister(struct rfkill *rfkill)
{
}
static void rfkill_global_led_trigger_event(void)
{
}
static int rfkill_global_led_trigger_register(void)
{
return 0;
}
static void rfkill_global_led_trigger_unregister(void)
{
}
#endif
static void rfkill_fill_event(struct rfkill_event_ext *ev,
struct rfkill *rfkill,
enum rfkill_operation op)
{ … }
static void rfkill_send_events(struct rfkill *rfkill, enum rfkill_operation op)
{ … }
static void rfkill_event(struct rfkill *rfkill)
{ … }
static void rfkill_set_block(struct rfkill *rfkill, bool blocked)
{ … }
static void rfkill_sync(struct rfkill *rfkill)
{ … }
static void rfkill_update_global_state(enum rfkill_type type, bool blocked)
{ … }
#ifdef CONFIG_RFKILL_INPUT
static atomic_t rfkill_input_disabled = …;
static void __rfkill_switch_all(const enum rfkill_type type, bool blocked)
{ … }
void rfkill_switch_all(enum rfkill_type type, bool blocked)
{ … }
void rfkill_epo(void)
{ … }
void rfkill_restore_states(void)
{ … }
void rfkill_remove_epo_lock(void)
{ … }
bool rfkill_is_epo_lock_active(void)
{ … }
bool rfkill_get_global_sw_state(const enum rfkill_type type)
{ … }
#endif
bool rfkill_set_hw_state_reason(struct rfkill *rfkill,
bool blocked, unsigned long reason)
{ … }
EXPORT_SYMBOL(…);
static void __rfkill_set_sw_state(struct rfkill *rfkill, bool blocked)
{ … }
bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked)
{ … }
EXPORT_SYMBOL(…);
void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked)
{ … }
EXPORT_SYMBOL(…);
void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw)
{ … }
EXPORT_SYMBOL(…);
static const char * const rfkill_types[] = …;
enum rfkill_type rfkill_find_type(const char *name)
{ … }
EXPORT_SYMBOL(…);
static ssize_t name_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(name);
static ssize_t type_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(type);
static ssize_t index_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(index);
static ssize_t persistent_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(persistent);
static ssize_t hard_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(hard);
static ssize_t soft_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t soft_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(soft);
static ssize_t hard_block_reasons_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(hard_block_reasons);
static u8 user_state_from_blocked(unsigned long state)
{ … }
static ssize_t state_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static ssize_t state_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(state);
static struct attribute *rfkill_dev_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void rfkill_release(struct device *dev)
{ … }
static int rfkill_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
{ … }
void rfkill_pause_polling(struct rfkill *rfkill)
{ … }
EXPORT_SYMBOL(…);
void rfkill_resume_polling(struct rfkill *rfkill)
{ … }
EXPORT_SYMBOL(…);
#ifdef CONFIG_PM_SLEEP
static int rfkill_suspend(struct device *dev)
{ … }
static int rfkill_resume(struct device *dev)
{ … }
static SIMPLE_DEV_PM_OPS(rfkill_pm_ops, rfkill_suspend, rfkill_resume);
#define RFKILL_PM_OPS …
#else
#define RFKILL_PM_OPS …
#endif
static struct class rfkill_class = …;
bool rfkill_blocked(struct rfkill *rfkill)
{ … }
EXPORT_SYMBOL(…);
bool rfkill_soft_blocked(struct rfkill *rfkill)
{ … }
EXPORT_SYMBOL(…);
struct rfkill * __must_check rfkill_alloc(const char *name,
struct device *parent,
const enum rfkill_type type,
const struct rfkill_ops *ops,
void *ops_data)
{ … }
EXPORT_SYMBOL(…);
static void rfkill_poll(struct work_struct *work)
{ … }
static void rfkill_uevent_work(struct work_struct *work)
{ … }
static void rfkill_sync_work(struct work_struct *work)
{ … }
int __must_check rfkill_register(struct rfkill *rfkill)
{ … }
EXPORT_SYMBOL(…);
void rfkill_unregister(struct rfkill *rfkill)
{ … }
EXPORT_SYMBOL(…);
void rfkill_destroy(struct rfkill *rfkill)
{ … }
EXPORT_SYMBOL(…);
static int rfkill_fop_open(struct inode *inode, struct file *file)
{ … }
static __poll_t rfkill_fop_poll(struct file *file, poll_table *wait)
{ … }
static ssize_t rfkill_fop_read(struct file *file, char __user *buf,
size_t count, loff_t *pos)
{ … }
static ssize_t rfkill_fop_write(struct file *file, const char __user *buf,
size_t count, loff_t *pos)
{ … }
static int rfkill_fop_release(struct inode *inode, struct file *file)
{ … }
static long rfkill_fop_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{ … }
static const struct file_operations rfkill_fops = …;
#define RFKILL_NAME …
static struct miscdevice rfkill_miscdev = …;
static int __init rfkill_init(void)
{ … }
subsys_initcall(rfkill_init);
static void __exit rfkill_exit(void)
{ … }
module_exit(rfkill_exit);
MODULE_ALIAS_MISCDEV(…);
MODULE_ALIAS(…) …;