2007-05-07 15:34:20 +08:00
|
|
|
/*
|
2007-09-28 05:57:05 +08:00
|
|
|
* Copyright (C) 2006 - 2007 Ivo van Doorn
|
2007-05-07 15:34:20 +08:00
|
|
|
* Copyright (C) 2007 Dmitry Torokhov
|
2009-06-02 19:01:37 +08:00
|
|
|
* Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
|
2007-05-07 15:34:20 +08:00
|
|
|
*
|
2009-08-27 00:13:17 +08:00
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
2007-05-07 15:34:20 +08:00
|
|
|
*
|
2009-08-27 00:13:17 +08:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2007-05-07 15:34:20 +08:00
|
|
|
*/
|
2012-10-13 17:46:48 +08:00
|
|
|
#ifndef __RFKILL_H
|
|
|
|
#define __RFKILL_H
|
2007-05-07 15:34:20 +08:00
|
|
|
|
2012-10-13 17:46:48 +08:00
|
|
|
#include <uapi/linux/rfkill.h>
|
2009-06-02 19:01:38 +08:00
|
|
|
|
|
|
|
/* don't allow anyone to use these in the kernel */
|
|
|
|
enum rfkill_user_states {
|
|
|
|
RFKILL_USER_STATE_SOFT_BLOCKED = RFKILL_STATE_SOFT_BLOCKED,
|
|
|
|
RFKILL_USER_STATE_UNBLOCKED = RFKILL_STATE_UNBLOCKED,
|
|
|
|
RFKILL_USER_STATE_HARD_BLOCKED = RFKILL_STATE_HARD_BLOCKED,
|
|
|
|
};
|
|
|
|
#undef RFKILL_STATE_SOFT_BLOCKED
|
|
|
|
#undef RFKILL_STATE_UNBLOCKED
|
|
|
|
#undef RFKILL_STATE_HARD_BLOCKED
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
#include <linux/leds.h>
|
2009-06-10 08:49:06 +08:00
|
|
|
#include <linux/err.h>
|
2009-06-02 19:01:38 +08:00
|
|
|
|
2012-01-31 00:46:54 +08:00
|
|
|
struct device;
|
2009-06-02 19:01:37 +08:00
|
|
|
/* this is opaque */
|
|
|
|
struct rfkill;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct rfkill_ops - rfkill driver methods
|
|
|
|
*
|
|
|
|
* @poll: poll the rfkill block state(s) -- only assign this method
|
|
|
|
* when you need polling. When called, simply call one of the
|
|
|
|
* rfkill_set{,_hw,_sw}_state family of functions. If the hw
|
|
|
|
* is getting unblocked you need to take into account the return
|
|
|
|
* value of those functions to make sure the software block is
|
|
|
|
* properly used.
|
|
|
|
* @query: query the rfkill block state(s) and call exactly one of the
|
|
|
|
* rfkill_set{,_hw,_sw}_state family of functions. Assign this
|
|
|
|
* method if input events can cause hardware state changes to make
|
|
|
|
* the rfkill core query your driver before setting a requested
|
|
|
|
* block.
|
|
|
|
* @set_block: turn the transmitter on (blocked == false) or off
|
2009-06-02 19:01:38 +08:00
|
|
|
* (blocked == true) -- ignore and return 0 when hard blocked.
|
2009-06-02 19:01:37 +08:00
|
|
|
* This callback must be assigned.
|
|
|
|
*/
|
|
|
|
struct rfkill_ops {
|
|
|
|
void (*poll)(struct rfkill *rfkill, void *data);
|
|
|
|
void (*query)(struct rfkill *rfkill, void *data);
|
|
|
|
int (*set_block)(void *data, bool blocked);
|
2007-05-07 15:34:20 +08:00
|
|
|
};
|
|
|
|
|
2009-06-02 19:01:37 +08:00
|
|
|
#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
|
2007-05-07 15:34:20 +08:00
|
|
|
/**
|
2018-06-05 05:34:06 +08:00
|
|
|
* rfkill_alloc - Allocate rfkill structure
|
2009-06-02 19:01:37 +08:00
|
|
|
* @name: name of the struct -- the string is not copied internally
|
|
|
|
* @parent: device that has rf switch on it
|
|
|
|
* @type: type of the switch (RFKILL_TYPE_*)
|
|
|
|
* @ops: rfkill methods
|
|
|
|
* @ops_data: data passed to each method
|
|
|
|
*
|
|
|
|
* This function should be called by the transmitter driver to allocate an
|
|
|
|
* rfkill structure. Returns %NULL on failure.
|
2007-05-07 15:34:20 +08:00
|
|
|
*/
|
2009-06-02 19:01:37 +08:00
|
|
|
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);
|
2007-05-07 15:34:20 +08:00
|
|
|
|
2009-06-02 19:01:37 +08:00
|
|
|
/**
|
|
|
|
* rfkill_register - Register a rfkill structure.
|
|
|
|
* @rfkill: rfkill structure to be registered
|
|
|
|
*
|
|
|
|
* This function should be called by the transmitter driver to register
|
2009-06-08 20:27:27 +08:00
|
|
|
* the rfkill structure. Before calling this function the driver needs
|
|
|
|
* to be ready to service method calls from rfkill.
|
|
|
|
*
|
2009-06-16 22:39:51 +08:00
|
|
|
* If rfkill_init_sw_state() is not called before registration,
|
|
|
|
* set_block() will be called to initialize the software blocked state
|
|
|
|
* to a default value.
|
2009-06-08 20:27:27 +08:00
|
|
|
*
|
|
|
|
* If the hardware blocked state is not set before registration,
|
|
|
|
* it is assumed to be unblocked.
|
2009-06-02 19:01:37 +08:00
|
|
|
*/
|
|
|
|
int __must_check rfkill_register(struct rfkill *rfkill);
|
2007-09-28 03:33:12 +08:00
|
|
|
|
2009-06-02 19:01:37 +08:00
|
|
|
/**
|
|
|
|
* rfkill_pause_polling(struct rfkill *rfkill)
|
|
|
|
*
|
|
|
|
* Pause polling -- say transmitter is off for other reasons.
|
|
|
|
* NOTE: not necessary for suspend/resume -- in that case the
|
2016-01-20 17:39:23 +08:00
|
|
|
* core stops polling anyway (but will also correctly handle
|
|
|
|
* the case of polling having been paused before suspend.)
|
2009-06-02 19:01:37 +08:00
|
|
|
*/
|
|
|
|
void rfkill_pause_polling(struct rfkill *rfkill);
|
2007-05-07 15:34:20 +08:00
|
|
|
|
2009-06-02 19:01:37 +08:00
|
|
|
/**
|
|
|
|
* rfkill_resume_polling(struct rfkill *rfkill)
|
|
|
|
*
|
2018-06-05 05:34:06 +08:00
|
|
|
* Resume polling
|
2009-06-02 19:01:37 +08:00
|
|
|
* NOTE: not necessary for suspend/resume -- in that case the
|
|
|
|
* core stops polling anyway
|
|
|
|
*/
|
|
|
|
void rfkill_resume_polling(struct rfkill *rfkill);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* rfkill_unregister - Unregister a rfkill structure.
|
|
|
|
* @rfkill: rfkill structure to be unregistered
|
|
|
|
*
|
|
|
|
* This function should be called by the network driver during device
|
|
|
|
* teardown to destroy rfkill structure. Until it returns, the driver
|
|
|
|
* needs to be able to service method calls.
|
|
|
|
*/
|
2007-05-07 15:34:20 +08:00
|
|
|
void rfkill_unregister(struct rfkill *rfkill);
|
|
|
|
|
2009-06-02 19:01:37 +08:00
|
|
|
/**
|
2018-06-05 05:34:06 +08:00
|
|
|
* rfkill_destroy - Free rfkill structure
|
2009-06-02 19:01:37 +08:00
|
|
|
* @rfkill: rfkill structure to be destroyed
|
|
|
|
*
|
|
|
|
* Destroys the rfkill structure.
|
|
|
|
*/
|
|
|
|
void rfkill_destroy(struct rfkill *rfkill);
|
|
|
|
|
rfkill: add a reason to the HW rfkill state
The WLAN device may exist yet not be usable. This can happen
when the WLAN device is controllable by both the host and
some platform internal component.
We need some arbritration that is vendor specific, but when
the device is not available for the host, we need to reflect
this state towards the user space.
Add a reason field to the rfkill object (and event) so that
userspace can know why the device is in rfkill: because some
other platform component currently owns the device, or
because the actual hw rfkill signal is asserted.
Capable userspace can now determine the reason for the rfkill
and possibly do some negotiation on a side band channel using
a proprietary protocol to gain ownership on the device in case
the device is owned by some other component. When the host
gains ownership on the device, the kernel can remove the
RFKILL_HARD_BLOCK_NOT_OWNER reason and the hw rfkill state
will be off. Then, the userspace can bring the device up and
start normal operation.
The rfkill_event structure is enlarged to include the additional
byte, it is now 9 bytes long. Old user space will ask to read
only 8 bytes so that the kernel can know not to feed them with
more data. When the user space writes 8 bytes, new kernels will
just read what is present in the file descriptor. This new byte
is read only from the userspace standpoint anyway.
If a new user space uses an old kernel, it'll ask to read 9 bytes
but will get only 8, and it'll know that it didn't get the new
state. When it'll write 9 bytes, the kernel will again ignore
this new byte which is read only from the userspace standpoint.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://lore.kernel.org/r/20201104134641.28816-1-emmanuel.grumbach@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-11-04 21:46:41 +08:00
|
|
|
/**
|
|
|
|
* rfkill_set_hw_state_reason - Set the internal rfkill hardware block state
|
|
|
|
* with a reason
|
|
|
|
* @rfkill: pointer to the rfkill class to modify.
|
|
|
|
* @blocked: the current hardware block state to set
|
|
|
|
* @reason: one of &enum rfkill_hard_block_reasons
|
|
|
|
*
|
|
|
|
* Prefer to use rfkill_set_hw_state if you don't need any special reason.
|
|
|
|
*/
|
|
|
|
bool rfkill_set_hw_state_reason(struct rfkill *rfkill,
|
|
|
|
bool blocked, unsigned long reason);
|
2009-06-02 19:01:37 +08:00
|
|
|
/**
|
|
|
|
* rfkill_set_hw_state - Set the internal rfkill hardware block state
|
|
|
|
* @rfkill: pointer to the rfkill class to modify.
|
2018-06-05 05:34:06 +08:00
|
|
|
* @blocked: the current hardware block state to set
|
2009-06-02 19:01:37 +08:00
|
|
|
*
|
|
|
|
* rfkill drivers that get events when the hard-blocked state changes
|
|
|
|
* use this function to notify the rfkill core (and through that also
|
2009-06-08 20:12:23 +08:00
|
|
|
* userspace) of the current state. They should also use this after
|
2009-06-02 19:01:37 +08:00
|
|
|
* resume if the state could have changed.
|
|
|
|
*
|
|
|
|
* You need not (but may) call this function if poll_state is assigned.
|
|
|
|
*
|
|
|
|
* This function can be called in any context, even from within rfkill
|
|
|
|
* callbacks.
|
|
|
|
*
|
|
|
|
* The function returns the combined block state (true if transmitter
|
|
|
|
* should be blocked) so that drivers need not keep track of the soft
|
|
|
|
* block state -- which they might not be able to.
|
|
|
|
*/
|
rfkill: add a reason to the HW rfkill state
The WLAN device may exist yet not be usable. This can happen
when the WLAN device is controllable by both the host and
some platform internal component.
We need some arbritration that is vendor specific, but when
the device is not available for the host, we need to reflect
this state towards the user space.
Add a reason field to the rfkill object (and event) so that
userspace can know why the device is in rfkill: because some
other platform component currently owns the device, or
because the actual hw rfkill signal is asserted.
Capable userspace can now determine the reason for the rfkill
and possibly do some negotiation on a side band channel using
a proprietary protocol to gain ownership on the device in case
the device is owned by some other component. When the host
gains ownership on the device, the kernel can remove the
RFKILL_HARD_BLOCK_NOT_OWNER reason and the hw rfkill state
will be off. Then, the userspace can bring the device up and
start normal operation.
The rfkill_event structure is enlarged to include the additional
byte, it is now 9 bytes long. Old user space will ask to read
only 8 bytes so that the kernel can know not to feed them with
more data. When the user space writes 8 bytes, new kernels will
just read what is present in the file descriptor. This new byte
is read only from the userspace standpoint anyway.
If a new user space uses an old kernel, it'll ask to read 9 bytes
but will get only 8, and it'll know that it didn't get the new
state. When it'll write 9 bytes, the kernel will again ignore
this new byte which is read only from the userspace standpoint.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://lore.kernel.org/r/20201104134641.28816-1-emmanuel.grumbach@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-11-04 21:46:41 +08:00
|
|
|
static inline bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked)
|
|
|
|
{
|
|
|
|
return rfkill_set_hw_state_reason(rfkill, blocked,
|
|
|
|
RFKILL_HARD_BLOCK_SIGNAL);
|
|
|
|
}
|
2009-06-02 19:01:37 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* rfkill_set_sw_state - Set the internal rfkill software block state
|
|
|
|
* @rfkill: pointer to the rfkill class to modify.
|
2018-06-05 05:34:06 +08:00
|
|
|
* @blocked: the current software block state to set
|
2009-06-02 19:01:37 +08:00
|
|
|
*
|
|
|
|
* rfkill drivers that get events when the soft-blocked state changes
|
|
|
|
* (yes, some platforms directly act on input but allow changing again)
|
|
|
|
* use this function to notify the rfkill core (and through that also
|
2009-06-16 22:39:51 +08:00
|
|
|
* userspace) of the current state.
|
|
|
|
*
|
|
|
|
* Drivers should also call this function after resume if the state has
|
|
|
|
* been changed by the user. This only makes sense for "persistent"
|
|
|
|
* devices (see rfkill_init_sw_state()).
|
2009-06-02 19:01:37 +08:00
|
|
|
*
|
|
|
|
* This function can be called in any context, even from within rfkill
|
|
|
|
* callbacks.
|
|
|
|
*
|
|
|
|
* The function returns the combined block state (true if transmitter
|
|
|
|
* should be blocked).
|
|
|
|
*/
|
|
|
|
bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked);
|
|
|
|
|
2009-06-16 22:39:51 +08:00
|
|
|
/**
|
|
|
|
* rfkill_init_sw_state - Initialize persistent software block state
|
|
|
|
* @rfkill: pointer to the rfkill class to modify.
|
2018-06-05 05:34:06 +08:00
|
|
|
* @blocked: the current software block state to set
|
2009-06-16 22:39:51 +08:00
|
|
|
*
|
|
|
|
* rfkill drivers that preserve their software block state over power off
|
|
|
|
* use this function to notify the rfkill core (and through that also
|
|
|
|
* userspace) of their initial state. It should only be used before
|
|
|
|
* registration.
|
|
|
|
*
|
2009-06-16 21:54:04 +08:00
|
|
|
* In addition, it marks the device as "persistent", an attribute which
|
|
|
|
* can be read by userspace. Persistent devices are expected to preserve
|
|
|
|
* their own state when suspended.
|
2009-06-16 22:39:51 +08:00
|
|
|
*/
|
|
|
|
void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked);
|
|
|
|
|
2009-06-02 19:01:37 +08:00
|
|
|
/**
|
|
|
|
* rfkill_set_states - Set the internal rfkill block states
|
|
|
|
* @rfkill: pointer to the rfkill class to modify.
|
|
|
|
* @sw: the current software block state to set
|
|
|
|
* @hw: the current hardware block state to set
|
|
|
|
*
|
|
|
|
* This function can be called in any context, even from within rfkill
|
|
|
|
* callbacks.
|
|
|
|
*/
|
|
|
|
void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw);
|
2008-06-24 04:23:00 +08:00
|
|
|
|
2009-06-02 19:01:40 +08:00
|
|
|
/**
|
2018-06-05 05:34:06 +08:00
|
|
|
* rfkill_blocked - Query rfkill block state
|
2009-06-02 19:01:40 +08:00
|
|
|
*
|
|
|
|
* @rfkill: rfkill struct to query
|
|
|
|
*/
|
|
|
|
bool rfkill_blocked(struct rfkill *rfkill);
|
2016-01-25 17:03:46 +08:00
|
|
|
|
2021-12-20 03:51:24 +08:00
|
|
|
/**
|
|
|
|
* rfkill_soft_blocked - Query soft rfkill block state
|
|
|
|
*
|
|
|
|
* @rfkill: rfkill struct to query
|
|
|
|
*/
|
|
|
|
bool rfkill_soft_blocked(struct rfkill *rfkill);
|
|
|
|
|
2016-01-25 17:03:46 +08:00
|
|
|
/**
|
2018-06-05 05:34:06 +08:00
|
|
|
* rfkill_find_type - Helper for finding rfkill type by name
|
2016-01-25 17:03:46 +08:00
|
|
|
* @name: the name of the type
|
|
|
|
*
|
2018-06-05 05:34:06 +08:00
|
|
|
* Returns enum rfkill_type that corresponds to the name.
|
2016-01-25 17:03:46 +08:00
|
|
|
*/
|
|
|
|
enum rfkill_type rfkill_find_type(const char *name);
|
|
|
|
|
2009-06-02 19:01:37 +08:00
|
|
|
#else /* !RFKILL */
|
|
|
|
static inline 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)
|
|
|
|
{
|
|
|
|
return ERR_PTR(-ENODEV);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int __must_check rfkill_register(struct rfkill *rfkill)
|
|
|
|
{
|
|
|
|
if (rfkill == ERR_PTR(-ENODEV))
|
|
|
|
return 0;
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rfkill_pause_polling(struct rfkill *rfkill)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rfkill_resume_polling(struct rfkill *rfkill)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rfkill_unregister(struct rfkill *rfkill)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rfkill_destroy(struct rfkill *rfkill)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
rfkill: add a reason to the HW rfkill state
The WLAN device may exist yet not be usable. This can happen
when the WLAN device is controllable by both the host and
some platform internal component.
We need some arbritration that is vendor specific, but when
the device is not available for the host, we need to reflect
this state towards the user space.
Add a reason field to the rfkill object (and event) so that
userspace can know why the device is in rfkill: because some
other platform component currently owns the device, or
because the actual hw rfkill signal is asserted.
Capable userspace can now determine the reason for the rfkill
and possibly do some negotiation on a side band channel using
a proprietary protocol to gain ownership on the device in case
the device is owned by some other component. When the host
gains ownership on the device, the kernel can remove the
RFKILL_HARD_BLOCK_NOT_OWNER reason and the hw rfkill state
will be off. Then, the userspace can bring the device up and
start normal operation.
The rfkill_event structure is enlarged to include the additional
byte, it is now 9 bytes long. Old user space will ask to read
only 8 bytes so that the kernel can know not to feed them with
more data. When the user space writes 8 bytes, new kernels will
just read what is present in the file descriptor. This new byte
is read only from the userspace standpoint anyway.
If a new user space uses an old kernel, it'll ask to read 9 bytes
but will get only 8, and it'll know that it didn't get the new
state. When it'll write 9 bytes, the kernel will again ignore
this new byte which is read only from the userspace standpoint.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://lore.kernel.org/r/20201104134641.28816-1-emmanuel.grumbach@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2020-11-04 21:46:41 +08:00
|
|
|
static inline bool rfkill_set_hw_state_reason(struct rfkill *rfkill,
|
|
|
|
bool blocked,
|
|
|
|
unsigned long reason)
|
|
|
|
{
|
|
|
|
return blocked;
|
|
|
|
}
|
|
|
|
|
2009-06-02 19:01:37 +08:00
|
|
|
static inline bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked)
|
|
|
|
{
|
|
|
|
return blocked;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked)
|
|
|
|
{
|
|
|
|
return blocked;
|
|
|
|
}
|
|
|
|
|
2009-06-16 22:39:51 +08:00
|
|
|
static inline void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-06-02 19:01:37 +08:00
|
|
|
static inline void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-06-02 19:01:40 +08:00
|
|
|
static inline bool rfkill_blocked(struct rfkill *rfkill)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2016-01-25 17:03:46 +08:00
|
|
|
|
2022-02-18 17:38:58 +08:00
|
|
|
static inline bool rfkill_soft_blocked(struct rfkill *rfkill)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-25 17:03:46 +08:00
|
|
|
static inline enum rfkill_type rfkill_find_type(const char *name)
|
|
|
|
{
|
|
|
|
return RFKILL_TYPE_ALL;
|
|
|
|
}
|
|
|
|
|
2009-06-02 19:01:37 +08:00
|
|
|
#endif /* RFKILL || RFKILL_MODULE */
|
|
|
|
|
2012-07-26 09:51:08 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_RFKILL_LEDS
|
|
|
|
/**
|
|
|
|
* rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED.
|
|
|
|
* This function might return a NULL pointer if registering of the
|
|
|
|
* LED trigger failed. Use this as "default_trigger" for the LED.
|
|
|
|
*/
|
|
|
|
const char *rfkill_get_led_trigger_name(struct rfkill *rfkill);
|
|
|
|
|
|
|
|
/**
|
2018-06-05 05:34:06 +08:00
|
|
|
* rfkill_set_led_trigger_name - Set the LED trigger name
|
2012-07-26 09:51:08 +08:00
|
|
|
* @rfkill: rfkill struct
|
|
|
|
* @name: LED trigger name
|
|
|
|
*
|
|
|
|
* This function sets the LED trigger name of the radio LED
|
|
|
|
* trigger that rfkill creates. It is optional, but if called
|
|
|
|
* must be called before rfkill_register() to be effective.
|
|
|
|
*/
|
|
|
|
void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name);
|
|
|
|
#else
|
|
|
|
static inline const char *rfkill_get_led_trigger_name(struct rfkill *rfkill)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-05-07 15:34:20 +08:00
|
|
|
#endif /* RFKILL_H */
|