public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop
@ 2023-02-06 20:17 Martin Kaiser
  2023-02-06 20:17 ` [PATCH 1/6] staging: r8188eu: pass a struct recv_buf to rtw_read_port Martin Kaiser
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Martin Kaiser @ 2023-02-06 20:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Remove the two pointers to media-specific start and stop functions. The
r8188eu driver supports only usb.

Update some of the functions in the start and stop paths to return
standard error codes instead of _SUCCESS and _FAIL.

Martin Kaiser (6):
  staging: r8188eu: pass a struct recv_buf to rtw_read_port
  staging: r8188eu: use standard error codes in rtw_read_port
  staging: r8188eu: use standard error codes in rtl8188eu_inirp_init
  staging: r8188eu: remove intf_start pointer
  staging: r8188eu: handle rtl8188eu_inirp_init errors
  staging: r8188eu: remove intf_stop pointer

 drivers/staging/r8188eu/hal/usb_halinit.c   | 16 ++++++--------
 drivers/staging/r8188eu/hal/usb_ops_linux.c | 20 ++++++++---------
 drivers/staging/r8188eu/include/drv_types.h |  2 --
 drivers/staging/r8188eu/include/hal_intf.h  |  2 +-
 drivers/staging/r8188eu/include/rtw_io.h    |  2 +-
 drivers/staging/r8188eu/os_dep/os_intfs.c   | 12 +++++------
 drivers/staging/r8188eu/os_dep/usb_intf.c   | 24 +++------------------
 7 files changed, 26 insertions(+), 52 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/6] staging: r8188eu: pass a struct recv_buf to rtw_read_port
  2023-02-06 20:17 [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop Martin Kaiser
@ 2023-02-06 20:17 ` Martin Kaiser
  2023-02-06 20:17 ` [PATCH 2/6] staging: r8188eu: use standard error codes in rtw_read_port Martin Kaiser
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Martin Kaiser @ 2023-02-06 20:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

The rtw_read_port function needs a struct recv_buf for preparing the usb
transfer.

Replace its u8 *rmem parameter with a struct recv_buf pointer to avoid
casts in the caller and in rtw_read_port.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/usb_halinit.c   | 2 +-
 drivers/staging/r8188eu/hal/usb_ops_linux.c | 9 ++++-----
 drivers/staging/r8188eu/include/rtw_io.h    | 2 +-
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index b7c9e5fd9a59..25fd6f8d814c 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -860,7 +860,7 @@ unsigned int rtl8188eu_inirp_init(struct adapter *Adapter)
 	/* issue Rx irp to receive data */
 	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
 	for (i = 0; i < NR_RECVBUFF; i++) {
-		if (!rtw_read_port(Adapter, (unsigned char *)precvbuf)) {
+		if (!rtw_read_port(Adapter, precvbuf)) {
 			status = _FAIL;
 			goto exit;
 		}
diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
index 9c940ab8fd41..225a422ede4f 100644
--- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
@@ -364,7 +364,7 @@ static void usb_read_port_complete(struct urb *purb)
 	if (purb->status == 0) { /* SUCCESS */
 		if ((purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)) {
 			precvbuf->reuse = true;
-			rtw_read_port(adapt, (unsigned char *)precvbuf);
+			rtw_read_port(adapt, precvbuf);
 		} else {
 			rtw_reset_continual_urb_error(adapter_to_dvobj(adapt));
 
@@ -376,7 +376,7 @@ static void usb_read_port_complete(struct urb *purb)
 
 			precvbuf->pskb = NULL;
 			precvbuf->reuse = false;
-			rtw_read_port(adapt, (unsigned char *)precvbuf);
+			rtw_read_port(adapt, precvbuf);
 		}
 	} else {
 		skb_put(precvbuf->pskb, purb->actual_length);
@@ -396,7 +396,7 @@ static void usb_read_port_complete(struct urb *purb)
 		case -EPROTO:
 		case -EOVERFLOW:
 			precvbuf->reuse = true;
-			rtw_read_port(adapt, (unsigned char *)precvbuf);
+			rtw_read_port(adapt, precvbuf);
 			break;
 		case -EINPROGRESS:
 			break;
@@ -406,10 +406,9 @@ static void usb_read_port_complete(struct urb *purb)
 	}
 }
 
-u32 rtw_read_port(struct adapter *adapter, u8 *rmem)
+u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf)
 {
 	struct urb *purb = NULL;
-	struct recv_buf	*precvbuf = (struct recv_buf *)rmem;
 	struct dvobj_priv	*pdvobj = adapter_to_dvobj(adapter);
 	struct recv_priv	*precvpriv = &adapter->recvpriv;
 	struct usb_device	*pusbd = pdvobj->pusbdev;
diff --git a/drivers/staging/r8188eu/include/rtw_io.h b/drivers/staging/r8188eu/include/rtw_io.h
index 090555f562f2..6b1de4f0e287 100644
--- a/drivers/staging/r8188eu/include/rtw_io.h
+++ b/drivers/staging/r8188eu/include/rtw_io.h
@@ -19,7 +19,7 @@
 int __must_check rtw_read8(struct adapter *adapter, u32 addr, u8 *data);
 int __must_check rtw_read16(struct adapter *adapter, u32 addr, u16 *data);
 int __must_check rtw_read32(struct adapter *adapter, u32 addr, u32 *data);
-u32 rtw_read_port(struct adapter *adapter, u8 *pmem);
+u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf);
 void rtw_read_port_cancel(struct adapter *adapter);
 
 int rtw_write8(struct adapter *adapter, u32 addr, u8 val);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/6] staging: r8188eu: use standard error codes in rtw_read_port
  2023-02-06 20:17 [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop Martin Kaiser
  2023-02-06 20:17 ` [PATCH 1/6] staging: r8188eu: pass a struct recv_buf to rtw_read_port Martin Kaiser
