mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: Phillip Potter <phil@philpotter.co.uk>, gregkh@linuxfoundation.org
Cc: straube.linux@gmail.com, fmdefrancesco@gmail.com,
	Larry.Finger@lwfinger.net, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] staging: r8188eu: simplify c2h_evt_hdl function
Date: Mon, 30 Aug 2021 11:07:25 +0300	[thread overview]
Message-ID: <c6050183-5659-ceea-06a0-c652635dec85@gmail.com> (raw)
In-Reply-To: <20210829234541.946-3-phil@philpotter.co.uk>

On 8/30/21 2:45 AM, Phillip Potter wrote:
> Simplify c2h_evt_hdl function by removing majority of its code. The
> function always returned _FAIL anyway, due to the wrapper function it
> calls always returning _FAIL, and its one caller doesn't use the return
> value, so this function should just have a return type of void.
> 
> Leave the call to c2h_evt_read in place, as without it, event handling
> semantics of the driver would be changed, despite nothing actually being
> done with the event.
> 
> Acked-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> Acked-by: Michael Straube <straube.linux@gmail.com>
> Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> ---
> 
> V2: Changed return type to void, based on comment by Pavel Skripkin.
> 
> ---
>   drivers/staging/r8188eu/core/rtw_cmd.c | 23 +++--------------------
>   1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
> index ce73ac7cf973..14b74f92cd0f 100644
> --- a/drivers/staging/r8188eu/core/rtw_cmd.c
> +++ b/drivers/staging/r8188eu/core/rtw_cmd.c
> @@ -1852,29 +1852,12 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt)
>   	return res;
>   }
>   
> -static s32 c2h_evt_hdl(struct adapter *adapter, struct c2h_evt_hdr *c2h_evt, c2h_id_filter filter)
> +static void c2h_evt_hdl(struct adapter *adapter, struct c2h_evt_hdr *c2h_evt, c2h_id_filter filter)

filter is now unused and can be removed (anyway c2h_evt_hdl is called 
with filter == NULL)

Otherwise looks good

>   {
> -	s32 ret = _FAIL;
>   	u8 buf[16];
>   
> -	if (!c2h_evt) {
> -		/* No c2h event in cmd_obj, read c2h event before handling*/
> -		if (c2h_evt_read(adapter, buf) == _SUCCESS) {
> -			c2h_evt = (struct c2h_evt_hdr *)buf;
> -
> -			if (filter && !filter(c2h_evt->id))
> -				goto exit;
> -
> -			ret = rtw_hal_c2h_handler(adapter, c2h_evt);
> -		}
> -	} else {
> -		if (filter && !filter(c2h_evt->id))
> -			goto exit;
> -
> -		ret = rtw_hal_c2h_handler(adapter, c2h_evt);
> -	}
> -exit:
> -	return ret;
> +	if (!c2h_evt)
> +		c2h_evt_read(adapter, buf);
>   }
>   
>   static void c2h_wk_callback(struct work_struct *work)
> 


With regards,
Pavel Skripkin

  reply	other threads:[~2021-08-30  8:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-29 23:45 [PATCH v2 0/3] staging: r8188eu: cleanup c2h_handler code Phillip Potter
2021-08-29 23:45 ` [PATCH v2 1/3] staging: r8188eu: remove c2h_handler field from struct hal_ops Phillip Potter
2021-08-29 23:45 ` [PATCH v2 2/3] staging: r8188eu: simplify c2h_evt_hdl function Phillip Potter
2021-08-30  8:07   ` Pavel Skripkin [this message]
2021-08-29 23:45 ` [PATCH v2 3/3] staging: r8188eu: remove rtw_hal_c2h_handler function Phillip Potter

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=c6050183-5659-ceea-06a0-c652635dec85@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=fmdefrancesco@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@philpotter.co.uk \
    --cc=straube.linux@gmail.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®