From nobody Sat Sep 13 00:02:38 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D87AC05027 for ; Mon, 6 Feb 2023 20:18:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230039AbjBFUSs (ORCPT ); Mon, 6 Feb 2023 15:18:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbjBFUSd (ORCPT ); Mon, 6 Feb 2023 15:18:33 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4880C2B09D for ; Mon, 6 Feb 2023 12:18:15 -0800 (PST) Received: from ipservice-092-217-084-033.092.217.pools.vodafone-ip.de ([92.217.84.33] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1pP7wG-0007ps-34; Mon, 06 Feb 2023 21:18:08 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 1/6] staging: r8188eu: pass a struct recv_buf to rtw_read_port Date: Mon, 6 Feb 2023 21:17:55 +0100 Message-Id: <20230206201800.139195-2-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230206201800.139195-1-martin@kaiser.cx> References: <20230206201800.139195-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by: Philipp Hortmann # Edimax N150 --- 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/r8= 188eu/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 *Adapt= er) /* issue Rx irp to receive data */ precvbuf =3D (struct recv_buf *)precvpriv->precv_buf; for (i =3D 0; i < NR_RECVBUFF; i++) { - if (!rtw_read_port(Adapter, (unsigned char *)precvbuf)) { + if (!rtw_read_port(Adapter, precvbuf)) { status =3D _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 =3D=3D 0) { /* SUCCESS */ if ((purb->actual_length > MAX_RECVBUF_SZ) || (purb->actual_length < RXD= ESC_SIZE)) { precvbuf->reuse =3D true; - rtw_read_port(adapt, (unsigned char *)precvbuf); + rtw_read_port(adapt, precvbuf); } else { rtw_reset_continual_urb_error(adapter_to_dvobj(adapt)); =20 @@ -376,7 +376,7 @@ static void usb_read_port_complete(struct urb *purb) =20 precvbuf->pskb =3D NULL; precvbuf->reuse =3D 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 =3D 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) } } =20 -u32 rtw_read_port(struct adapter *adapter, u8 *rmem) +u32 rtw_read_port(struct adapter *adapter, struct recv_buf *precvbuf) { struct urb *purb =3D NULL; - struct recv_buf *precvbuf =3D (struct recv_buf *)rmem; struct dvobj_priv *pdvobj =3D adapter_to_dvobj(adapter); struct recv_priv *precvpriv =3D &adapter->recvpriv; struct usb_device *pusbd =3D pdvobj->pusbdev; diff --git a/drivers/staging/r8188eu/include/rtw_io.h b/drivers/staging/r81= 88eu/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); =20 int rtw_write8(struct adapter *adapter, u32 addr, u8 val); --=20 2.30.2 From nobody Sat Sep 13 00:02:38 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD6ADC636D3 for ; Mon, 6 Feb 2023 20:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230089AbjBFUSq (ORCPT ); Mon, 6 Feb 2023 15:18:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbjBFUSe (ORCPT ); Mon, 6 Feb 2023 15:18:34 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4860F2942B for ; Mon, 6 Feb 2023 12:18:15 -0800 (PST) Received: from ipservice-092-217-084-033.092.217.pools.vodafone-ip.de ([92.217.84.33] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1pP7wG-0007ps-Sf; Mon, 06 Feb 2023 21:18:08 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 2/6] staging: r8188eu: use standard error codes in rtw_read_port Date: Mon, 6 Feb 2023 21:17:56 +0100 Message-Id: <20230206201800.139195-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230206201800.139195-1-martin@kaiser.cx> References: <20230206201800.139195-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by: Philipp Hortmann # Edimax N150 --- 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) } } =20 -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 =3D NULL; struct dvobj_priv *pdvobj =3D adapter_to_dvobj(adapter); @@ -416,13 +416,12 @@ u32 rtw_read_port(struct adapter *adapter, struct rec= v_buf *precvbuf) unsigned int pipe; size_t tmpaddr =3D 0; size_t alignment =3D 0; - u32 ret =3D _SUCCESS; =20 if (adapter->bDriverStopped || adapter->bSurpriseRemoved) - return _FAIL; + return -EPERM; =20 if (!precvbuf) - return _FAIL; + return -ENOMEM; =20 if (!precvbuf->reuse || !precvbuf->pskb) { precvbuf->pskb =3D 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 =3D netdev_alloc_skb(adapter->pnetdev, MAX_RECVBUF_SZ + R= ECVBUFF_ALIGN_SZ); if (!precvbuf->pskb) - return _FAIL; + return -ENOMEM; =20 tmpaddr =3D (size_t)precvbuf->pskb->data; alignment =3D tmpaddr & (RECVBUFF_ALIGN_SZ - 1); @@ -458,9 +457,9 @@ u32 rtw_read_port(struct adapter *adapter, struct recv_= buf *precvbuf) =20 err =3D usb_submit_urb(purb, GFP_ATOMIC); if ((err) && (err !=3D (-EPERM))) - ret =3D _FAIL; + return err; =20 - return ret; + return 0; } =20 void rtl8188eu_xmit_tasklet(unsigned long priv) diff --git a/drivers/staging/r8188eu/include/rtw_io.h b/drivers/staging/r81= 88eu/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); =20 int rtw_write8(struct adapter *adapter, u32 addr, u8 val); --=20 2.30.2 From nobody Sat Sep 13 00:02:38 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5A16C636D4 for ; Mon, 6 Feb 2023 20:18:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230106AbjBFUSh (ORCPT ); Mon, 6 Feb 2023 15:18:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbjBFUSd (ORCPT ); Mon, 6 Feb 2023 15:18:33 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C29A26858 for ; Mon, 6 Feb 2023 12:18:15 -0800 (PST) Received: from ipservice-092-217-084-033.092.217.pools.vodafone-ip.de ([92.217.84.33] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1pP7wH-0007ps-N2; Mon, 06 Feb 2023 21:18:09 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 3/6] staging: r8188eu: use standard error codes in rtl8188eu_inirp_init Date: Mon, 6 Feb 2023 21:17:57 +0100 Message-Id: <20230206201800.139195-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230206201800.139195-1-martin@kaiser.cx> References: <20230206201800.139195-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by: Philipp Hortmann # Edimax N150 --- 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/r8= 188eu/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; } =20 -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 =3D &Adapter->recvpriv; - - status =3D _SUCCESS; + int ret; =20 /* issue Rx irp to receive data */ precvbuf =3D (struct recv_buf *)precvpriv->precv_buf; for (i =3D 0; i < NR_RECVBUFF; i++) { - if (!rtw_read_port(Adapter, precvbuf)) { - status =3D _FAIL; - goto exit; - } + ret =3D rtw_read_port(Adapter, precvbuf); + if (ret) + return ret; =20 precvbuf++; precvpriv->free_recv_buf_queue_cnt--; } =20 -exit: - return status; + return 0; } =20 /* */ diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r= 8188eu/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 m= ac_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); =20 -unsigned int rtl8188eu_inirp_init(struct adapter *Adapter); +int rtl8188eu_inirp_init(struct adapter *Adapter); =20 uint rtw_hal_init(struct adapter *padapter); uint rtw_hal_deinit(struct adapter *padapter); --=20 2.30.2 From nobody Sat Sep 13 00:02:38 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5A7BC05027 for ; Mon, 6 Feb 2023 20:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230191AbjBFUS6 (ORCPT ); Mon, 6 Feb 2023 15:18:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbjBFUSe (ORCPT ); Mon, 6 Feb 2023 15:18:34 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02CAC3A92 for ; Mon, 6 Feb 2023 12:18:16 -0800 (PST) Received: from ipservice-092-217-084-033.092.217.pools.vodafone-ip.de ([92.217.84.33] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1pP7wI-0007ps-EM; Mon, 06 Feb 2023 21:18:10 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 4/6] staging: r8188eu: remove intf_start pointer Date: Mon, 6 Feb 2023 21:17:58 +0100 Message-Id: <20230206201800.139195-5-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230206201800.139195-1-martin@kaiser.cx> References: <20230206201800.139195-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by: Philipp Hortmann # Edimax N150 --- 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; =20 void *cmdThread; - void (*intf_start)(struct adapter *adapter); void (*intf_stop)(struct adapter *adapter); struct net_device *pnetdev; =20 diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8= 188eu/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); =20 rtw_led_control(padapter, LED_CTL_NO_LINK); =20 @@ -684,8 +683,7 @@ static int ips_netdrv_open(struct adapter *padapter) if (status =3D=3D _FAIL) goto netdev_open_error; =20 - if (padapter->intf_start) - padapter->intf_start(padapter); + rtl8188eu_inirp_init(padapter); =20 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/r8= 188eu/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) =20 } =20 -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, s= truct usb_interface *pusb SET_NETDEV_DEV(pnetdev, dvobj_to_dev(dvobj)); padapter =3D rtw_netdev_priv(pnetdev); =20 - padapter->intf_start =3D &usb_intf_start; padapter->intf_stop =3D &usb_intf_stop; =20 /* step read_chip_version */ --=20 2.30.2 From nobody Sat Sep 13 00:02:38 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E97AC05027 for ; Mon, 6 Feb 2023 20:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230206AbjBFUTC (ORCPT ); Mon, 6 Feb 2023 15:19:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229967AbjBFUSf (ORCPT ); Mon, 6 Feb 2023 15:18:35 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0724E27D4A for ; Mon, 6 Feb 2023 12:18:17 -0800 (PST) Received: from ipservice-092-217-084-033.092.217.pools.vodafone-ip.de ([92.217.84.33] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1pP7wJ-0007ps-9E; Mon, 06 Feb 2023 21:18:11 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 5/6] staging: r8188eu: handle rtl8188eu_inirp_init errors Date: Mon, 6 Feb 2023 21:17:59 +0100 Message-Id: <20230206201800.139195-6-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230206201800.139195-1-martin@kaiser.cx> References: <20230206201800.139195-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Martin Kaiser Tested-by: Philipp Hortmann # Edimax N150 --- 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/r8= 188eu/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; =20 rtw_led_control(padapter, LED_CTL_NO_LINK); =20 @@ -683,7 +684,8 @@ static int ips_netdrv_open(struct adapter *padapter) if (status =3D=3D _FAIL) goto netdev_open_error; =20 - rtl8188eu_inirp_init(padapter); + if (rtl8188eu_inirp_init(padapter)) + goto netdev_open_error; =20 rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 5000); --=20 2.30.2 From nobody Sat Sep 13 00:02:38 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31284C05027 for ; Mon, 6 Feb 2023 20:19:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230227AbjBFUTE (ORCPT ); Mon, 6 Feb 2023 15:19:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbjBFUSf (ORCPT ); Mon, 6 Feb 2023 15:18:35 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07F907A81 for ; Mon, 6 Feb 2023 12:18:17 -0800 (PST) Received: from ipservice-092-217-084-033.092.217.pools.vodafone-ip.de ([92.217.84.33] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1pP7wK-0007ps-53; Mon, 06 Feb 2023 21:18:12 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 6/6] staging: r8188eu: remove intf_stop pointer Date: Mon, 6 Feb 2023 21:18:00 +0100 Message-Id: <20230206201800.139195-7-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230206201800.139195-1-martin@kaiser.cx> References: <20230206201800.139195-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Tested-by: Philipp Hortmann # Edimax N150 --- 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; =20 void *cmdThread; - void (*intf_stop)(struct adapter *adapter); struct net_device *pnetdev; =20 /* used by rtw_rereg_nd_name related function */ diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8= 188eu/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); =20 - if (padapter->intf_stop) - padapter->intf_stop(padapter); + rtw_read_port_cancel(padapter); + rtw_write_port_cancel(padapter); =20 /* s5. */ if (!padapter->bSurpriseRemoved) diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8= 188eu/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) =20 } =20 -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); =20 @@ -308,8 +298,6 @@ static int rtw_usb_if1_init(struct dvobj_priv *dvobj, s= truct usb_interface *pusb SET_NETDEV_DEV(pnetdev, dvobj_to_dev(dvobj)); padapter =3D rtw_netdev_priv(pnetdev); =20 - padapter->intf_stop =3D &usb_intf_stop; - /* step read_chip_version */ rtl8188e_read_chip_version(padapter); =20 --=20 2.30.2