From patchwork Mon Feb 6 20:17:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 53496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2449718wrn; Mon, 6 Feb 2023 12:39:08 -0800 (PST) X-Google-Smtp-Source: AK7set8hKQti3vWA6C3FNuUNSr+9wdaEkGgTaKFmPw55VGkcMlxP+lyAn1AhWEElhuaS2BOpEJqs X-Received: by 2002:a17:906:c1d1:b0:878:8009:2177 with SMTP id bw17-20020a170906c1d100b0087880092177mr658089ejb.53.1675715948081; Mon, 06 Feb 2023 12:39:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675715948; cv=none; d=google.com; s=arc-20160816; b=xmb4TrP7uuG81rnsPPkT124aj9qeQNlV5RiRHYrF42kjfZfFp1yyqsoG4cWzCmjJxz BYsere6WBIYzYKjZT0eLkr66e2XaQt18K0DG8/eAvOt/ERmJAhNbQIKpJHOjbr6hLrBG aFgUAVKVF1+Js6Pwbij5+9lbRPWALK9WvCwau/MRIAK/jlapnlYnri7uWLSsMLK2JJ1K Rm9xhZE/XtOPopPVavhOt4R46YxooV+I60UlqoGMWfC+svr6sCoA0ryz4YKAovdVUymi r03ewxJ3FteU40aeLEvPIvU64VNsPRwP5KKNOsRCmKVyA5PQ6npW3sQLSaeoJm8TiQdI R8jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=k7ssNqQPBr/IqY81lauCe2HdSUvchs7rSAyHAqy9/LI=; b=dZM3p/GjAEiTZkJ1nXeKX/3YPZRFdV1DERUbh84ND64filbF8tzbdjib/oMMGMx9W7 7mr/JhhYVn0zLjOVKf0IaCc+eY0lQNxkykVYaHdfjl/TIgqFLlFA0hwxLnXPH0GzPr67 9Y4BE4RYSvB+O/zUkOG0clwo/K7qTOtfdsmWKkWmHhPz20nSu4TjoKMc/gUuOWAGF5qv kgZsGr1ayrDIkqxr8TOFdkThwlxHNMBAx6AvHDr/9Mes7m6ivUe7pYEbrqNEGfT5KRX7 O6M6HC8BVmXyD7uwc5v6df8fGneLtg2JwPwi0C1vtEmgcW0kjJ7Kt/x0lS/PxWmbsC4H kZmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 11-20020a170906010b00b007c10d4bddccsi15028225eje.822.2023.02.06.12.38.45; Mon, 06 Feb 2023 12:39:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230140AbjBFUSr (ORCPT + 99 others); Mon, 6 Feb 2023 15:18:47 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757115526083227950?= X-GMAIL-MSGID: =?utf-8?q?1757115526083227950?= 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 --- 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); From patchwork Mon Feb 6 20:17:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 53498 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2451552wrn; Mon, 6 Feb 2023 12:43:51 -0800 (PST) X-Google-Smtp-Source: AK7set8fx7S48UG3Mcijt5lARNXlwfMlJvqV67S58Yl+JfPUo8KufEAgp1OJASbKR8IOyMm9X8/V X-Received: by 2002:a17:906:1b09:b0:864:223:40b with SMTP id o9-20020a1709061b0900b008640223040bmr694546ejg.33.1675716231366; Mon, 06 Feb 2023 12:43:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675716231; cv=none; d=google.com; s=arc-20160816; b=BS7dHFtYjrXz9IswXKc0pEIExX70sScxGUZvqYd6AVuy6TnBn3fgl/9Evk0yNFOy+A KBSZrsc3DsuJoJbU0Fj08pq3/tH4+6ObLIkbvAk0eGwXK1HUlg9dqpCziuc4q7X1hkqy BrDhqFza5JZ93vfn59SMULMpv8P6L9CDISsJhLmOe0QiwUEpMxW77//uea0Bns9y968N iXrerwi8qlTlk8Pyf3h2AxgmMxuooDJE4nnnPg4J3l1oTb+3IOCYSK9rr1ZPmqHL4QC4 s2Tx/OxLItMrCnMVEuLAV8wBsj92nfZu6IM6IemQPyyZaZBg0L2Dn1F5yUyiDnIpUrTY dtVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=OsGzdHu8gcfH/kKDopL7J2IxOLZabWqoV4D37eK7DMg=; b=F8vUA/5pI2PvJNVlkXfUAmFis2yvWM9jbGu7gOt7vn+4EHwpGA7JDENENko9z4rx7H JYdmZHGrr7g130WAhlylevXBxhkJVAu6/iE5DhgyfbMeAjtUK8Vhfel76Eyx/ScC6m+l w22GM4L72tWnPgkjXabS2dIwjeXAK2MxHzm1xv67k96uy4QTseH5BvsIbAd0vQm7uk4p Ucn/z9AEUK4atBBRLNjDEjVkSDA42ps3hUYFAgfbtyFaeJ4/VAWTQyfkbGGvGc5qx4Oh d6FWdKYZRGKRfVjfRdBLY8Qm1p6L8J3CB1JeFgPj/WkMkr6T8ZRgXWMbZ3UJsJ09RxEX +9+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wi5-20020a170906fd4500b0088bf8e5331fsi11450410ejb.363.2023.02.06.12.43.28; Mon, 06 Feb 2023 12:43:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230132AbjBFUSk (ORCPT + 99 others); Mon, 6 Feb 2023 15:18:40 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757115823183420194?= X-GMAIL-MSGID: =?utf-8?q?1757115823183420194?= 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 --- 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); From patchwork Mon Feb 6 20:17:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 53493 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2448536wrn; Mon, 6 Feb 2023 12:36:31 -0800 (PST) X-Google-Smtp-Source: AK7set+PJ1Z9a/JV+BlaXzB67xph0mgf2HMlw7+4I0hUTB/aU/4D4RUNs0FpRC04ANZD1RLNX/1K X-Received: by 2002:a50:d79e:0:b0:4aa:a4ff:ab89 with SMTP id w30-20020a50d79e000000b004aaa4ffab89mr1088819edi.10.1675715791049; Mon, 06 Feb 2023 12:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675715791; cv=none; d=google.com; s=arc-20160816; b=HnljH7uPjLQJjKJ9nqI9o24CoFrpIe5CfXMrkVeDY0XLN8qkR++1kVlcq8FmGqDJk7 +PmFVD7Mke4I4PIcAT63Bz365jX182iKS4nrjriFANh070FzZNgDfZ4NlPnv8hUwbAdY rVh03O/k/M8F6Gitk4477WsSMfxh6rtwHYaNLR8bE3ov1WdKqVRYik72eF7qVqCE+PwD isslTRma12hQPQFFyMiBaWWbREw1kdU8ykB7LvGmB96TY776ODe8D2kqW+jVO3LHXibW oJ1iNCSutrf1mZIBPfQJgWXN8yurYb5jkdn0BqUgLw4gRVHUEqHyreL47o7+NltnfDXz PlmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1q/XTckdm0GYIUp/EF1qW1VITWNL+pvdtNwLM1Y/4dY=; b=qSK/Io2+/j+3SihgKE26pmRUAClHtCfyUnP8GPhkg+nqS1KleEOxSx1O5b6C6U7NHS ryZ5nqQUKX0Xft6FXK8g4QJf+x4zAGIIs8hC/wOrRG4lQ5px+AvbiCulMgz+sAT3k2dg hX/0Sxv6THT9NaB3LpX88rKremAMowPp8Viy9GZjFP5qo/ubhccuvVpa8JNFqT0d3Y/R uytr+nP9t/Nls7l2hE5cP9DeczvABIckvJivkzknOYIKFJdcP3Hi/sq4FjfNguY/CnWC 3xSYhGcfTy1QKUgwQJKr3J/7T7vlRkhgrRBUD6CZ2Pwedwsm+0fn/vUGrrxFPx/A0TLl btaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r4-20020aa7da04000000b004aab36a29aesi4249776eds.552.2023.02.06.12.36.06; Mon, 06 Feb 2023 12:36:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230094AbjBFUSh (ORCPT + 99 others); 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757115361540792491?= X-GMAIL-MSGID: =?utf-8?q?1757115361540792491?= 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 --- 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); From patchwork Mon Feb 6 20:17:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 53495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2449112wrn; Mon, 6 Feb 2023 12:37:49 -0800 (PST) X-Google-Smtp-Source: AK7set8voo2BcgGVK4FK14NBBcsrFjrSO16vkP6DFW3WeTFOobZ+canp06h/KPDDsC7wI6GyVlaq X-Received: by 2002:a50:d0db:0:b0:4aa:a767:798c with SMTP id g27-20020a50d0db000000b004aaa767798cmr1131417edf.0.1675715869409; Mon, 06 Feb 2023 12:37:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675715869; cv=none; d=google.com; s=arc-20160816; b=JGsGP6Yw8xqIbE0BZwJCc6/CGdQJlQ6kuxuAgPDuOqdkcSYDc7Br227sQDRRDrgmMK CY+g2eT/2ta8qdgXvUWreG01jJk965OXV7C8x8gdKqhqOvUOATBHC5A7DBtpb6pN9dIt WTGH+N+GpR6R51hE+b7pcyf/8XJ29JoiqQuQ3A3X4gEZ6XBq7XSN3styZQVtISDYQsQ5 k1TYn6rpSyKF9YajwudrTzaCPSozkVLAXCzyWMmh34B5xOfM1d/DWbVq6mYFVb4c61DZ 2fcbTp9nVW7ceGuVd/UYcPrbCKFPos9teFVN7wojloI+Ak18VEyIi2wO1jRVIXm9RboN X2bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kL800BJGIG4LF5T6BaY9z3qoKZkwuQZv8Fik0X1Xngk=; b=oa7pgRx7YODd90vRwaPnzmeqYEjODUvNPTwvRAjnc79az1agLt+xwWrTIbdVUN4zwH qz0PL71EZ6g53b8WMi6OmlLws1Pr9pwpniHbU0AzWnaWhTmJYHlChQ4JMVVXaD2QRzI/ iIiRhfEBYp/VOIQA10vpqEs82+Bg8izS6B+G5QJbufZrxMZOGQGbhOvUo0UT/fGWCLQt /YRtFjB5DwHcqh0RIPZ4HJucwXHq57bPQI1tSEj41Kqe9XStpcedB3vczWgtYDDvV4B/ upZZk1wSz/quew4uaDBXxwc3G285xi1X1it82RamyR5uyKWE3oZtBdH8NHxTexF9CkB6 660g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i24-20020a0564020f1800b004974112a35dsi15939842eda.541.2023.02.06.12.37.26; Mon, 06 Feb 2023 12:37:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230172AbjBFUS6 (ORCPT + 99 others); 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757115443437227026?= X-GMAIL-MSGID: =?utf-8?q?1757115443437227026?= 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 --- 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 */ From patchwork Mon Feb 6 20:17:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 53492 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2447698wrn; Mon, 6 Feb 2023 12:34:19 -0800 (PST) X-Google-Smtp-Source: AK7set86bqjLzKF9vhI566ln1SGwxqOXDr1jj0vBeA8/vaKlYcxUaCLFC/iW9xsXgfUh8UmWn4dD X-Received: by 2002:a17:907:a41e:b0:8a9:4d68:12df with SMTP id sg30-20020a170907a41e00b008a94d6812dfmr123074ejc.38.1675715659632; Mon, 06 Feb 2023 12:34:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675715659; cv=none; d=google.com; s=arc-20160816; b=Cw1Fnvzm1ptLxdgk4e/W7Pp+tRdTJds4JnSfeAnlTO7n2VJL6QKJisZi0ke4ZF3sWz /NxdJWw8cDGHkEdJGzEuPoMqdBH9mL1y/t8znWEjKQIUD3He4fa3UpwGnkul17hhTow/ RRY0UtYzzRx2Jvg6/vLnxpN0U0DqjdHFnqzaJC0y6wopsjU0IASVRHXspgujeV31/nzf a4Fz5FW41OUkS4AqExCHxX33fVmz52k3g7GUD28Dl8ShY/el++tbd4yBEgGlSq189W78 naaheadVovfQfZnjB4C+BRIb4i/UCAV5fxH1bvX7IUItBB7py03+NSYUNjSXy/ORZtZx xHnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TCnVBxMA17vDN2dIs1WsM9+Ar3LCRry9ct2YS3y1cu0=; b=FlVTozPkOGFRVtwALf5JkGV2aPYFPK3sSCOYsq5PPcTVeUsqRiGE1C9j4Bi8s6ebuL 7V2WUIAfw4e5eanQeXhu4I3wmfb4BD2QbnjEUzZyb0UExClhDCNNNb28CeVFWQSlNnwQ lAcJLcl13yuJ3bswjxBr5y6HCgFWfT047/gcGr5rI0Xq8c7ReNvBQpe4q9rTT2/njqFO +4znWAj0K87h/KzQ5uZAmURqFpjm/WhSzyZOwkB9zAtrlL4nbr7Uyb5uTZDRNrYQSxTi i6M5tPFb7lmC3RSaaBGJwh7Gn22t9cL2LB1t1c1mTVNMxMSI9wO5ACKhZ8HHY9L6Vfnc 6OWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vl16-20020a17090730d000b00870b0d90078si13273447ejb.644.2023.02.06.12.33.47; Mon, 06 Feb 2023 12:34:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbjBFUTB (ORCPT + 99 others); Mon, 6 Feb 2023 15:19:01 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757115223553747806?= X-GMAIL-MSGID: =?utf-8?q?1757115223553747806?= 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 --- 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); From patchwork Mon Feb 6 20:18:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 53497 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2449878wrn; Mon, 6 Feb 2023 12:39:31 -0800 (PST) X-Google-Smtp-Source: AK7set8ffgZaNQMxk+p4RpMX985psKxKs6Adv73hQwSPXxAkh+Jir0YcD+l5P1Y9sWj9JWD8Xg0J X-Received: by 2002:a17:906:b30d:b0:88c:a14a:d039 with SMTP id n13-20020a170906b30d00b0088ca14ad039mr592163ejz.69.1675715971574; Mon, 06 Feb 2023 12:39:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675715971; cv=none; d=google.com; s=arc-20160816; b=yUpTYXJxlYmDy9jN+uBr/ZG30JJNBJMozoclM0e+/eSKeuKtNuk0PHfaKq/gy0ZK8c GDDmDHtKnT/ouJQFqOaEYjjxC5jVkZ66Dh4uUdq7xMzpuTVxmXo9uqvLE4qV+mvoc4Dc J3w6gmw++1Mgwe4RQU7y2WDHOIS+xZeyIaAL5jCmT/CpWH/5np9HlVa+ZM5koRBogFsf FbQoVk73jf35WjmZX4NTn1KLL8lxQWAnjHQwMHWXRZRje5kINR4+HdRRJ3kqscR4WtC5 VT+nW+YE471dX8rVVbyAxHtWqmNKl3FJrMtwrcUuVDUXsaPrHtPT3HHcp+jd6Pg4O8S+ Ga9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=w/NSELd6snl1ODrjC11g6PlptyMJ4ANFBdeVAxy35Vw=; b=K8qE941nXViqcJxoFQ/jIWPPyydD1lmq5rlkoO5fZo1djocAylOF8xp1j2n75vX6pv tTzZHUerPJlVVyDXI4BSSr4kVgVeo4s1ie+tUG8ACg3PC/rtwB2MmgBvsYmwR81DZRyD Yr6FLzY0KGj9RQWfyu8Pq4Rb5UCh2NQG7kMMuGgPHcEoojQCLjFoRnsOAaUYYbYtlcmw WX4ERdYuZI7BIKm82OpJeU9SjCMtASYCwO8B0ZNbowA5cU64HfSpPMCg+/fGn6hw6uW1 oaNsllZKSfa3s69G4x4ktrixJBNFO3HWbFD0BvQAWiPdmKPLJpW1DRdJIAGtuesmILEi /Ayw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oh10-20020a17090784ca00b0088fa742b8dasi10412173ejc.653.2023.02.06.12.39.07; Mon, 06 Feb 2023 12:39:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230215AbjBFUTE (ORCPT + 99 others); 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757115550332563347?= X-GMAIL-MSGID: =?utf-8?q?1757115550332563347?= 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 --- 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);