mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zijun Hu <zijun_hu@icloud.com>
To: Jeff Johnson <quic_jjohnson@quicinc.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, Zijun Hu <quic_zijuhu@quicinc.com>
Subject: Re: [PATCH] wifi: rfkill: Correct parameter type for rfkill_set_hw_state_reason()
Date: Sat, 27 Jul 2024 08:23:35 +0800	[thread overview]
Message-ID: <d1267639-c885-4a27-ac15-b4199e38ec99@icloud.com> (raw)
In-Reply-To: <dcd0d83a-af37-4ef5-8351-a435ab115ed0@quicinc.com>

On 2024/7/27 06:51, Jeff Johnson wrote:
> On 7/15/2024 6:39 AM, Zijun Hu wrote:
>> From: Zijun Hu <quic_zijuhu@quicinc.com>
>>
>> Change type of parameter @reason to enum rfkill_hard_block_reasons for
>> API rfkill_set_hw_state_reason() according to its comments.
>>
>> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
>> ---
>>  include/linux/rfkill.h | 5 ++---
>>  net/rfkill/core.c      | 7 +------
>>  2 files changed, 3 insertions(+), 9 deletions(-)
>>
>> diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
>> index 373003ace639..4f7558267541 100644
>> --- a/include/linux/rfkill.h
>> +++ b/include/linux/rfkill.h
>> @@ -147,7 +147,7 @@ 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);
> 
> function parameters should align on (
> 
will correct it for v2
>>  /**
>>   * rfkill_set_hw_state - Set the internal rfkill hardware block state
>>   * @rfkill: pointer to the rfkill class to modify.
>> @@ -279,8 +279,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)
>> +		bool blocked, enum rfkill_hard_block_reasons reason)
> 
> function parameters should align on (
> 

will correct it for v2
>>  {
>>  	return blocked;
>>  }
>> diff --git a/net/rfkill/core.c b/net/rfkill/core.c
>> index 7a5367628c05..f8ed6431b2f5 100644
>> --- a/net/rfkill/core.c
>> +++ b/net/rfkill/core.c
>> @@ -539,18 +539,13 @@ 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)
> 
> function parameters should align on (
> 
will correct it for v2
>>  {
>>  	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);
>> -
> 
> did you validate that all callers are actually passing a valid enum?
> that is something you should describe in your commit since this is a change
> beyond just changing the prototype
> 
yes. actually, ALL callers within kernel tree only use enum for the API.
will add that description within v2.
thanks
>>  	spin_lock_irqsave(&rfkill->lock, flags);
>>  	prev = !!(rfkill->hard_block_reasons & reason);
>>  	if (blocked) {
>>
>> ---
>> base-commit: 338a93cf4a18c2036b567e9f613367f7a52f2511
>> change-id: 20240715-rfkill_fix-335afa2e88ca
>>
>> Best regards,
> 


      reply	other threads:[~2024-07-27  0:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-15 13:39 Zijun Hu
2024-07-26 22:51 ` Jeff Johnson
2024-07-27  0:23   ` Zijun Hu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1267639-c885-4a27-ac15-b4199e38ec99@icloud.com \
    --to=zijun_hu@icloud.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quic_jjohnson@quicinc.com \
    --cc=quic_zijuhu@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®