linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Phillip Potter <phil@philpotter.co.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	Pavel Skripkin <paskripkin@gmail.com>
Subject: Re: [PATCH 1/3] staging: r8188eu: remove _io_ops structure
Date: Mon, 6 Sep 2021 10:49:11 +0300	[thread overview]
Message-ID: <20210906074910.GG1957@kadam> (raw)
In-Reply-To: <20210904150447.14659-2-fmdefrancesco@gmail.com>

On Sat, Sep 04, 2021 at 05:04:45PM +0200, Fabio M. De Francesco wrote:
> -static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata)
> +int rtw_writeN(struct adapter *adapter, u32 addr, u32 length, u8 *pdata)
>  {
> +	struct io_priv *pio_priv = &adapter->iopriv;
> +	struct intf_hdl *pintfhdl = &pio_priv->intf;
>  	u16 wvalue = (u16)(addr & 0x0000ffff);
>  	u8 buf[VENDOR_CMD_MAX_DATA_LEN] = {0};
> +	int ret;
>  
>  	if (length > VENDOR_CMD_MAX_DATA_LEN)
>  		return -EINVAL;

The caller treats this negative return as success.

>  
>  	memcpy(buf, pdata, length);
> +	ret = usbctrl_vendorreq(pintfhdl, wvalue, buf, (length & 0xffff), REALTEK_USB_VENQT_WRITE);
>  
> -	return usbctrl_vendorreq(pintfhdl, wvalue, buf, (length & 0xffff), REALTEK_USB_VENQT_WRITE);
> +	return RTW_STATUS_CODE(ret);
>  }

[ snip ]


> -void usb_read_port_cancel(struct intf_hdl *pintfhdl)
> +void rtw_read_port_cancel(struct adapter *adapter)
>  {
>  	int i;
> -	struct recv_buf *precvbuf;
> -	struct adapter	*padapter = pintfhdl->padapter;
> -	precvbuf = (struct recv_buf *)padapter->recvpriv.precv_buf;
> +	struct recv_buf *precvbuf = (struct recv_buf *) adapter->recvpriv.precv_buf;
>  
>  	DBG_88E("%s\n", __func__);
>  
> -	padapter->bReadPortCancel = true;
> +	adapter->bReadPortCancel = true;

In these functions it would be better to rename "padapter" as "adapter"
in a follow on function.  Keep it the same for now just to make review
easier.

>  
>  	for (i = 0; i < NR_RECVBUFF; i++) {
>  		precvbuf->reuse = true;
> @@ -134,22 +124,21 @@ static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs)
>  
>  }
>  
> -u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
> +u32 rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *wmem)
>  {
>  	unsigned long irqL;
>  	unsigned int pipe;
>  	int status;
>  	u32 ret = _FAIL;
>  	struct urb *purb = NULL;
> -	struct adapter *padapter = (struct adapter *)pintfhdl->padapter;
> -	struct dvobj_priv	*pdvobj = adapter_to_dvobj(padapter);
> -	struct xmit_priv	*pxmitpriv = &padapter->xmitpriv;
> +	struct dvobj_priv	*pdvobj = adapter_to_dvobj(adapter);
> +	struct xmit_priv	*pxmitpriv = &adapter->xmitpriv;
>  	struct xmit_buf *pxmitbuf = (struct xmit_buf *)wmem;
>  	struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitbuf->priv_data;
>  	struct usb_device *pusbd = pdvobj->pusbdev;
>  
> -	if ((padapter->bDriverStopped) || (padapter->bSurpriseRemoved) ||
> -	    (padapter->pwrctrlpriv.pnp_bstop_trx)) {
> +	if ((adapter->bDriverStopped) || (adapter->bSurpriseRemoved) ||
> +	    (adapter->pwrctrlpriv.pnp_bstop_trx)) {

Here too etc.  And below.

regards,
dan carpenter

>  		rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_TX_DENY);
>  		goto exit;
>  	}
> @@ -196,7 +185,7 @@ u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
>  
>  	status = usb_submit_urb(purb, GFP_ATOMIC);
>  	if (!status) {
> -		struct hal_data_8188e	*haldata = GET_HAL_DATA(padapter);
> +		struct hal_data_8188e	*haldata = GET_HAL_DATA(adapter);
>  
>  		haldata->srestpriv.last_tx_time = jiffies;
>  	} else {
> @@ -205,7 +194,7 @@ u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
>  
>  		switch (status) {
>  		case -ENODEV:
> -			padapter->bDriverStopped = true;
> +			adapter->bDriverStopped = true;
>  			break;
>  		default:
>  			break;
> @@ -224,15 +213,14 @@ u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
>  	return ret;
>  }
>  
> -void usb_write_port_cancel(struct intf_hdl *pintfhdl)
> +void rtw_write_port_cancel(struct adapter *adapter)
>  {
>  	int i, j;
> -	struct adapter	*padapter = pintfhdl->padapter;
> -	struct xmit_buf *pxmitbuf = (struct xmit_buf *)padapter->xmitpriv.pxmitbuf;
> +	struct xmit_buf *pxmitbuf = (struct xmit_buf *) adapter->xmitpriv.pxmitbuf;
>  
>  	DBG_88E("%s\n", __func__);
>  
> -	padapter->bWritePortCancel = true;
> +	adapter->bWritePortCancel = true;
>  
>  	for (i = 0; i < NR_XMITBUFF; i++) {
>  		for (j = 0; j < 8; j++) {
> @@ -242,7 +230,7 @@ void usb_write_port_cancel(struct intf_hdl *pintfhdl)
>  		pxmitbuf++;
>  	}
>  
> -	pxmitbuf = (struct xmit_buf *)padapter->xmitpriv.pxmit_extbuf;
> +	pxmitbuf = (struct xmit_buf *) adapter->xmitpriv.pxmit_extbuf;
>  	for (i = 0; i < NR_XMIT_EXTBUFF; i++) {
>  		for (j = 0; j < 8; j++) {
>  			if (pxmitbuf->pxmit_urb[j])
> -- 
> 2.33.0
> 

  reply	other threads:[~2021-09-06  7:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04 15:04 [PATCH 0/3] staging: r8188eu: Shorten and simplify calls chain Fabio M. De Francesco
2021-09-04 15:04 ` [PATCH 1/3] staging: r8188eu: remove _io_ops structure Fabio M. De Francesco
2021-09-06  7:49   ` Dan Carpenter [this message]
2021-09-06 14:04     ` Pavel Skripkin
2021-09-04 15:04 ` [PATCH 2/3] staging: r8188eu: Shorten calls chain of rtw_read8/16/32() Fabio M. De Francesco
2021-09-04 15:04 ` [PATCH 3/3] staging: r8188eu: Shorten calls chain of rtw_write8/16/32/N() Fabio M. De Francesco
2021-09-04 17:09   ` kernel test robot
2021-09-04 20:41     ` Fabio M. De Francesco

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=20210906074910.GG1957@kadam \
    --to=dan.carpenter@oracle.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=paskripkin@gmail.com \
    --cc=phil@philpotter.co.uk \
    --subject='Re: [PATCH 1/3] staging: r8188eu: remove _io_ops structure' \
    /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

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).