| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 1 | #ifndef __RFKILL_H | 
|  | 2 | #define __RFKILL_H | 
|  | 3 |  | 
|  | 4 | /* | 
| Ivo van Doorn | fe242cf | 2007-09-27 14:57:05 -0700 | [diff] [blame] | 5 | * Copyright (C) 2006 - 2007 Ivo van Doorn | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 6 | * Copyright (C) 2007 Dmitry Torokhov | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 7 | * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 8 | * | 
| Johannes Berg | 8bc11b4 | 2009-08-26 18:13:17 +0200 | [diff] [blame] | 9 | * Permission to use, copy, modify, and/or distribute this software for any | 
|  | 10 | * purpose with or without fee is hereby granted, provided that the above | 
|  | 11 | * copyright notice and this permission notice appear in all copies. | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 12 | * | 
| Johannes Berg | 8bc11b4 | 2009-08-26 18:13:17 +0200 | [diff] [blame] | 13 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 
|  | 14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 
|  | 15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 
|  | 16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 
|  | 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 
|  | 18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 
|  | 19 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 20 | */ | 
|  | 21 |  | 
| Johannes Berg | c64fb01 | 2009-06-02 13:01:38 +0200 | [diff] [blame] | 22 | #include <linux/types.h> | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 23 |  | 
|  | 24 | /* define userspace visible states */ | 
|  | 25 | #define RFKILL_STATE_SOFT_BLOCKED	0 | 
|  | 26 | #define RFKILL_STATE_UNBLOCKED		1 | 
|  | 27 | #define RFKILL_STATE_HARD_BLOCKED	2 | 
|  | 28 |  | 
| Johannes Berg | c64fb01 | 2009-06-02 13:01:38 +0200 | [diff] [blame] | 29 | /** | 
|  | 30 | * enum rfkill_type - type of rfkill switch. | 
|  | 31 | * | 
|  | 32 | * @RFKILL_TYPE_ALL: toggles all switches (userspace only) | 
|  | 33 | * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. | 
|  | 34 | * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. | 
|  | 35 | * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. | 
|  | 36 | * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device. | 
|  | 37 | * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device. | 
|  | 38 | * @NUM_RFKILL_TYPES: number of defined rfkill types | 
|  | 39 | */ | 
|  | 40 | enum rfkill_type { | 
|  | 41 | RFKILL_TYPE_ALL = 0, | 
|  | 42 | RFKILL_TYPE_WLAN, | 
|  | 43 | RFKILL_TYPE_BLUETOOTH, | 
|  | 44 | RFKILL_TYPE_UWB, | 
|  | 45 | RFKILL_TYPE_WIMAX, | 
|  | 46 | RFKILL_TYPE_WWAN, | 
| Tomas Winkler | 3ad2014 | 2009-08-02 02:36:49 +0300 | [diff] [blame] | 47 | RFKILL_TYPE_GPS, | 
| Johannes Berg | c64fb01 | 2009-06-02 13:01:38 +0200 | [diff] [blame] | 48 | NUM_RFKILL_TYPES, | 
|  | 49 | }; | 
|  | 50 |  | 
|  | 51 | /** | 
|  | 52 | * enum rfkill_operation - operation types | 
|  | 53 | * @RFKILL_OP_ADD: a device was added | 
|  | 54 | * @RFKILL_OP_DEL: a device was removed | 
|  | 55 | * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device | 
|  | 56 | * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all) | 
|  | 57 | */ | 
|  | 58 | enum rfkill_operation { | 
|  | 59 | RFKILL_OP_ADD = 0, | 
|  | 60 | RFKILL_OP_DEL, | 
|  | 61 | RFKILL_OP_CHANGE, | 
|  | 62 | RFKILL_OP_CHANGE_ALL, | 
|  | 63 | }; | 
|  | 64 |  | 
|  | 65 | /** | 
|  | 66 | * struct rfkill_event - events for userspace on /dev/rfkill | 
|  | 67 | * @idx: index of dev rfkill | 
|  | 68 | * @type: type of the rfkill struct | 
|  | 69 | * @op: operation code | 
|  | 70 | * @hard: hard state (0/1) | 
|  | 71 | * @soft: soft state (0/1) | 
|  | 72 | * | 
|  | 73 | * Structure used for userspace communication on /dev/rfkill, | 
|  | 74 | * used for events from the kernel and control to the kernel. | 
|  | 75 | */ | 
|  | 76 | struct rfkill_event { | 
|  | 77 | __u32 idx; | 
|  | 78 | __u8  type; | 
|  | 79 | __u8  op; | 
|  | 80 | __u8  soft, hard; | 
|  | 81 | } __packed; | 
|  | 82 |  | 
| Johannes Berg | 1be491f | 2009-07-05 14:51:06 +0200 | [diff] [blame] | 83 | /* | 
|  | 84 | * We are planning to be backward and forward compatible with changes | 
|  | 85 | * to the event struct, by adding new, optional, members at the end. | 
|  | 86 | * When reading an event (whether the kernel from userspace or vice | 
|  | 87 | * versa) we need to accept anything that's at least as large as the | 
|  | 88 | * version 1 event size, but might be able to accept other sizes in | 
|  | 89 | * the future. | 
|  | 90 | * | 
|  | 91 | * One exception is the kernel -- we already have two event sizes in | 
|  | 92 | * that we've made the 'hard' member optional since our only option | 
|  | 93 | * is to ignore it anyway. | 
|  | 94 | */ | 
|  | 95 | #define RFKILL_EVENT_SIZE_V1	8 | 
|  | 96 |  | 
| Johannes Berg | c64fb01 | 2009-06-02 13:01:38 +0200 | [diff] [blame] | 97 | /* ioctl for turning off rfkill-input (if present) */ | 
|  | 98 | #define RFKILL_IOC_MAGIC	'R' | 
|  | 99 | #define RFKILL_IOC_NOINPUT	1 | 
|  | 100 | #define RFKILL_IOCTL_NOINPUT	_IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT) | 
|  | 101 |  | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 102 | /* and that's all userspace gets */ | 
|  | 103 | #ifdef __KERNEL__ | 
|  | 104 | /* don't allow anyone to use these in the kernel */ | 
|  | 105 | enum rfkill_user_states { | 
|  | 106 | RFKILL_USER_STATE_SOFT_BLOCKED	= RFKILL_STATE_SOFT_BLOCKED, | 
|  | 107 | RFKILL_USER_STATE_UNBLOCKED	= RFKILL_STATE_UNBLOCKED, | 
|  | 108 | RFKILL_USER_STATE_HARD_BLOCKED	= RFKILL_STATE_HARD_BLOCKED, | 
|  | 109 | }; | 
|  | 110 | #undef RFKILL_STATE_SOFT_BLOCKED | 
|  | 111 | #undef RFKILL_STATE_UNBLOCKED | 
|  | 112 | #undef RFKILL_STATE_HARD_BLOCKED | 
|  | 113 |  | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 114 | #include <linux/kernel.h> | 
|  | 115 | #include <linux/list.h> | 
|  | 116 | #include <linux/mutex.h> | 
|  | 117 | #include <linux/device.h> | 
| Michael Buesch | 135900c | 2007-09-27 21:33:12 +0200 | [diff] [blame] | 118 | #include <linux/leds.h> | 
| Johannes Berg | 1506e30 | 2009-06-09 17:49:06 -0700 | [diff] [blame] | 119 | #include <linux/err.h> | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 120 |  | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 121 | /* this is opaque */ | 
|  | 122 | struct rfkill; | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 123 |  | 
|  | 124 | /** | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 125 | * struct rfkill_ops - rfkill driver methods | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 126 | * | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 127 | * @poll: poll the rfkill block state(s) -- only assign this method | 
|  | 128 | *	when you need polling. When called, simply call one of the | 
|  | 129 | *	rfkill_set{,_hw,_sw}_state family of functions. If the hw | 
|  | 130 | *	is getting unblocked you need to take into account the return | 
|  | 131 | *	value of those functions to make sure the software block is | 
|  | 132 | *	properly used. | 
|  | 133 | * @query: query the rfkill block state(s) and call exactly one of the | 
|  | 134 | *	rfkill_set{,_hw,_sw}_state family of functions. Assign this | 
|  | 135 | *	method if input events can cause hardware state changes to make | 
|  | 136 | *	the rfkill core query your driver before setting a requested | 
|  | 137 | *	block. | 
|  | 138 | * @set_block: turn the transmitter on (blocked == false) or off | 
| Johannes Berg | c64fb01 | 2009-06-02 13:01:38 +0200 | [diff] [blame] | 139 | *	(blocked == true) -- ignore and return 0 when hard blocked. | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 140 | *	This callback must be assigned. | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 141 | */ | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 142 | struct rfkill_ops { | 
|  | 143 | void	(*poll)(struct rfkill *rfkill, void *data); | 
|  | 144 | void	(*query)(struct rfkill *rfkill, void *data); | 
|  | 145 | int	(*set_block)(void *data, bool blocked); | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 146 | }; | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 147 |  | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 148 | #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) | 
|  | 149 | /** | 
|  | 150 | * rfkill_alloc - allocate rfkill structure | 
|  | 151 | * @name: name of the struct -- the string is not copied internally | 
|  | 152 | * @parent: device that has rf switch on it | 
|  | 153 | * @type: type of the switch (RFKILL_TYPE_*) | 
|  | 154 | * @ops: rfkill methods | 
|  | 155 | * @ops_data: data passed to each method | 
|  | 156 | * | 
|  | 157 | * This function should be called by the transmitter driver to allocate an | 
|  | 158 | * rfkill structure. Returns %NULL on failure. | 
|  | 159 | */ | 
|  | 160 | struct rfkill * __must_check rfkill_alloc(const char *name, | 
|  | 161 | struct device *parent, | 
|  | 162 | const enum rfkill_type type, | 
|  | 163 | const struct rfkill_ops *ops, | 
|  | 164 | void *ops_data); | 
|  | 165 |  | 
|  | 166 | /** | 
|  | 167 | * rfkill_register - Register a rfkill structure. | 
|  | 168 | * @rfkill: rfkill structure to be registered | 
|  | 169 | * | 
|  | 170 | * This function should be called by the transmitter driver to register | 
| Alan Jenkins | b3fa132 | 2009-06-08 13:27:27 +0100 | [diff] [blame] | 171 | * the rfkill structure. Before calling this function the driver needs | 
|  | 172 | * to be ready to service method calls from rfkill. | 
|  | 173 | * | 
| Alan Jenkins | 06d5caf | 2009-06-16 15:39:51 +0100 | [diff] [blame] | 174 | * If rfkill_init_sw_state() is not called before registration, | 
|  | 175 | * set_block() will be called to initialize the software blocked state | 
|  | 176 | * to a default value. | 
| Alan Jenkins | b3fa132 | 2009-06-08 13:27:27 +0100 | [diff] [blame] | 177 | * | 
|  | 178 | * If the hardware blocked state is not set before registration, | 
|  | 179 | * it is assumed to be unblocked. | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 180 | */ | 
| Henrique de Moraes Holschuh | 77fba13 | 2008-08-02 15:10:59 -0300 | [diff] [blame] | 181 | int __must_check rfkill_register(struct rfkill *rfkill); | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 182 |  | 
|  | 183 | /** | 
|  | 184 | * rfkill_pause_polling(struct rfkill *rfkill) | 
|  | 185 | * | 
|  | 186 | * Pause polling -- say transmitter is off for other reasons. | 
|  | 187 | * NOTE: not necessary for suspend/resume -- in that case the | 
|  | 188 | * core stops polling anyway | 
|  | 189 | */ | 
|  | 190 | void rfkill_pause_polling(struct rfkill *rfkill); | 
|  | 191 |  | 
|  | 192 | /** | 
|  | 193 | * rfkill_resume_polling(struct rfkill *rfkill) | 
|  | 194 | * | 
|  | 195 | * Pause polling -- say transmitter is off for other reasons. | 
|  | 196 | * NOTE: not necessary for suspend/resume -- in that case the | 
|  | 197 | * core stops polling anyway | 
|  | 198 | */ | 
|  | 199 | void rfkill_resume_polling(struct rfkill *rfkill); | 
|  | 200 |  | 
|  | 201 |  | 
|  | 202 | /** | 
|  | 203 | * rfkill_unregister - Unregister a rfkill structure. | 
|  | 204 | * @rfkill: rfkill structure to be unregistered | 
|  | 205 | * | 
|  | 206 | * This function should be called by the network driver during device | 
|  | 207 | * teardown to destroy rfkill structure. Until it returns, the driver | 
|  | 208 | * needs to be able to service method calls. | 
|  | 209 | */ | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 210 | void rfkill_unregister(struct rfkill *rfkill); | 
|  | 211 |  | 
| Michael Buesch | 135900c | 2007-09-27 21:33:12 +0200 | [diff] [blame] | 212 | /** | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 213 | * rfkill_destroy - free rfkill structure | 
|  | 214 | * @rfkill: rfkill structure to be destroyed | 
| Henrique de Moraes Holschuh | 5005657c | 2008-06-23 17:46:42 -0300 | [diff] [blame] | 215 | * | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 216 | * Destroys the rfkill structure. | 
| Henrique de Moraes Holschuh | 5005657c | 2008-06-23 17:46:42 -0300 | [diff] [blame] | 217 | */ | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 218 | void rfkill_destroy(struct rfkill *rfkill); | 
| Henrique de Moraes Holschuh | 5005657c | 2008-06-23 17:46:42 -0300 | [diff] [blame] | 219 |  | 
|  | 220 | /** | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 221 | * rfkill_set_hw_state - Set the internal rfkill hardware block state | 
|  | 222 | * @rfkill: pointer to the rfkill class to modify. | 
|  | 223 | * @state: the current hardware block state to set | 
|  | 224 | * | 
|  | 225 | * rfkill drivers that get events when the hard-blocked state changes | 
|  | 226 | * use this function to notify the rfkill core (and through that also | 
| Alan Jenkins | 908209c | 2009-06-08 13:12:23 +0100 | [diff] [blame] | 227 | * userspace) of the current state.  They should also use this after | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 228 | * resume if the state could have changed. | 
|  | 229 | * | 
|  | 230 | * You need not (but may) call this function if poll_state is assigned. | 
|  | 231 | * | 
|  | 232 | * This function can be called in any context, even from within rfkill | 
|  | 233 | * callbacks. | 
|  | 234 | * | 
|  | 235 | * The function returns the combined block state (true if transmitter | 
|  | 236 | * should be blocked) so that drivers need not keep track of the soft | 
|  | 237 | * block state -- which they might not be able to. | 
| Michael Buesch | 135900c | 2007-09-27 21:33:12 +0200 | [diff] [blame] | 238 | */ | 
| Alan Jenkins | e56f097 | 2009-07-18 19:20:20 +0100 | [diff] [blame] | 239 | bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked); | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 240 |  | 
|  | 241 | /** | 
|  | 242 | * rfkill_set_sw_state - Set the internal rfkill software block state | 
|  | 243 | * @rfkill: pointer to the rfkill class to modify. | 
|  | 244 | * @state: the current software block state to set | 
|  | 245 | * | 
|  | 246 | * rfkill drivers that get events when the soft-blocked state changes | 
|  | 247 | * (yes, some platforms directly act on input but allow changing again) | 
|  | 248 | * use this function to notify the rfkill core (and through that also | 
| Alan Jenkins | 06d5caf | 2009-06-16 15:39:51 +0100 | [diff] [blame] | 249 | * userspace) of the current state. | 
|  | 250 | * | 
|  | 251 | * Drivers should also call this function after resume if the state has | 
|  | 252 | * been changed by the user.  This only makes sense for "persistent" | 
|  | 253 | * devices (see rfkill_init_sw_state()). | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 254 | * | 
|  | 255 | * This function can be called in any context, even from within rfkill | 
|  | 256 | * callbacks. | 
|  | 257 | * | 
|  | 258 | * The function returns the combined block state (true if transmitter | 
|  | 259 | * should be blocked). | 
|  | 260 | */ | 
|  | 261 | bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked); | 
|  | 262 |  | 
|  | 263 | /** | 
| Alan Jenkins | 06d5caf | 2009-06-16 15:39:51 +0100 | [diff] [blame] | 264 | * rfkill_init_sw_state - Initialize persistent software block state | 
|  | 265 | * @rfkill: pointer to the rfkill class to modify. | 
|  | 266 | * @state: the current software block state to set | 
|  | 267 | * | 
|  | 268 | * rfkill drivers that preserve their software block state over power off | 
|  | 269 | * use this function to notify the rfkill core (and through that also | 
|  | 270 | * userspace) of their initial state.  It should only be used before | 
|  | 271 | * registration. | 
|  | 272 | * | 
| Alan Jenkins | 464902e | 2009-06-16 14:54:04 +0100 | [diff] [blame] | 273 | * In addition, it marks the device as "persistent", an attribute which | 
|  | 274 | * can be read by userspace.  Persistent devices are expected to preserve | 
|  | 275 | * their own state when suspended. | 
| Alan Jenkins | 06d5caf | 2009-06-16 15:39:51 +0100 | [diff] [blame] | 276 | */ | 
|  | 277 | void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked); | 
|  | 278 |  | 
|  | 279 | /** | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 280 | * rfkill_set_states - Set the internal rfkill block states | 
|  | 281 | * @rfkill: pointer to the rfkill class to modify. | 
|  | 282 | * @sw: the current software block state to set | 
|  | 283 | * @hw: the current hardware block state to set | 
|  | 284 | * | 
|  | 285 | * This function can be called in any context, even from within rfkill | 
|  | 286 | * callbacks. | 
|  | 287 | */ | 
|  | 288 | void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw); | 
|  | 289 |  | 
|  | 290 | /** | 
| Johannes Berg | 6081162 | 2009-06-02 13:01:40 +0200 | [diff] [blame] | 291 | * rfkill_blocked - query rfkill block | 
|  | 292 | * | 
|  | 293 | * @rfkill: rfkill struct to query | 
|  | 294 | */ | 
|  | 295 | bool rfkill_blocked(struct rfkill *rfkill); | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 296 | #else /* !RFKILL */ | 
|  | 297 | static inline struct rfkill * __must_check | 
|  | 298 | rfkill_alloc(const char *name, | 
|  | 299 | struct device *parent, | 
|  | 300 | const enum rfkill_type type, | 
|  | 301 | const struct rfkill_ops *ops, | 
|  | 302 | void *ops_data) | 
| Michael Buesch | 135900c | 2007-09-27 21:33:12 +0200 | [diff] [blame] | 303 | { | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 304 | return ERR_PTR(-ENODEV); | 
| Michael Buesch | 135900c | 2007-09-27 21:33:12 +0200 | [diff] [blame] | 305 | } | 
|  | 306 |  | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 307 | static inline int __must_check rfkill_register(struct rfkill *rfkill) | 
|  | 308 | { | 
|  | 309 | if (rfkill == ERR_PTR(-ENODEV)) | 
|  | 310 | return 0; | 
|  | 311 | return -EINVAL; | 
|  | 312 | } | 
|  | 313 |  | 
|  | 314 | static inline void rfkill_pause_polling(struct rfkill *rfkill) | 
|  | 315 | { | 
|  | 316 | } | 
|  | 317 |  | 
|  | 318 | static inline void rfkill_resume_polling(struct rfkill *rfkill) | 
|  | 319 | { | 
|  | 320 | } | 
|  | 321 |  | 
|  | 322 | static inline void rfkill_unregister(struct rfkill *rfkill) | 
|  | 323 | { | 
|  | 324 | } | 
|  | 325 |  | 
|  | 326 | static inline void rfkill_destroy(struct rfkill *rfkill) | 
|  | 327 | { | 
|  | 328 | } | 
|  | 329 |  | 
|  | 330 | static inline bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked) | 
|  | 331 | { | 
|  | 332 | return blocked; | 
|  | 333 | } | 
|  | 334 |  | 
|  | 335 | static inline bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked) | 
|  | 336 | { | 
|  | 337 | return blocked; | 
|  | 338 | } | 
|  | 339 |  | 
| Alan Jenkins | 06d5caf | 2009-06-16 15:39:51 +0100 | [diff] [blame] | 340 | static inline void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked) | 
|  | 341 | { | 
|  | 342 | } | 
|  | 343 |  | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 344 | static inline void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw) | 
|  | 345 | { | 
|  | 346 | } | 
|  | 347 |  | 
| Johannes Berg | 6081162 | 2009-06-02 13:01:40 +0200 | [diff] [blame] | 348 | static inline bool rfkill_blocked(struct rfkill *rfkill) | 
|  | 349 | { | 
|  | 350 | return false; | 
|  | 351 | } | 
| Johannes Berg | 19d337d | 2009-06-02 13:01:37 +0200 | [diff] [blame] | 352 | #endif /* RFKILL || RFKILL_MODULE */ | 
|  | 353 |  | 
|  | 354 |  | 
|  | 355 | #ifdef CONFIG_RFKILL_LEDS | 
|  | 356 | /** | 
|  | 357 | * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED. | 
|  | 358 | * This function might return a NULL pointer if registering of the | 
|  | 359 | * LED trigger failed. Use this as "default_trigger" for the LED. | 
|  | 360 | */ | 
|  | 361 | const char *rfkill_get_led_trigger_name(struct rfkill *rfkill); | 
|  | 362 |  | 
|  | 363 | /** | 
|  | 364 | * rfkill_set_led_trigger_name -- set the LED trigger name | 
|  | 365 | * @rfkill: rfkill struct | 
|  | 366 | * @name: LED trigger name | 
|  | 367 | * | 
|  | 368 | * This function sets the LED trigger name of the radio LED | 
|  | 369 | * trigger that rfkill creates. It is optional, but if called | 
|  | 370 | * must be called before rfkill_register() to be effective. | 
|  | 371 | */ | 
|  | 372 | void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name); | 
|  | 373 | #else | 
|  | 374 | static inline const char *rfkill_get_led_trigger_name(struct rfkill *rfkill) | 
|  | 375 | { | 
|  | 376 | return NULL; | 
|  | 377 | } | 
|  | 378 |  | 
|  | 379 | static inline void | 
|  | 380 | rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name) | 
|  | 381 | { | 
|  | 382 | } | 
|  | 383 | #endif | 
|  | 384 |  | 
|  | 385 | #endif /* __KERNEL__ */ | 
|  | 386 |  | 
| Ivo van Doorn | cf4328c | 2007-05-07 00:34:20 -0700 | [diff] [blame] | 387 | #endif /* RFKILL_H */ |