net: rfkill: add rfkill_find_type function
Helper for finding the type based on name. Useful if the type needs to be determined based on device property. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> [modify rfkill_types array and BUILD_BUG_ON to not cause errors] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:

committed by
Johannes Berg

parent
7837a77782
commit
648b50dd6a
@@ -213,6 +213,15 @@ void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw);
|
||||
* @rfkill: rfkill struct to query
|
||||
*/
|
||||
bool rfkill_blocked(struct rfkill *rfkill);
|
||||
|
||||
/**
|
||||
* rfkill_find_type - Helpper for finding rfkill type by name
|
||||
* @name: the name of the type
|
||||
*
|
||||
* Returns enum rfkill_type that conrresponds the name.
|
||||
*/
|
||||
enum rfkill_type rfkill_find_type(const char *name);
|
||||
|
||||
#else /* !RFKILL */
|
||||
static inline struct rfkill * __must_check
|
||||
rfkill_alloc(const char *name,
|
||||
@@ -269,6 +278,12 @@ static inline bool rfkill_blocked(struct rfkill *rfkill)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline enum rfkill_type rfkill_find_type(const char *name)
|
||||
{
|
||||
return RFKILL_TYPE_ALL;
|
||||
}
|
||||
|
||||
#endif /* RFKILL || RFKILL_MODULE */
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user