]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rfkill: Correct parameter type for rfkill_set_hw_state_reason()
authorZijun Hu <quic_zijuhu@quicinc.com>
Sun, 11 Aug 2024 04:47:26 +0000 (12:47 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 27 Aug 2024 08:28:55 +0000 (10:28 +0200)
Change type of parameter @reason to enum rfkill_hard_block_reasons
for API rfkill_set_hw_state_reason() according to its comments, and
all kernel callers have invoked the API with enum type actually.

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://patch.msgid.link/20240811-rfkill_fix-v2-1-9050760336f4@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/linux/rfkill.h
net/rfkill/core.c

index 373003ace639fbccb6b1f1b94cf1ad8393f768cd..997b34197385997db1fac4c10148940dcc85978e 100644 (file)
@@ -147,7 +147,8 @@ void rfkill_destroy(struct rfkill *rfkill);
  * 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);
+                               bool blocked,
+                               enum rfkill_hard_block_reasons reason);
 /**
  * rfkill_set_hw_state - Set the internal rfkill hardware block state
  * @rfkill: pointer to the rfkill class to modify.
@@ -280,7 +281,7 @@ static inline void rfkill_destroy(struct rfkill *rfkill)
 
 static inline bool rfkill_set_hw_state_reason(struct rfkill *rfkill,
                                              bool blocked,
-                                             unsigned long reason)
+                                             enum rfkill_hard_block_reasons reason)
 {
        return blocked;
 }
index 7a5367628c05b9ef8f87d0d81c7cb1d39e053878..13a5126bc36ed2ff6f56981b7dc6fcf1c368b40d 100644 (file)
@@ -539,18 +539,14 @@ 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)
+                               bool blocked,
+                               enum rfkill_hard_block_reasons reason)
 {
        unsigned long flags;
        bool ret, prev;
 
        BUG_ON(!rfkill);
 
-       if (WARN(reason & ~(RFKILL_HARD_BLOCK_SIGNAL |
-                           RFKILL_HARD_BLOCK_NOT_OWNER),
-                "hw_state reason not supported: 0x%lx", reason))
-               return rfkill_blocked(rfkill);
-
        spin_lock_irqsave(&rfkill->lock, flags);
        prev = !!(rfkill->hard_block_reasons & reason);
        if (blocked) {