From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DECB3FCC for ; Fri, 17 Sep 2021 07:19:11 +0000 (UTC) Received: by mail-ed1-f51.google.com with SMTP id g8so26452796edt.7 for ; Fri, 17 Sep 2021 00:19:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T5tmD/IVMf4aMEAC96PyvYI1EMja5j9e4mVGo0AQTFY=; b=KdQfihRLaHE1Ttmh96cRAX4/0TgwKHbvIypM0kBo5a6a7JOKj3jlBd4Gw4DS9qzpha H6LOJHtnYNXk3m3lps6MbhZDFXawOE+Vb1Ubmb4BnBR1yXPcmBQZZXQP98gl6WkAPytH ogMxCL47zTLhROxe6yEJIyX3iK0SqdFMIcPdot9E+ZdQ1U/0kZXNTLg0BxqwvhDy634F FTtrD2s0GIFjzI3VoGbjUpNF4ewt9OfdGaCgvjyNQ9GH9MGkAoyHWcvGJR6vkZiuzSiQ YwZFljmbR3v5mtRmUSoBdq+hy1pegfcUECcRMVieJbOKbZQHlcx1Qr1mx9VEIGz+i3vo JYVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T5tmD/IVMf4aMEAC96PyvYI1EMja5j9e4mVGo0AQTFY=; b=UoZHvHCmV9hLxqpLQUYGoVvg9GDqEG4uAXSejLBcJyD7fZphrR37KVTZQ2a4XNshze oRefCu5S5YHxDCo5gQvvaULu4mNtCRev9TDcq+GCFX0B7xwU3lHev0+qlxO4ufLjOFZM SDK7px7fhzlh+iF3BFYwWLEnSR+WFgZcxvaJec2+yAi1huckY7cMctDxImSeJ7XuHnOn hUjRqM4SWGrC0YdcfxL0WOSe2QhFf5iA11elVxJQKkSe7S233iNt82m0Pk31WPLlmAH1 Xf7NbN6FoPvAMNVQajsS3cqSIrv4O1BaTHi1nJFrMyTExG9aSyVz/4Pf2zIkrmaJExDy 2QdQ== X-Gm-Message-State: AOAM531yXIZHKewrZXNkg+XqGGpOkgq5kqqKPTIunvPJDE4r7ByndnNo r3Ky8Et2PfVZMpiuuyLG3y8= X-Google-Smtp-Source: ABdhPJxWSv/Pin0o96QRwG8D8tN3dmWJRcZ88LQGOjCO9IHyTCq+JfMb2sgWozu8YxDZZefKFgOOEw== X-Received: by 2002:a17:906:19d8:: with SMTP id h24mr10780111ejd.490.1631863149748; Fri, 17 Sep 2021 00:19:09 -0700 (PDT) Received: from localhost.localdomain.it (host-79-47-104-104.retail.telecomitalia.it. [79.47.104.104]) by smtp.gmail.com with ESMTPSA id q19sm2297140edc.74.2021.09.17.00.19.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Sep 2021 00:19:09 -0700 (PDT) From: "Fabio M. De Francesco" To: Larry Finger , Phillip Potter , Greg Kroah-Hartman , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, David Laight , Dan Carpenter Cc: "Fabio M . De Francesco" Subject: [PATCH v7 07/19] staging: r8188eu: remove the helpers of usb_write32() Date: Fri, 17 Sep 2021 09:18:25 +0200 Message-Id: <20210917071837.10926-8-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210917071837.10926-1-fmdefrancesco@gmail.com> References: <20210917071837.10926-1-fmdefrancesco@gmail.com> Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Pavel Skripkin Remove the unnecessary _rtw_write32() and usb_write32() and embed their code into the caller (i.e., rtw_write32()). _rtw_write32() is a mere redefinition of rtw_write32() and it is unneeded. usb_write32() was the only functions assigned to the (*_usb_write32) pointer, so we can simply remove it and make a direct call. This patch is in preparation for the _io_ops structure removal. Reviewed-by: Dan Carpenter Co-developed-by: Fabio M. De Francesco Signed-off-by: Fabio M. De Francesco Signed-off-by: Pavel Skripkin --- drivers/staging/r8188eu/core/rtw_io.c | 15 --------------- drivers/staging/r8188eu/hal/usb_ops_linux.c | 10 +++++++--- drivers/staging/r8188eu/include/rtw_io.h | 4 +--- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_io.c b/drivers/staging/r8188eu/core/rtw_io.c index 7547e25d870b..98c9823fe53b 100644 --- a/drivers/staging/r8188eu/core/rtw_io.c +++ b/drivers/staging/r8188eu/core/rtw_io.c @@ -34,21 +34,6 @@ jackson@realtek.com.tw #define rtw_cpu_to_le16(val) cpu_to_le16(val) #define rtw_cpu_to_le32(val) cpu_to_le32(val) -int _rtw_write32(struct adapter *adapter, u32 addr, u32 val) -{ - struct io_priv *pio_priv = &adapter->iopriv; - struct intf_hdl *pintfhdl = &pio_priv->intf; - int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val); - int ret; - - _write32 = pintfhdl->io_ops._write32; - - ret = _write32(pintfhdl, addr, val); - - - return RTW_STATUS_CODE(ret); -} - int _rtw_writeN(struct adapter *adapter, u32 addr, u32 length, u8 *pdata) { struct io_priv *pio_priv = &adapter->iopriv; diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 128cdb178abc..73f90b21364e 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c @@ -158,12 +158,17 @@ int rtw_write16(struct adapter *adapter, u32 addr, u16 val) return RTW_STATUS_CODE(ret); } -static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) +int rtw_write32(struct adapter *adapter, u32 addr, u32 val) { + struct io_priv *pio_priv = &adapter->iopriv; + struct intf_hdl *pintfhdl = &pio_priv->intf; u16 wvalue = (u16)(addr & 0x0000ffff); __le32 data = cpu_to_le32(val); + int ret; - return usbctrl_vendorreq(pintfhdl, wvalue, &data, 4, REALTEK_USB_VENQT_WRITE); + ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, 4, REALTEK_USB_VENQT_WRITE); + + return RTW_STATUS_CODE(ret); } static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata) @@ -555,7 +560,6 @@ void rtl8188eu_set_intf_ops(struct _io_ops *pops) memset((u8 *)pops, 0, sizeof(struct _io_ops)); pops->_read_port = &usb_read_port; - pops->_write32 = &usb_write32; pops->_writeN = &usb_writeN; pops->_write_port = &usb_write_port; pops->_read_port_cancel = &usb_read_port_cancel; diff --git a/drivers/staging/r8188eu/include/rtw_io.h b/drivers/staging/r8188eu/include/rtw_io.h index 0cb1f626a549..83e2ed13b667 100644 --- a/drivers/staging/r8188eu/include/rtw_io.h +++ b/drivers/staging/r8188eu/include/rtw_io.h @@ -254,7 +254,7 @@ void _rtw_read_port_cancel(struct adapter *adapter); int rtw_write8(struct adapter *adapter, u32 addr, u8 val); int rtw_write16(struct adapter *adapter, u32 addr, u16 val); -int _rtw_write32(struct adapter *adapter, u32 addr, u32 val); +int rtw_write32(struct adapter *adapter, u32 addr, u32 val); int _rtw_writeN(struct adapter *adapter, u32 addr, u32 length, u8 *pdata); int _rtw_write8_async(struct adapter *adapter, u32 addr, u8 val); @@ -271,8 +271,6 @@ void _rtw_write_port_cancel(struct adapter *adapter); _rtw_read_port((adapter), (addr), (cnt), (mem)) #define rtw_read_port_cancel(adapter) _rtw_read_port_cancel((adapter)) -#define rtw_write32(adapter, addr, val) \ - _rtw_write32((adapter), (addr), (val)) #define rtw_writeN(adapter, addr, length, data) \ _rtw_writeN((adapter), (addr), (length), (data)) #define rtw_write8_async(adapter, addr, val) \ -- 2.33.0