@ 2023-02-06 20:17 ` Martin Kaiser
  2023-02-06 20:17 ` [PATCH 3/6] staging: r8188eu: use standard error codes in rtl8188eu_inirp_init Martin Kaiser
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Martin Kaiser @ 2023-02-06 20:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Replace the driver-specific _SUCCESS and _FAIL error codes in
rtw_read_port. Return 0 for success or a negative error code as
we do elsewhere in the kernel.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/usb_ops_linux.c | 13 ++++++-------
 drivers/staging/r8188eu/include/rtw_io.h    |  2 +-
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
index 225a422ede4f..9611b19ab55b 100644
--- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
@@ -406,7 +406,7 @@ static void usb_read_port_complete(struct urb *purb)
 	}
 }
 
-u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf)
+int rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf)
 {
 	struct urb *purb = NULL;
 	struct dvobj_priv	*pdvobj = adapter_to_dvobj(adapter);
@@ -416,13 +416,12 @@ u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf)
 	unsigned int pipe;
 	size_t tmpaddr = 0;
 	size_t alignment = 0;
-	u32 ret = _SUCCESS;
 
 	if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
-		return _FAIL;
+		return -EPERM;
 
 	if (!precvbuf)
-		return _FAIL;
+		return -ENOMEM;
 
 	if (!precvbuf->reuse || !precvbuf->pskb) {
 		precvbuf->pskb = skb_dequeue(&precvpriv->free_recv_skb_queue);
@@ -434,7 +433,7 @@ u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf)
 	if (!precvbuf->reuse || !precvbuf->pskb) {
 		precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
 		if (!precvbuf->pskb)
-			return _FAIL;
+			return -ENOMEM;
 
 		tmpaddr = (size_t)precvbuf->pskb->data;
 		alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1);
@@ -458,9 +457,9 @@ u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf)
 
 	err = usb_submit_urb(purb, GFP_ATOMIC);
 	if ((err) && (err != (-EPERM)))
-		ret = _FAIL;
+		return err;
 
-	return ret;
+	return 0;
 }
 
 void rtl8188eu_xmit_tasklet(unsigned long priv)
diff --git a/drivers/staging/r8188eu/include/rtw_io.h b/drivers/staging/r8188eu/include/rtw_io.h
index 6b1de4f0e287..e1718f739cc9 100644
--- a/drivers/staging/r8188eu/include/rtw_io.h
+++ b/drivers/staging/r8188eu/include/rtw_io.h
@@ -19,7 +19,7 @@
 int __must_check rtw_read8(struct adapter *adapter, u32 addr, u8 *data);
 int __must_check rtw_read16(struct adapter *adapter, u32 addr, u16 *data);
 int __must_check rtw_read32(struct adapter *adapter, u32 addr, u32 *data);
