linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Michael Straube <straube.linux@gmail.com>
To: Joe Perches <joe@perches.com>, gregkh@linuxfoundation.org
Cc: Larry.Finger@lwfinger.net, phil@philpotter.co.uk,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: r8188eu: convert three functions to bool
Date: Sun, 6 Nov 2022 10:39:10 +0100	[thread overview]
Message-ID: <22bea152-2591-b381-11d5-fe8b94498d31@gmail.com> (raw)
In-Reply-To: <6ca906bd81be7c6700068a5c9ba7354e14280619.camel@perches.com>

On 11/6/22 09:58, Joe Perches wrote:
> On Sat, 2022-11-05 at 10:39 +0100, Michael Straube wrote:
>> The functions
>>
>> is_client_associated_to_ap()
>> is_client_associated_to_ibss()
>> is_IBSS_empty()
>>
>> return boolean values. Convert their return type to bool and replace
>> _FAIL, which is defined as 0, with false. Another step to get rid of
>> _SUCCESS / _FAIL.
> 
> yay.
> 
>> diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c
> []
>> +bool is_client_associated_to_ap(struct adapter *padapter)
>>   {
>>   	struct mlme_ext_priv	*pmlmeext;
>>   	struct mlme_ext_info	*pmlmeinfo;
>>   
>>   	if (!padapter)
>> -		return _FAIL;
>> +		return false;
>>   
>>   	pmlmeext = &padapter->mlmeextpriv;
>>   	pmlmeinfo = &pmlmeext->mlmext_info;
>>   
>>   	if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE))
>>   		return true;
>> -	else
>> -		return _FAIL;
>> +
>> +	return false;
> 
> instead of
> 
> 	if (foo)
> 		return true;
> 	return false;
> 
> These could be:
> 
> 	return (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) &&
> 	       ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE);
> 
>> +bool is_client_associated_to_ibss(struct adapter *padapter)
>>   {
>>   	struct mlme_ext_priv	*pmlmeext = &padapter->mlmeextpriv;
>>   	struct mlme_ext_info	*pmlmeinfo = &pmlmeext->mlmext_info;
>>   
>>   	if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && ((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE))
>>   		return true;
>> -	else
>> -		return _FAIL;
>> +
>> +	return false;
> 
> and
> 
> 	return (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) &&
> 	       ((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE);
> 
> 

I'll keep this in mind for a future patch.

Thanks,
Michael

      reply	other threads:[~2022-11-06  9:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-05  9:39 [PATCH] staging: r8188eu: convert three functions to bool Michael Straube
2022-11-05 11:06 ` Phillip Potter
2022-11-05 11:25   ` Greg KH
2022-11-06  9:37     ` Michael Straube
2022-11-06  8:36 ` Philipp Hortmann
2022-11-06  8:58 ` Joe Perches
2022-11-06  9:39   ` Michael Straube [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=22bea152-2591-b381-11d5-fe8b94498d31@gmail.com \
    --to=straube.linux@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@philpotter.co.uk \
    /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;
as well as URLs for NNTP newsgroup(s).