Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp534699pxb; Sat, 21 Aug 2021 09:53:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKVYabiJ7bTp9+vu0dQSd8L4jakBD1gS2/xXkI6fq4iBA2tYuvy339jAR+JEMD+rElds6j X-Received: by 2002:aa7:c685:: with SMTP id n5mr7946788edq.27.1629564782049; Sat, 21 Aug 2021 09:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629564782; cv=none; d=google.com; s=arc-20160816; b=Ur78lJBcP4TzOq0bAVToqBYhzsRHJPxVJ+Q/f04RTjSiHJ1kkTlopqIQpOvdIhhKYA JyLr57ql00TjMyqyYHe+eYbqtcHweAps+G2YnAa0GIvaOginCveVj3NEED4Py7oVfDT2 KIlmlTleyluMMtI/14R34b7FQ8F50J276JvW98VZST88UE1LkC+cMqkErqQkgXQ8nm01 15FcXUUl1DWLPBMJ4gqGeHGPTcyCFkMH7l+eIMR19dYEJ37OjPsLsWtnt4ZP5NpLfie9 P+K06OMvVradzHi3Vrx7hLeCKwrIec8cNLWmtFbzkIB4WwrRNvANehRCupYlpA6LTEPq 7EPg== 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=XmpOQjW/Wj43Vgxup3Bp610VIrQz2xF8T36bmy81U1M=; b=rSi4UUWoYsrJmImn5YqclibVAZrfgguAbChk/AEMmj2kU4Bp1EyNbRgYfk9XjWUsVu ZoxXtDDyvevtlFmHJC5GmaltQr95TvVhMhrG0mOx7VYzRYaHJ6qupaPRInpRW6xxM5iw xUL71e21ebSEC2t2oBQ19lhFa4gCq4m5OEEQKav1Aobct0Gh9VO8Hrb9ih/nEP+MxjDK oZb7UWo8qD8U5cH4I8ZSNvF2vU/JpFVHqb1waASW8+5F9h2aTm0M58CGzphE3qCpTX0p fybYm3u1baG5pkbpIliTdL5ynU2qkM3HM86oyw7/lBjv9qybXXOnHjMZl1zSPAuvBHCp AtiQ== 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 qf40si3057974ejc.1.2021.08.21.09.52.37; Sat, 21 Aug 2021 09:53:02 -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 S234813AbhHUQux (ORCPT + 99 others); Sat, 21 Aug 2021 12:50:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbhHUQum (ORCPT ); Sat, 21 Aug 2021 12:50:42 -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 1614FC061756 for ; Sat, 21 Aug 2021 09:50:03 -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 1mHUBy-0002Ch-Fg; Sat, 21 Aug 2021 18:49:58 +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 07/10] staging: r8188eu: clean up the usb_writeXY functions Date: Sat, 21 Aug 2021 18:48:56 +0200 Message-Id: <20210821164859.4351-7-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 Remove unnecessary variables, summarize declarations and assignments. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/hal/usb_ops_linux.c | 50 ++++----------------- 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index cb969a200681..e01f1ac19596 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -128,59 +128,25 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr) static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) { - u16 wvalue; - u16 len; - u8 data; - int ret; - - - wvalue = (u16)(addr & 0x0000ffff); - len = 1; - data = val; - ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_WRITE); + u16 wvalue = (u16)(addr & 0x0000ffff); - return ret; + return usbctrl_vendorreq(pintfhdl, wvalue, &val, 1, REALTEK_USB_VENQT_WRITE); } static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) { - u16 wvalue; - u16 len; - __le32 data; - int ret; - - - - wvalue = (u16)(addr & 0x0000ffff); - len = 2; - - data = cpu_to_le32(val & 0x0000ffff); - - ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_WRITE); - - + u16 wvalue = (u16)(addr & 0x0000ffff); + __le32 data = cpu_to_le32(val & 0x0000ffff); - return ret; + return usbctrl_vendorreq(pintfhdl, wvalue, &data, 2, REALTEK_USB_VENQT_WRITE); } static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) { - u16 wvalue; - u16 len; - __le32 data; - int ret; - - - - wvalue = (u16)(addr & 0x0000ffff); - len = 4; - data = cpu_to_le32(val); - - ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_WRITE); - - + u16 wvalue = (u16)(addr & 0x0000ffff); + __le32 data = cpu_to_le32(val); - return ret; + return usbctrl_vendorreq(pintfhdl, wvalue, &data, 4, REALTEK_USB_VENQT_WRITE); } static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata) -- 2.20.1