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