Re: backports spatch question

Ben Greear <[email protected]>
Newsgroups org.kernel.vger.backports
Organization Candela Technologies
Message-ID <[email protected]>
On 7/5/21 12:14 PM, Johannes Berg wrote:
> On Mon, 2021-07-05 at 12:10 -0700, Ben Greear wrote:
>> On 7/5/21 10:55 AM, Johannes Berg wrote:
>>> On Mon, 2021-07-05 at 10:47 -0700, Ben Greear wrote:
>>>> On 7/1/21 2:51 PM, Johannes Berg wrote:
>>>>> On Thu, 2021-07-01 at 14:40 -0700, Ben Greear wrote:
>>>>>>
>>>>>> [greearb@v-f34-64 backports]$ spatch --version
>>>>>> spatch version 1.0.8-gf4ba8df-dirty compiled with OCaml version 4.11.1
>>>>>
>>>>>
>>>>> I just realized I never even tried on my system recently, I'm still on
>>>>> F33 and have
>>>>>
>>>>> spatch version 1.0.8-gc1dbb4f-dirty compiled with OCaml version 4.11.1
>>>>>
>>>>> Could you try some other version? Backports says it needs "at least"
>>>>> 1.0.7 but perhaps only exactly that works?
>>>>>
>>>>> johannes
>>>>>
>>>>
>>>> I hacked through this by removing the offending spatches.  Seems to have worked OK
>>>> since the kernels I am using are relatively recent.
>>>>
>>>> I spent a while getting the mac80211 patches from owrt tweaked or otherwise
>>>> resolved so that it would patch against my backports tree.
>>>>
>>>> But now I'm having trouble with rfkill and not sure best way forward.  Is backports
>>>> supposed to take care of this somehow, or do I need to go hacking in openwrt?
>>>
>>> You need this bit in backport-include/linux/rfkill.h, not sure why it's
>>> not there yet:
>>>
>>> #if LINUX_VERSION_IS_LESS(5,11,0)
>>>
>>> /* This should come from uapi/linux/rfkill.h, but it was much easier
>>>    * to do it this way.
>>>    */
>>> enum rfkill_hard_block_reasons {
>>>           RFKILL_HARD_BLOCK_SIGNAL        = 1 << 0,
>>>           RFKILL_HARD_BLOCK_NOT_OWNER     = 1 << 1,
>>> };
>>>
>>> static inline bool rfkill_set_hw_state_reason(struct rfkill *rfkill,
>>>                                                 bool blocked, unsigned
>>> long reason)
>>> {
>>>           return rfkill_set_hw_state(rfkill, blocked);
>>> }
>>>
>>> #endif /* 5.11 */
>>>
>>>
>>> johannes
>>>
>>
>> I added that patch to the bottom of the file, just above the final #endif
> 
> Well I guess it needs to be at the beginning in the first existing ifdef
> block.
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi.git/tree/backport-include/linux/rfkill.h
> 
> johannes
> 

Did you test it?  Because that should be logically identical to what I tried if I read this file properly:

[greearb@v-f34-64 backports]$ git show
commit d3480ef5f9024dfe712700832473c90c577d8ca5 (HEAD -> master)
Author: Ben Greear <[email protected]>
Date:   Mon Jul 5 11:12:14 2021 -0700

     Fix rfkill for earlier than 5.11 kernels

     From Johannes Berg <[email protected]>

     Signed-off-by: Ben Greear <[email protected]>

diff --git a/backport/backport-include/linux/rfkill.h b/backport/backport-include/linux/rfkill.h
index 99015af7..c4aa2bd2 100644
--- a/backport/backport-include/linux/rfkill.h
+++ b/backport/backport-include/linux/rfkill.h
@@ -164,4 +164,23 @@ static inline bool backport_rfkill_blocked(struct rfkill *rfkill)
  #define rfkill_blocked backport_rfkill_blocked
  #endif

+#if LINUX_VERSION_IS_LESS(5,11,0)
+
+/* This should come from uapi/linux/rfkill.h, but it was much easier
+ * to do it this way.
+ */
+enum rfkill_hard_block_reasons {
+        RFKILL_HARD_BLOCK_SIGNAL        = 1 << 0,
+        RFKILL_HARD_BLOCK_NOT_OWNER     = 1 << 1,
+};
+
+static inline bool rfkill_set_hw_state_reason(struct rfkill *rfkill,
+                                              bool blocked, unsigned
+long reason)
+{
+        return rfkill_set_hw_state(rfkill, blocked);
+}
+
+#endif /* 5.11 */
+
  #endif


-- 
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com

--
To unsubscribe from this list: send the line "unsubscribe backports" in
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.