-u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf);
+int rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf);
 void rtw_read_port_cancel(struct adapter *adapter);
 
 int rtw_write8(struct adapter *adapter, u32 addr, u8 val);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/6] staging: r8188eu: use standard error codes in rtl8188eu_inirp_init
  2023-02-06 20:17 [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop Martin Kaiser
  2023-02-06 20:17 ` [PATCH 1/6] staging: r8188eu: pass a struct recv_buf to rtw_read_port Martin Kaiser
  2023-02-06 20:17 ` [PATCH 2/6] staging: r8188eu: use standard error codes in rtw_read_port Martin Kaiser
@ 2023-02-06 20:17 ` Martin Kaiser
  2023-02-06 20:17 ` [PATCH 4/6] staging: r8188eu: remove intf_start pointer Martin Kaiser
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Martin Kaiser @ 2023-02-06 20:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Replace the driver-specific _SUCCESS and _FAIL error codes in
rtl8188eu_inirp_init. Return 0 for success or a negative error
code as we do elsewhere in the kernel.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/usb_halinit.c  | 16 ++++++----------
 drivers/staging/r8188eu/include/hal_intf.h |  2 +-
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index 25fd6f8d814c..a1051ac1cac4 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -848,29 +848,25 @@ u32 rtl8188eu_hal_deinit(struct adapter *Adapter)
 	return _SUCCESS;
  }
 
-unsigned int rtl8188eu_inirp_init(struct adapter *Adapter)
+int rtl8188eu_inirp_init(struct adapter *Adapter)
 {
 	u8 i;
 	struct recv_buf *precvbuf;
-	uint	status;
 	struct recv_priv *precvpriv = &Adapter->recvpriv;
-
-	status = _SUCCESS;
+	int ret;
 
 	/* issue Rx irp to receive data */
 	precvbuf = (struct recv_buf *)precvpriv->precv_buf;
 	for (i = 0; i < NR_RECVBUFF; i++) {
-		if (!rtw_read_port(Adapter, precvbuf)) {
-			status = _FAIL;
-			goto exit;
-		}
+		ret = rtw_read_port(Adapter, precvbuf);
+		if (ret)
+			return ret;
 
 		precvbuf++;
 		precvpriv->free_recv_buf_queue_cnt--;
 	}
 
-exit:
-	return status;
+	return 0;
 }
 
 /*  */
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index ac6e3f95c5b7..296aa5b8268d 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -26,7 +26,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level);
 int rtl8188e_IOL_exec_cmds_sync(struct adapter *adapter,
 				struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt);
 
-unsigned int rtl8188eu_inirp_init(struct adapter *Adapter);
+int rtl8188eu_inirp_init(struct adapter *Adapter);
 
 uint rtw_hal_init(struct adapter *padapter);
 uint rtw_hal_deinit(struct adapter *padapter);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/6] staging: r8188eu: remove intf_start pointer
  2023-02-06 20:17 [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop Martin Kaiser
                   ` (2 preceding siblings ...)
  2023-02-06 20:17 ` [PATCH 3/6] staging: r8188eu: use standard error codes in rtl8188eu_inirp_init Martin Kaiser
@ 2023-02-06 20:17 ` Martin Kaiser
  2023-02-06 20:17 ` [PATCH 5/6] staging: r8188eu: handle rtl8188eu_inirp_init errors Martin Kaiser
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Martin Kaiser @ 2023-02-06 20:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Remove the intf_start pointer that points to a media-specific start
function (pci, usb, sdio, ...). The r8188eu driver supports only usb.

We could call usb_intf_start directly instead of going through the
function pointer. usb_intf_start is just a call to rtl8188eu_inirp_init so
we can directly replace the intf_start pointer with rtl8188eu_inirp_init.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/include/drv_types.h | 1 -
 drivers/staging/r8188eu/os_dep/os_intfs.c   | 6 ++----
 drivers/staging/r8188eu/os_dep/usb_intf.c   | 6 ------
 3 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h
index 7b170eed66b3..40f13f185895 100644
--- a/drivers/staging/r8188eu/include/drv_types.h
+++ b/drivers/staging/r8188eu/include/drv_types.h
@@ -171,7 +171,6 @@ struct adapter {
 	s8	signal_strength;
 
 	void *cmdThread;
-	void (*intf_start)(struct adapter *adapter);
 	void (*intf_stop)(struct adapter *adapter);
 	struct  net_device *pnetdev;
 
diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
index 4130e8fe2952..e48dbdfefedb 100644
--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
@@ -631,8 +631,7 @@ static int _netdev_open(struct net_device *pnetdev)
 			pr_info("can't init mlme_ext_priv\n");
 			goto netdev_open_error;
 		}
-		if (padapter->intf_start)
-			padapter->intf_start(padapter);
+		rtl8188eu_inirp_init(padapter);
 
 		rtw_led_control(padapter, LED_CTL_NO_LINK);
 
@@ -684,8 +683,7 @@ static int  ips_netdrv_open(struct adapter *padapter)
 	if (status == _FAIL)
 		goto netdev_open_error;
 
-	if (padapter->intf_start)
-		padapter->intf_start(padapter);
+	rtl8188eu_inirp_init(padapter);
 
 	rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv);
 	_set_timer(&padapter->mlmepriv.dynamic_chk_timer, 5000);
diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
index 1f114b1fc4d5..ca9a7c0e5159 100644
--- a/drivers/staging/r8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
@@ -152,11 +152,6 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf)
 
 }
 
-static void usb_intf_start(struct adapter *padapter)
-{
-	rtl8188eu_inirp_init(padapter);
-}
-
 static void usb_intf_stop(struct adapter *padapter)
 {
 	/* cancel in irp */
@@ -313,7 +308,6 @@ static int rtw_usb_if1_init(struct dvobj_priv *dvobj, struct usb_interface *pusb
 	SET_NETDEV_DEV(pnetdev, dvobj_to_dev(dvobj));
 	padapter = rtw_netdev_priv(pnetdev);
 
-	padapter->intf_start = &usb_intf_start;
 	padapter->intf_stop = &usb_intf_stop;
 
 	/* step read_chip_version */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/6] staging: r8188eu: handle rtl8188eu_inirp_init errors
  2023-02-06 20:17 [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop Martin Kaiser
                   ` (3 preceding siblings ...)
  2023-02-06 20:17 ` [PATCH 4/6] staging: r8188eu: remove intf_start pointer Martin Kaiser
@ 2023-02-06 20:17 ` Martin Kaiser
  2023-02-06 20:18 ` [PATCH 6/6] staging: r8188eu: remove intf_stop pointer Martin Kaiser
  2023-02-07  6:13 ` [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop Philipp Hortmann
  6 siblings, 0 replies; 8+ messages in thread
From: Martin Kaiser @ 2023-02-06 20:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

The rtl8188eu_inirp_init returns 0 for success or a negative error code.
Handle this return value in the two places where rtl8188eu_inirp_init is
called.

Suggested-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/os_dep/os_intfs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
index e48dbdfefedb..bd3c17f580c8 100644
--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
@@ -631,7 +631,8 @@ static int _netdev_open(struct net_device *pnetdev)
 			pr_info("can't init mlme_ext_priv\n");
 			goto netdev_open_error;
 		}
-		rtl8188eu_inirp_init(padapter);
+		if (rtl8188eu_inirp_init(padapter))
+			goto netdev_open_error;
 
 		rtw_led_control(padapter, LED_CTL_NO_LINK);
 
@@ -683,7 +684,8 @@ static int  ips_netdrv_open(struct adapter *padapter)
 	if (status == _FAIL)
 		goto netdev_open_error;
 
-	rtl8188eu_inirp_init(padapter);
+	if (rtl8188eu_inirp_init(padapter))
+		goto netdev_open_error;
 
 	rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv);
 	_set_timer(&padapter->mlmepriv.dynamic_chk_timer, 5000);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/6] staging: r8188eu: remove intf_stop pointer
  2023-02-06 20:17 [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop Martin Kaiser
                   ` (4 preceding siblings ...)
  2023-02-06 20:17 ` [PATCH 5/6] staging: r8188eu: handle rtl8188eu_inirp_init errors Martin Kaiser
@ 2023-02-06 20:18 ` Martin Kaiser
  2023-02-07  6:13 ` [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop Philipp Hortmann
  6 siblings, 0 replies; 8+ messages in thread
From: Martin Kaiser @ 2023-02-06 20:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Remove the intf_stop pointer that points to a media-specific stop
function. The r8188eu driver supports only usb.

For usb drivers, intf_stop points to usb_intf_stop, which is only
two lines long.  We can remove intf_stop and usb_intf_stop and call
the two cancel functions directly.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/include/drv_types.h |  1 -
 drivers/staging/r8188eu/os_dep/os_intfs.c   |  4 ++--
 drivers/staging/r8188eu/os_dep/usb_intf.c   | 18 +++---------------
 3 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h
index 40f13f185895..159990facb8a 100644
--- a/drivers/staging/r8188eu/include/drv_types.h
+++ b/drivers/staging/r8188eu/include/drv_types.h
@@ -171,7 +171,6 @@ struct adapter {
 	s8	signal_strength;
 
 	void *cmdThread;
-	void (*intf_stop)(struct adapter *adapter);
 	struct  net_device *pnetdev;
 
 	/*  used by rtw_rereg_nd_name related function */
diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
index bd3c17f580c8..dc419fd1ffa5 100644
--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
@@ -761,8 +761,8 @@ void rtw_ips_dev_unload(struct adapter *padapter)
 {
 	rtw_fifo_cleanup(padapter);
 
-	if (padapter->intf_stop)
-		padapter->intf_stop(padapter);
+	rtw_read_port_cancel(padapter);
+	rtw_write_port_cancel(padapter);
 
 	/* s5. */
 	if (!padapter->bSurpriseRemoved)
diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
index ca9a7c0e5159..74a16d1757ce 100644
--- a/drivers/staging/r8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
@@ -152,17 +152,6 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf)
 
 }
 
-static void usb_intf_stop(struct adapter *padapter)
-{
-	/* cancel in irp */
-	rtw_read_port_cancel(padapter);
-
-	/* cancel out irp */
-	rtw_write_port_cancel(padapter);
-
-	/* todo:cancel other irps */
-}
-
 static void rtw_dev_unload(struct adapter *padapter)
 {
 	if (padapter->bup) {
@@ -170,8 +159,9 @@ static void rtw_dev_unload(struct adapter *padapter)
 		if (padapter->xmitpriv.ack_tx)
 			rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP);
 		/* s3. */
-		if (padapter->intf_stop)
-			padapter->intf_stop(padapter);
+		rtw_read_port_cancel(padapter);
+		rtw_write_port_cancel(padapter);
+
 		/* s4. */
 		rtw_stop_drv_threads(padapter);
 
@@ -308,8 +298,6 @@ static int rtw_usb_if1_init(struct dvobj_priv *dvobj, struct usb_interface *pusb
 	SET_NETDEV_DEV(pnetdev, dvobj_to_dev(dvobj));
 	padapter = rtw_netdev_priv(pnetdev);
 
-	padapter->intf_stop = &usb_intf_stop;
-
 	/* step read_chip_version */
 	rtl8188e_read_chip_version(padapter);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop
  2023-02-06 20:17 [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop Martin Kaiser
                   ` (5 preceding siblings ...)
  2023-02-06 20:18 ` [PATCH 6/6] staging: r8188eu: remove intf_stop pointer Martin Kaiser
@ 2023-02-07  6:13 ` Philipp Hortmann
  6 siblings, 0 replies; 8+ messages in thread
From: Philipp Hortmann @ 2023-02-07  6:13 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel

On 2/6/23 21:17, Martin Kaiser wrote:
> Remove the two pointers to media-specific start and stop functions. The
> r8188eu driver supports only usb.
> 
> Update some of the functions in the start and stop paths to return
> standard error codes instead of _SUCCESS and _FAIL.
> 
> Martin Kaiser (6):
>    staging: r8188eu: pass a struct recv_buf to rtw_read_port
>    staging: r8188eu: use standard error codes in rtw_read_port
>    staging: r8188eu: use standard error codes in rtl8188eu_inirp_init
>    staging: r8188eu: remove intf_start pointer
>    staging: r8188eu: handle rtl8188eu_inirp_init errors
>    staging: r8188eu: remove intf_stop pointer
> 
>   drivers/staging/r8188eu/hal/usb_halinit.c   | 16 ++++++--------
>   drivers/staging/r8188eu/hal/usb_ops_linux.c | 20 ++++++++---------
>   drivers/staging/r8188eu/include/drv_types.h |  2 --
>   drivers/staging/r8188eu/include/hal_intf.h  |  2 +-
>   drivers/staging/r8188eu/include/rtw_io.h    |  2 +-
>   drivers/staging/r8188eu/os_dep/os_intfs.c   | 12 +++++------
>   drivers/staging/r8188eu/os_dep/usb_intf.c   | 24 +++------------------
>   7 files changed, 26 insertions(+), 52 deletions(-)
> 
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-02-07  6:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-06 20:17 [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop Martin Kaiser
2023-02-06 20:17 ` [PATCH 1/6] staging: r8188eu: pass a struct recv_buf to rtw_read_port Martin Kaiser
2023-02-06 20:17 ` [PATCH 2/6] staging: r8188eu: use standard error codes in rtw_read_port Martin Kaiser
2023-02-06 20:17 ` [PATCH 3/6] staging: r8188eu: use standard error codes in rtl8188eu_inirp_init Martin Kaiser
2023-02-06 20:17 ` [PATCH 4/6] staging: r8188eu: remove intf_start pointer Martin Kaiser
2023-02-06 20:17 ` [PATCH 5/6] staging: r8188eu: handle rtl8188eu_inirp_init errors Martin Kaiser
2023-02-06 20:18 ` [PATCH 6/6] staging: r8188eu: remove intf_stop pointer Martin Kaiser
2023-02-07  6:13 ` [PATCH 0/6] staging: r8188eu: remove intf_start and intf_stop Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox