Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp535947pxb; Sat, 21 Aug 2021 09:55:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQVyTmWUQCLdNzdWKpmb6KiiFIR6LMfexk/unVTqijjc/xl3MXAgnyJ7RtfsFiYaGDgS4O X-Received: by 2002:a05:6402:10cc:: with SMTP id p12mr28673864edu.328.1629564940543; Sat, 21 Aug 2021 09:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629564940; cv=none; d=google.com; s=arc-20160816; b=sS53lk9+qpc1DVVlAt6dV/Y79G4v5bjrHbsSX5EWPxJqxGKNt45WiiiGYf7+tckjC2 E9LbFiXL0c9XNbfmu9LNnHyn+/sqmFBI5QSMWNZnsBKkWg4M3Y93h4FLvfFdbxdsNVSh VHLOhMGjV8ZuN0EctxeZL1o5/gvbuWpg75myRAk6Txce/Lnn/Bdw4cJDTUgwMo8FZ2E6 Zc3jyJmG5cgGrjaOs2V97l8RAvbIIJ9ud4e2xZnUcJVAqY4YkcM0+HdtvOWiG48RfoXW uB3rcsf1i3FfGmhaFhL2VNsa8+WpyPUEavA5aZ0Oj4h9yeNwvZbEcCzB1ebovgamNtZW YUvQ== 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=vp9S7FE9ZMUpdO0uEjpwG3Vq5Bz+LGyGfIB1xqGRdhE=; b=B/IWk930QLMhhv3v+Vz4M9i9lV0+dwVtAoSzqNgzZ0fed5uonzP53VSLxPNuxRkgqt uZrpsJp13RbQVzRq7Y1F66eEBjVuLSiJsQLvDxMAVoS3g+CYzofjBV+2FIlJ32sbdgfx r3/gc/2yGh5uQwlhPTFbadDo7D16JN7EohMVavMXIdeFN8GnlzBTUchiUrq67TDJA66L /u4ynJ+1fivBAlj+/0pNk4skqo5tHL9O1gS2/Me9brDhgDsDKJxpixypqtllYtTTQbqS ybuhhEkn7E8oS4+Aebo9xtUbwVe2NQIdLLktL07xsxq4xYL8UrHUBu6sMzgkqk8DQWYg 8rCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m4si10185463ejl.583.2021.08.21.09.55.09; Sat, 21 Aug 2021 09:55:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232197AbhHUQu5 (ORCPT + 99 others); Sat, 21 Aug 2021 12:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232432AbhHUQuq (ORCPT ); Sat, 21 Aug 2021 12:50:46 -0400 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 32F42C061764 for ; Sat, 21 Aug 2021 09:50:06 -0700 (PDT) Received: from dslb-178-004-175-162.178.004.pools.vodafone-ip.de ([178.4.175.162] 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 1mHUC1-0002Ch-N1; Sat, 21 Aug 2021 18:50:01 +0200 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Dan Carpenter , Michael Straube , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 10/10] staging: r8188eu: set pipe only once Date: Sat, 21 Aug 2021 18:48:59 +0200 Message-Id: <20210821164859.4351-10-martin@kaiser.cx> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210821164859.4351-1-martin@kaiser.cx> References: <20210821164859.4351-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set the pipe for reading or writing in usbctrl_vendorreq only once. There's no need to set it again for every retry. This patch is an adaptation of commit 889ed8b5e374 ("staging: rtl8188eu: set pipe only once") for the new r8188eu driver. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/hal/usb_ops_linux.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 5408383ccec3..5a55ee38d7b8 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -40,15 +40,16 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, void *pdata, goto release_mutex; } - while (++vendorreq_times <= MAX_USBCTRL_VENDORREQ_TIMES) { - memset(pIo_buf, 0, len); + if (requesttype == REALTEK_USB_VENQT_READ) + pipe = usb_rcvctrlpipe(udev, 0);/* read_in */ + else + pipe = usb_sndctrlpipe(udev, 0);/* write_out */ - if (requesttype == REALTEK_USB_VENQT_READ) { - pipe = usb_rcvctrlpipe(udev, 0);/* read_in */ - } else { - pipe = usb_sndctrlpipe(udev, 0);/* write_out */ + while (++vendorreq_times <= MAX_USBCTRL_VENDORREQ_TIMES) { + if (requesttype == REALTEK_USB_VENQT_READ) + memset(pIo_buf, 0, len); + else memcpy(pIo_buf, pdata, len); - } status = usb_control_msg(udev, pipe, REALTEK_USB_VENQT_CMD_REQ, requesttype, value, REALTEK_USB_VENQT_CMD_IDX, -- 2.20.1