From nobody Tue Dec 16 08:39:18 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.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 4D10328D83A for ; Thu, 10 Apr 2025 13:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290390; cv=none; b=OqSU2xAAxH/1by+3N+Y3xxCj7drBek1Ubh7yo6qZWjQArAjqrglgt94xs8TE8mGcr+OKl5yH6C43Yh1QWs/UxAquU1OklQ6LRtS8xgIYerHuwTS2QYAsxqyHB/xbJKuucinnTikRYPRjhlTWBbehe4T8IJvGdQtq3sPe4Sf4Ewo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290390; c=relaxed/simple; bh=cnOuUiTe3Ho5T4fYaHsNPW7c89nIldGijKaXdVhE6n4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NNK4av/tEfoMER3DYBwtLRgcMP/4VITLw/PgCnOtnR4tr8kgUQv1BvLrJELSUBRb46agq/zVHeP2GFGEBEFvpcU+MKfosVDE4dC9DspMr7y6frnNxJ+D+Sl9E0GNPDm/LV6u/kE4+lyYY7j7aqBWbO9do/GWrWL03dfYjKRvqQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mQoBHaao; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mQoBHaao" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-43cf05f0c3eso6015585e9.0 for ; Thu, 10 Apr 2025 06:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744290386; x=1744895186; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3KpF9SfZWwknZK9NjJkeKkgsOEETiClwbvQ0kGUScvk=; b=mQoBHaaod9CbDYChlghlnu0pZpqmrayNpITKewTXioVNp9AaNWV2LjZqCkg7YYTT0w 2sYj4ytT9+BnntwQ/F84dcXjWVWHu9EFb3FmYi63Hypt4yqkhQg7vBTe52v49We5BQF1 4uvwJ5PluLQF6Cbidudd23Ax+xRljutWXfcgpTvr+sr904Q2bBkCDe80JEfkKWU2lvt8 2ir1fWrYa3/npLvNQrZLhQZrEKT1xw1F1JjqBkWgTp69b1M+UTh3FUaJX5ZEM1zN7Nv2 fN6atcc3XOUVs+H0SHxXmG9OH+6afi/07amz9TMMMc8uO5/dYzTro6JJQQruPHoxQOFw uvOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744290386; x=1744895186; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3KpF9SfZWwknZK9NjJkeKkgsOEETiClwbvQ0kGUScvk=; b=EWfVcmHB9Qi6Dwsw4wWFsV4NqbD7ieQdRbv3SHmp9oS5cKqOObDS+zmJkl0o4EUWJH xv4jDGuYwhl6qrYnQ8kijkQgp+vwT5KDw49ddVgSgmnuoOugLrp4QooGQLizjnViFVEB XWYQ9QxtSYGxjuzqNnXllyzwDqYKuxmq+gm3xaJdZOgJVDuhoctjsPPcb6cfPjr/aPR/ z7Vy69xZ/HLc6wxfXlLu0zrx26bmi3XnA84mPTfA9Rzfb/zZDsUdm3AaJ5mp6cC95uz5 eNOdkb1Ch8IlM69MecG29K+r8DoKcfaldrr53mPFcCCTKTf5UGyNxvGl16C+kcaGRytF lEeQ== X-Forwarded-Encrypted: i=1; AJvYcCUxzJr/WmZ0yuYr0Zx3UfooATCSOan50HwU10ZvOz9f1PHmfsLfVvpQJ0/QYD6+UlN1MJ65KC1MuJzqS2I=@vger.kernel.org X-Gm-Message-State: AOJu0YzYqginXsThibs26rF/GvZuyJ0FijgJUJHfNgTguRC2VE3pJNUG icLYkqcUdg40Ipl6s2ktHNQyOp5rpUY9rbRe6h7pSWusBw8nkZk7 X-Gm-Gg: ASbGncul1vvGijqcASTD1qfs+tcjQYbnoDlsiCm+BpK3vdsC4uh7liqWDWnlyU+jtUW Ik70jTrBRdg3grRREfbAmSw3qip3Or47tjbximcyRtVwv1QLx+LqKo5BXUg2M9d/AnCVFGiZIuK jPTQpKPJK8CSA6kx+nZJ4sy0uZcrXP0WL6wtAUyiKz0qCd9FA3A5mfMSiQUfsf+8W88UIYFDBeb SHH6kF7g/t9a15V7RlvQcBALU1bYbO+Ys6uSkCNoW4RoCIENGrkfrNyYUAWoEJOwHKzmU7Rsr3c B6u0s2ObI+UVOI+/5hOdetPOdtyzPtBbVLmbRw== X-Google-Smtp-Source: AGHT+IEXxWXeDdUFKg0JMdVhDar9E3Hqv/jvd/iAbcSOtIAVNlERHeywklQ8I5H/mrccs+8fJdXc+w== X-Received: by 2002:a05:600c:4e14:b0:43d:db5:7af8 with SMTP id 5b1f17b1804b1-43f2ff9af48mr18725805e9.21.1744290386034; Thu, 10 Apr 2025 06:06:26 -0700 (PDT) Received: from pc.. ([197.155.71.138]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f2075fc6dsm55013045e9.28.2025.04.10.06.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 06:06:25 -0700 (PDT) From: Erick Karanja To: gregkh@linuxfoundation.org, outreachy@lists.linux.dev Cc: karanja99erick@gmail.com, philipp.g.hortmann@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] staging: rtl8723bs: Improve code readability in sdio_ops.c Date: Thu, 10 Apr 2025 16:06:06 +0300 Message-ID: <9c8473662caa96a8d312415e9006f74f48098f98.1744285781.git.karanja99erick@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make the code more readable by moving trivial initializations up with the declarations instead of wasting a line on that. Signed-off-by: Erick Karanja --- drivers/staging/rtl8723bs/hal/sdio_ops.c | 59 +++++++----------------- 1 file changed, 17 insertions(+), 42 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl= 8723bs/hal/sdio_ops.c index 8736c124f857..1e03413e242c 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_ops.c +++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c @@ -53,9 +53,8 @@ static void hal_sdio_get_cmd_addr_8723b( static u8 get_deviceid(u32 addr) { u8 devide_id; - u16 pseudo_id; + u16 pseudo_id =3D (u16)(addr >> 16); =20 - pseudo_id =3D (u16)(addr >> 16); switch (pseudo_id) { case 0x1025: devide_id =3D SDIO_LOCAL_DEVICE_ID; @@ -150,7 +149,7 @@ static u16 sdio_read16(struct intf_hdl *intfhdl, u32 ad= dr) =20 static u32 sdio_read32(struct intf_hdl *intfhdl, u32 addr) { - struct adapter *adapter; + struct adapter *adapter =3D intfhdl->padapter; u8 mac_pwr_ctrl_on; u8 device_id; u16 offset; @@ -160,7 +159,6 @@ static u32 sdio_read32(struct intf_hdl *intfhdl, u32 ad= dr) s32 __maybe_unused err; __le32 le_tmp; =20 - adapter =3D intfhdl->padapter; ftaddr =3D _cvrt2ftaddr(addr, &device_id, &offset); =20 rtw_hal_get_hwreg(adapter, HW_VAR_APFM_ON_MAC, &mac_pwr_ctrl_on); @@ -196,16 +194,13 @@ static u32 sdio_read32(struct intf_hdl *intfhdl, u32 = addr) =20 static s32 sdio_readN(struct intf_hdl *intfhdl, u32 addr, u32 cnt, u8 *buf) { - struct adapter *adapter; + struct adapter *adapter =3D intfhdl->padapter; u8 mac_pwr_ctrl_on; u8 device_id; u16 offset; u32 ftaddr; u8 shift; - s32 err; - - adapter =3D intfhdl->padapter; - err =3D 0; + s32 err =3D 0; =20 ftaddr =3D _cvrt2ftaddr(addr, &device_id, &offset); =20 @@ -262,18 +257,15 @@ static s32 sdio_write16(struct intf_hdl *intfhdl, u32= addr, u16 val) =20 static s32 sdio_write32(struct intf_hdl *intfhdl, u32 addr, u32 val) { - struct adapter *adapter; + struct adapter *adapter =3D intfhdl->padapter; u8 mac_pwr_ctrl_on; u8 device_id; u16 offset; u32 ftaddr; u8 shift; - s32 err; + s32 err =3D 0; __le32 le_tmp; =20 - adapter =3D intfhdl->padapter; - err =3D 0; - ftaddr =3D _cvrt2ftaddr(addr, &device_id, &offset); =20 rtw_hal_get_hwreg(adapter, HW_VAR_APFM_ON_MAC, &mac_pwr_ctrl_on); @@ -300,16 +292,13 @@ static s32 sdio_write32(struct intf_hdl *intfhdl, u32= addr, u32 val) =20 static s32 sdio_writeN(struct intf_hdl *intfhdl, u32 addr, u32 cnt, u8 *bu= f) { - struct adapter *adapter; + struct adapter *adapter =3D intfhdl->padapter; u8 mac_pwr_ctrl_on; u8 device_id; u16 offset; u32 ftaddr; u8 shift; - s32 err; - - adapter =3D intfhdl->padapter; - err =3D 0; + s32 err =3D 0; =20 ftaddr =3D _cvrt2ftaddr(addr, &device_id, &offset); =20 @@ -388,13 +377,11 @@ static u32 sdio_read_port( u8 *mem ) { - struct adapter *adapter; - struct sdio_data *psdio; + struct adapter *adapter =3D intfhdl->padapter; + struct sdio_data *psdio =3D &adapter_to_dvobj(adapter)->intf_data; struct hal_com_data *hal; s32 err; =20 - adapter =3D intfhdl->padapter; - psdio =3D &adapter_to_dvobj(adapter)->intf_data; hal =3D GET_HAL_DATA(adapter); =20 hal_sdio_get_cmd_addr_8723b(adapter, addr, hal->SdioRxFIFOCnt++, &addr); @@ -432,14 +419,11 @@ static u32 sdio_write_port( u8 *mem ) { - struct adapter *adapter; - struct sdio_data *psdio; + struct adapter *adapter =3D intfhdl->padapter; + struct sdio_data *psdio =3D &adapter_to_dvobj(adapter)->intf_data; s32 err; struct xmit_buf *xmitbuf =3D (struct xmit_buf *)mem; =20 - adapter =3D intfhdl->padapter; - psdio =3D &adapter_to_dvobj(adapter)->intf_data; - if (!adapter->hw_init_completed) return _FAIL; =20 @@ -487,14 +471,12 @@ static s32 _sdio_local_read( u8 *buf ) { - struct intf_hdl *intfhdl; + struct intf_hdl *intfhdl =3D &adapter->iopriv.intf; u8 mac_pwr_ctrl_on; s32 err; u8 *tmpbuf; u32 n; =20 - intfhdl =3D &adapter->iopriv.intf; - hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); =20 rtw_hal_get_hwreg(adapter, HW_VAR_APFM_ON_MAC, &mac_pwr_ctrl_on); @@ -525,14 +507,12 @@ s32 sdio_local_read( u8 *buf ) { - struct intf_hdl *intfhdl; + struct intf_hdl *intfhdl =3D &adapter->iopriv.intf; u8 mac_pwr_ctrl_on; s32 err; u8 *tmpbuf; u32 n; =20 - intfhdl =3D &adapter->iopriv.intf; - hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); =20 rtw_hal_get_hwreg(adapter, HW_VAR_APFM_ON_MAC, &mac_pwr_ctrl_on); @@ -566,13 +546,11 @@ s32 sdio_local_write( u8 *buf ) { - struct intf_hdl *intfhdl; + struct intf_hdl *intfhdl =3D &adapter->iopriv.intf; u8 mac_pwr_ctrl_on; s32 err; u8 *tmpbuf; =20 - intfhdl =3D &adapter->iopriv.intf; - hal_sdio_get_cmd_addr_8723b(adapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); =20 rtw_hal_get_hwreg(adapter, HW_VAR_APFM_ON_MAC, &mac_pwr_ctrl_on); @@ -839,11 +817,8 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter = *adapter, u32 size) =20 static void sd_rxhandler(struct adapter *adapter, struct recv_buf *recvbuf) { - struct recv_priv *recv_priv; - struct __queue *pending_queue; - - recv_priv =3D &adapter->recvpriv; - pending_queue =3D &recv_priv->recv_buf_pending_queue; + struct recv_priv *recv_priv =3D &adapter->recvpriv; + struct __queue *pending_queue =3D &recv_priv->recv_buf_pending_queue; =20 /* 3 1. enqueue recvbuf */ rtw_enqueue_recvbuf(recvbuf, pending_queue); --=20 2.43.0 From nobody Tue Dec 16 08:39:18 2025 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 632B128C5CB for ; Thu, 10 Apr 2025 13:06:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290401; cv=none; b=E8GHslHek+z98B7wlWqo1WK9znb2n5B3OP65lt/2P+NSMa2Croxa7MnJsonQfEsFMI2sHeM9a+L2uWpSQFqC4H78alPI9ABd1l4Neko0XxGmyBecIXqnEaMzeAqtvw+OAPB+f9V73BVZ8Se7oUkIQA1mVX9NWgWlUV+Lcyhcs50= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290401; c=relaxed/simple; bh=RLvJY6k0Ft/kKNsXLWv6b9OSzSANCOtlQC0MOioBDnE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ux7HCZFdYoEyMi0hCGEEaSM2vPk0lh3dZWp+gbZBU6YCkZ+HpMGc4IfJnnLubZ1Kh0MWoU90Hblr2UK3b9kLPcoYGLfkcRGxme8VZjusbU8VZb7hiFNYXtYlkUvKB+bHkFuMShEfRepdU+w2NwuTMb+loTwDGA4wIqoArwbKWGE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aRhZVwV8; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aRhZVwV8" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-39c1efc457bso440008f8f.2 for ; Thu, 10 Apr 2025 06:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744290398; x=1744895198; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PezLJb+uiQj2Xf3u6GMrlRt9kEp7QeWIW2xH7iXqTd4=; b=aRhZVwV8YnF3hq3sDS4ipInDN8/wU7PL1D4Krv/Yst07/6s6EXmd/E34JSpHkh+9WH sKckArojyZJpy0nNPy/K3ltdJpycsUmZhc42xrnWSYkLYsklwLNq1OtzeLC5Y1LXTzlE xY6u/bG5zAGNmrOypUkAzqtfw7AjUGaZgR2yvwnMSkyTdwi+aK/EVT8KT8U8EvggBdaG vUj2MDHQUjlIPs9YPIbrzW6ZkQb/1wBL+uOSvUpkk3jwy0yuTA5tWdBOezQSH8vyiBnl 2O8Gvw7FBArv6+IK+bKJicAkKVe6susx+ZaxeYCR0gc5tsAvS90Uk2MbCk8g+n2XYAwL On/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744290398; x=1744895198; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PezLJb+uiQj2Xf3u6GMrlRt9kEp7QeWIW2xH7iXqTd4=; b=V7f4u/B4opuA+sCj3EetWxzs00trPZ/ZJ2XLcjf/QyWyMkEi5tphwpVdQm3mvMoSsw eEs3J4jkdmAhXIkeKDIEw+ONI3of93a/ViQxjYmwYG/sLncHdIfKL6Mwc8s/zasf5sCX K1KkUGffUq9SWFhz4LfRqYAbpAwv4+SDbgTTLGtm0cV3FzaFF/UD5385gXdR1JH+4sww RQ4f3wBGiO9+6VzsmRGQPu7Rn1019pd02WGxQUBYe88gVYu6A+CdU/3qvWbrnSi1tItT 5CUWgZiXbnhIniOAk94q2iYw8VDKV0Df5069h7YZ4Epu5oX6YW0Iip61pANNRkWTFVsO VIYg== X-Forwarded-Encrypted: i=1; AJvYcCUFkTNzAMd72t+CLPNNknSrhPL6A3pzqIj3V7GpRglPdkJfogZ3/2Gky63B21tAgFpe93WpYmORQw5DrvE=@vger.kernel.org X-Gm-Message-State: AOJu0YzILIe71lLWAjDLwRUoemYJppts5R7PFcLgXvHJ1YvJ0LdBi6xq tox2rhJoJC2KVlGgh5WxXlVTCJBgKpe2cDpJASLnUI5SjMVqhDC5 X-Gm-Gg: ASbGncsFydyx65rTV2bzs+stODRcsCkjLf09RgXtc02i5r00E3PMDldBw90SlvhyMZ1 rjUU2YaSzabt4BRjx+qG3BRHqis50JYfWKda7bt+empJT+qk5ttnJzuJR1W18rK7eiP8q+mQNgf Y5R7JdUnPB6uoSO1YRTnocCY7yra5alcBmjSNMZXuZl18V0oiof0/nNv/fgrSJpk536Xsag65NW Pr5+WM5IpTYECfGzw3rxLhXncv2ArY52SNujpfOKbTOq9FmFM9wAv77uwvnovgQEKjlTrf0kc02 uoy2gGvDAz0fcI+nsTNzXSoBQwUUIrDiDPwxGA== X-Google-Smtp-Source: AGHT+IEFxQsQgNXoIR59o+LR0OueEaW4XDtVPn2M5POGD1JPeTBqWJbinPc88qOx1zjcpAFrQNdTuA== X-Received: by 2002:a05:6000:240d:b0:38f:3224:65ff with SMTP id ffacd0b85a97d-39d8f46566cmr2497110f8f.5.1744290397361; Thu, 10 Apr 2025 06:06:37 -0700 (PDT) Received: from pc.. ([197.155.71.138]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f2075fc6dsm55013045e9.28.2025.04.10.06.06.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 06:06:36 -0700 (PDT) From: Erick Karanja To: gregkh@linuxfoundation.org, outreachy@lists.linux.dev Cc: karanja99erick@gmail.com, philipp.g.hortmann@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] staging: rtl8723bs: Initialize variables at declaration in odm_HWConfig.c Date: Thu, 10 Apr 2025 16:06:07 +0300 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make the code more concise and readable by integrating the initialization directly into the variable declaration in cases where the initialization is simple and doesn't depend on other variables or complex expressions. Signed-off-by: Erick Karanja --- drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c b/drivers/staging= /rtl8723bs/hal/odm_HWConfig.c index 994b8c578e7a..85cda5c3a5b5 100644 --- a/drivers/staging/rtl8723bs/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8723bs/hal/odm_HWConfig.c @@ -52,9 +52,8 @@ static u8 odm_evm_db_to_percentage(s8 value) /* */ /* -33dB~0dB to 0%~99% */ /* */ - s8 ret_val; + s8 ret_val =3D value; =20 - ret_val =3D value; ret_val /=3D 2; =20 if (ret_val >=3D 0) --=20 2.43.0 From nobody Tue Dec 16 08:39:18 2025 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 58C5F28C5CF for ; Thu, 10 Apr 2025 13:06:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290405; cv=none; b=AfArlkbsgQf8cDGBhNtHS8z+zyCQ+F9MqInjT5Y7j8xBLRdRfYVHHApkxdmxr3Jyak4e+YkaLPiS9wHnmD08KTmpCwoszOxkCrHzt48TH/w3yUs091QC7wE0p94O1Ji7/BaZen+c46y1ymrF07mEHt2n2xBN0ylVW2AiNj+jE/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290405; c=relaxed/simple; bh=pjuWFOSZ1RZNImwMtIT7uEizjyExORnbaw11+N/b+MM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=puVbhJSzFOXgIbECtlVSDTu+YuzXQV8lLKAekCtUPvA+TdZiiY8hBvQkkuQ/AlR4IqqLKL856+Jc8BHWoTs+kPU/NtO61S9ibkIiKh8G3a34gP3Iha02SXEgy+TuRr1wMrEhG2KUB7xk7bFZfTMotA5h4rTkwHwiWi/w3Q1LglA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FK1aqMED; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FK1aqMED" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-43cebe06e9eso6121605e9.3 for ; Thu, 10 Apr 2025 06:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744290401; x=1744895201; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EZ/a/9wOj4qqyc7f8nH0QgnVcQfOjbEe/xaqcp+eVQ4=; b=FK1aqMEDFvKvfAFWlZ6l7y7nfrtWzubuR/1SxUhbCPYRbFfC6AnHw1fQHCXar0+oJE XxWNgG1lCiejr1yH9Awi56h6KJ3ihMRCpGp00LEG2UmyL41sZPHgN50SU4RHWqUYA4W4 5tMb9waMrSL12UW7kK2Vx/hicBeTnxWtEV2nLunXY5BuFkiSzhKGrtzQF1Z2lLEKv2uj MGnR1zYFasVDG0Elgg/4I/F2xTlMCNwka9rG2/A7JvO9jWUAEz6wJBdiue95KtYWe1GK JmNkKUdpjBgXuOETTu4bdICudeVtHNk2FqlrapmdE1JZWzCVQCF4tjP/c8lNA46P2om3 ARjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744290401; x=1744895201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EZ/a/9wOj4qqyc7f8nH0QgnVcQfOjbEe/xaqcp+eVQ4=; b=Al6gymcGkEGgdIuiOXi3sqC9cOGtOZhcDJkdTGmnPdCBX2WRLCbHNAL+Lc6ybPBqPy y8DeAAoHqpbgva2wtfC7cMCG99R1I7frMq4byboZjoFswjOTJDOsjF3J2Z0m1Bd+VR2Z MkNYl9Z0o9wIv9nSioGYqXq1OsZ6fijpqxjGlRLyHqCET7nP34JsJ1+lyB/WmIxDpr8n GqWx19M9eRlrKKIaSo7Lpuo39M8x0Ddgv0sgbYD/FnqnhU6MHgVyoUfTtzcFs2vRRrSY i1bPdIy7jBokBlUiDdQ/kcv5iHsBz5m+Xr0lsg4aAKoh9h7V2ZQIgrxnafJggty9BScr T6zg== X-Forwarded-Encrypted: i=1; AJvYcCWVcou8CEe6X+B1h0yJUtZHKiGwA7/mHDkp6KIaQhb82m0yX74nzQhTt2ynJDXkdm8sqWwuOcbc50aGGAQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw4sSyip7ezt/LyGuT2x+6J51Kc5Fm3OI7gx+BZ0sTLKoezdxQk Qx7u68Thztaj9B8Hh/5vTkT+99m2g68kZd12VjCNQyZLnuAcP3yS X-Gm-Gg: ASbGnctyON+s4xKL1r5oAcrZSngE/QzvWtgK8Mx0ty5cm5toJt7r7HL62U3Igsb2RaQ uL6pvxJjo/KthxDs6/N40ZwcUus94WIxfXNBuP+W+5io7s7qY/BcBaVH3YlO3p4dSUvabUduFtw YLoSEoc/b6dB/2YiT+greF3KJPAlYI0UvFGMHgQ/F7N9c5RmRtkAKzv+T5zA8cJXx37al3QmNXV gPwS672ZmQ5AqgxOW9/HLkp3J1wO8lQuBUqS/V07mHZ1UUwhHTiUIyreQDoiCk3g7cdlbc/9fkO MRGbHTf0Yydv2uTJR3fez9cEDaBSEXrsWB7r5A== X-Google-Smtp-Source: AGHT+IGu0ruWSrChmP0OLx9UlZ42DjEUbur/E5YrIC2D/Fe0LeiIQ9zEr/EDZo2o7CHK6DxF2ClBUA== X-Received: by 2002:a05:600c:384f:b0:43c:ea1a:720a with SMTP id 5b1f17b1804b1-43f2d7af3a5mr27512295e9.1.1744290401177; Thu, 10 Apr 2025 06:06:41 -0700 (PDT) Received: from pc.. ([197.155.71.138]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f2075fc6dsm55013045e9.28.2025.04.10.06.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 06:06:40 -0700 (PDT) From: Erick Karanja To: gregkh@linuxfoundation.org, outreachy@lists.linux.dev Cc: karanja99erick@gmail.com, philipp.g.hortmann@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] staging: rtl8723bs: Initialize variables at declaration in hal_com.c Date: Thu, 10 Apr 2025 16:06:08 +0300 Message-ID: <4e40575a308a7fc4ee0d25923097fc915a2ee849.1744285781.git.karanja99erick@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make the code more concise and readable by integrating the initialization directly into the variable declaration in cases where the initialization is simple and doesn't depend on other variables or complex expressions. Signed-off-by: Erick Karanja --- drivers/staging/rtl8723bs/hal/hal_com.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8= 723bs/hal/hal_com.c index 1213a91cffff..7f4dbd5c5d33 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -745,12 +745,10 @@ u8 GetHalDefVar( switch (variable) { case HAL_DEF_UNDERCORATEDSMOOTHEDPWDB: { - struct mlme_priv *pmlmepriv; - struct sta_priv *pstapriv; + struct mlme_priv *pmlmepriv =3D &adapter->mlmepriv; + struct sta_priv *pstapriv =3D &adapter->stapriv; struct sta_info *psta; =20 - pmlmepriv =3D &adapter->mlmepriv; - pstapriv =3D &adapter->stapriv; psta =3D rtw_get_stainfo(pstapriv, pmlmepriv->cur_network.network.mac_a= ddress); if (psta) *((int *)value) =3D psta->rssi_stat.UndecoratedSmoothedPWDB; --=20 2.43.0 From nobody Tue Dec 16 08:39:18 2025 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 C616528C5BB for ; Thu, 10 Apr 2025 13:06:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290408; cv=none; b=Cz5sOxqLRL9EkHyo3GFVH1qK3MUsM/oeGX6S4Le2mijmUz0XGwaK8jUHX2Q8jj+oi2Hx9k3z5mXjUWsWeWNsqJiw+9uZsp5IgAZYX6P7XZcu/V4ED7cY09TrqGEqdmj3gxJHgwzbWvOXSXLzAa7Tb6bygUP/IdkEot/WDrhSlGY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290408; c=relaxed/simple; bh=kHgNB5nPT3+1wDW0Eoz6Kq84hg9zCpDrlYGgyCDJ3KU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RpMlKj24OYfHbqShugrtXEWaU+tZFDdiKxMk3EG2PXyucrHKHU0Om5LpIjPCTmTxrINVJm5UJiZAykvIlkJTV+pG/fw2Wl6bxYw6PwGuGz9YrlE5id9bNUDRJiATysb0u0laqdhi1kMfqPU7btcThUHLgTNb/OOYteDB0et7O2Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VdtU8Ej/; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VdtU8Ej/" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-43690d4605dso6475665e9.0 for ; Thu, 10 Apr 2025 06:06:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744290405; x=1744895205; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xuhP725w1oGaI5ekaGtjNwebtNvqySCoCtAnGKOGveQ=; b=VdtU8Ej/HYBIyRCNJtgWB8crT0gjPhSG6QfXjha/Ie+KodLRtyvMZwh3sRGCduMpIX 8cClzXqU33HOovr6EDLqLqTpwJ/eMZSE+5en6bKVZp4lo6Q21AiwrC3vGuF1qtcpwYzv UKbjMhZ8i3OB/xqjobJwTaIY+bNlNNZ+O8ZBgkI8uuuzGHRAsMGtGKGRdlvps8O0LV6+ 7qWbzuRRzPJuIIDkHOa2/dowjcvkabAOAYRddwifp8ZRg3L+5WKU87aEX5N1KCD3ufPY 4KKwLsHQUh69Ky6J7VIVSoP3ZWgU6y+faHrHPI+wZWySBGB7vOwK/uJwpdNyT9ITsD8E d73A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744290405; x=1744895205; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xuhP725w1oGaI5ekaGtjNwebtNvqySCoCtAnGKOGveQ=; b=XWC9Zz6Cnaojp1U+Z5/Wz8+u/Ur93YXtkbe6Las0Lv6QSneroFSP6LR7vo/cegFNB2 qoBF66kGiE5FaPD15qWXF/E+eJGuNl5uQvellIR3QQprXomzy4Sme374B+JyZ5GSNjol lZ0FaK9Y6zJULdvsd//G0lTMPtWrNf8SL9tvRZ1Bp0NaMJJFxq2xSha6D1Or95PoP/Kq ZEuH/mWLPySiOL4wx33BPPzcSyLyBBtvDkpxVa51tGBQaJbiCEv9G1PbZxyVePRxAyDN LsO+P4bDgaIaUrWf1yN8yeNSc9p+xCdupIIa0oxAgmIvwtC8RJMs4tNxPvEf83Zpp/GG uAEA== X-Forwarded-Encrypted: i=1; AJvYcCXh+oqYep1VsMY7zJtMhE2JcSkSe1yzlpsKVWL30qHZgkguz0/2XtTD7ugw9z0Hae8y/a+TbDsNDMPlSIk=@vger.kernel.org X-Gm-Message-State: AOJu0YzGh/Zm3ekhA6siTOzGRtrPw0qq1f4M1YRUxHk5WPxRT5kYEKAc 8C3Kw6fetFsO5xPdkrrOw9PmBCKKPgL/ldChuOfCcClyGmhHP9LU X-Gm-Gg: ASbGnctut/z1z8mTBkXZuU1YRXXFRSBUNzkWXf4l3Hb/nT6rWajg+J7ZqVPTMVMOUFs Igg634FqqecfjHqTSo3Etc5jkiom/+w1vekQiT1/c4mpHtw1quf3mkDOw3DI1MlzflRKCm+kONQ f4+KGaQ7pkiXapji3eWBtSZWNSpu40/Hc/AJ2NZyODy3dBgkspEPCR3cz0yik4gPSiLye86RCQ/ gMxq2HuDkpyXVYVPdPROBhG+Gi2QuvkLlXkfJhYOrhPX+0mT6bC90RsOtL6BoBzmOWk5wekX+gQ tII9YxHqbe4nY139e5h/MF7W55JFWZ87Ub+PPg== X-Google-Smtp-Source: AGHT+IFV+X8eGPGvO60BeRP9k7sTmXuetERMG8d4vBQlZCejW0/yD/+PGC6Wz392dpKJgECF49JzLg== X-Received: by 2002:a05:600c:674a:b0:43c:eeee:b70a with SMTP id 5b1f17b1804b1-43f2d97bc34mr26058215e9.22.1744290405003; Thu, 10 Apr 2025 06:06:45 -0700 (PDT) Received: from pc.. ([197.155.71.138]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f2075fc6dsm55013045e9.28.2025.04.10.06.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 06:06:44 -0700 (PDT) From: Erick Karanja To: gregkh@linuxfoundation.org, outreachy@lists.linux.dev Cc: karanja99erick@gmail.com, philipp.g.hortmann@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] staging: rtl8723bs: Initialize variables at declaration in sdio_halinit.c Date: Thu, 10 Apr 2025 16:06:09 +0300 Message-ID: <82af6a6042e359c4ab9c2fdbb68cc238f43be857.1744285781.git.karanja99erick@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make the code more concise and readable by integrating the initialization directly into the variable declaration in cases where the initialization is simple and doesn't depend on other variables or complex expressions. Signed-off-by: Erick Karanja --- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging= /rtl8723bs/hal/sdio_halinit.c index af9a2b068796..cfc4cace6bb9 100644 --- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c +++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c @@ -453,11 +453,8 @@ static void _InitRetryFunction(struct adapter *padapte= r) =20 static void HalRxAggr8723BSdio(struct adapter *padapter) { - u8 valueDMATimeout; - u8 valueDMAPageCount; - - valueDMATimeout =3D 0x06; - valueDMAPageCount =3D 0x06; + u8 valueDMATimeout =3D 0x06; + u8 valueDMAPageCount =3D 0x06; =20 rtw_write8(padapter, REG_RXDMA_AGG_PG_TH + 1, valueDMATimeout); rtw_write8(padapter, REG_RXDMA_AGG_PG_TH, valueDMAPageCount); @@ -498,11 +495,9 @@ static void _initSdioAggregationSetting(struct adapter= *padapter) =20 static void _InitOperationMode(struct adapter *padapter) { - struct mlme_ext_priv *pmlmeext; + struct mlme_ext_priv *pmlmeext =3D &padapter->mlmeextpriv; u8 regBwOpMode =3D 0; =20 - pmlmeext =3D &padapter->mlmeextpriv; - /* 1 This part need to modified according to the rate set we filtered!! */ /* */ /* Set RRSR, RATR, and REG_BWOPMODE registers */ --=20 2.43.0 From nobody Tue Dec 16 08:39:18 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.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 BFB0A28A416 for ; Thu, 10 Apr 2025 13:06:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290418; cv=none; b=SU/3d9quyDF3crMmsvO0vh8el8qDcGbxeZU4UtKVMTQgEAyutnH3oxspN2t1je9kOzA5jPuGkSmNHyrq4CU+rmAkwgn0P+DLnzXmA2/rmE+DYhGsXqpn4SnC3zTtfVhO1SE3uHCNj6i6VbOwGHPvCAvKvZxDZ6a6yZ/rex4Jo/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290418; c=relaxed/simple; bh=VQttRYk06QeNSdaixcvW75tIFIHyV7qGhkk7znS/CnU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MGQQ8h63fAMkrJP/49nnkVKJkLQNQKlXt45k8t2/uzYVKZJ2qJXId+b2vajzzIHGsQVKmNZKHorfNpUcYaiDCgZLNdsL+8KAIm2IxjpkiXFHs22ZACcsCZ1uPvDDoUsmW1BEIjRGOHUtMgu3YwNTvWZuQvl5pW0PJfx1F2Bmd8c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RPpFm7lY; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RPpFm7lY" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-43cf628cb14so13269075e9.1 for ; Thu, 10 Apr 2025 06:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744290414; x=1744895214; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0CfpqZfR6A02wrSENtQAj4aEGC4bV9WD+ngWaFTJ9KI=; b=RPpFm7lYj8Oi6z6zGOsvDsZYshUNZFHEEzia7v1fK2NzYrpcvoRlPdM3fRbqpe9I9d 4cMjiTURvxUu1Eg5tccdkmhJQWfjVZhA0vPoWrmxzzbZP162piRxznkpkMW5RGDphiHA JXe/igMWRkBPqvP3zF2NFI1AHFRdBkDEOns+jmdUvTFt2SuoXoD8QmnfyYkKDNLiuzjW CjteCCnq+BE2f4KlEmNpvG/dY+HChfT7LHxxN9eV9W1JcyWonGTo5SGkigPZ9dDDYhpu 7jz+BKmo5z0Q3A6TsSGurcYMdEZP46t7ULPLrb+PHzUP62ZAI3WlUrQZlLtQX9kpoBye ifQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744290414; x=1744895214; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0CfpqZfR6A02wrSENtQAj4aEGC4bV9WD+ngWaFTJ9KI=; b=qcxAtyZckhhXO9aj6WK49Bj2O0SgnCzX8ANIsILyjyyznnAWTTOeXPzs8AC2G9S4nk dqHhYBPI5cluPQs08PInaqrMGc1naRBhr4DXRWlO2mw67K40yW8RGGDytknA6aEBHXZy dU5144ZgbCVt3drcRAdH2LDSjPym22MypySiU9kI0FmmhL6qmiqdB7dEXS9zM32Grh8Y yHzSqRJnkwyo3kTvJvxlDZPPnD9XtFbr3k6vJglkAcO9IUKC5zNve3q7HrtMFjj3Jd3P 0dNrrjYG1xvasBF5PvHCpszXo2bNmkAm4z0OOAdRkOItFtXQama1bdxKDSF7GQmvhyKS +AWg== X-Forwarded-Encrypted: i=1; AJvYcCUDvhvQ40dyOmnQ5Wm+cFu1UJhS+i2kxHrd3bBojSRpsSBBi5qBRzlcMfcRPIhXwZxQY2npw/xhmwhCApQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwyvolubpzsMULImd9kR1iJP654n2ob9RXwE5c+EluuqDVWEKT5 J+Q0g8Uq9jEMx55VmxcBC8qyBfVqraoLw1V69Tl3I/z8q+MGYeZU X-Gm-Gg: ASbGncvdfCYuNIC9wt7g3lOOYrJR3Mhxk3u+AvWCMKDec0JkIAl+0L8dYCV/XdX2vBQ Bh+8AGwNlSTOMjqR3pb4+SbPpV7Eeqwaf57NkAjzGH1vVuS4d3mb6VDIASrk0bjr2vbemJyYejI nlZktenR65uBDt9xLpqxpbuSVpOiKwruHdwqvCpZTSVZB/5VHLNn/9TL4NsR9T3DHGhHrMN+BGJ vDrE/J7vk1aYzw0HfmPiD1m0lZayz8HeamdLR7lDHUgdjz/d4npr988LOh3Y/st7fMNrXN+305Q fr7qEXgzVVJ8xxi3YgXHjQPU8s44NsNcgjShDQ== X-Google-Smtp-Source: AGHT+IFY3Pun8EqtRMDa2wxLsxLrjnH81SPKup6hFWWMfsvZiMwFXtrIpt5JoTGjSsXV58WmNvts8w== X-Received: by 2002:a05:600c:34c2:b0:439:4b23:9e8e with SMTP id 5b1f17b1804b1-43f2efe1e4dmr25903935e9.3.1744290412068; Thu, 10 Apr 2025 06:06:52 -0700 (PDT) Received: from pc.. ([197.155.71.138]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f2075fc6dsm55013045e9.28.2025.04.10.06.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 06:06:51 -0700 (PDT) From: Erick Karanja To: gregkh@linuxfoundation.org, outreachy@lists.linux.dev Cc: karanja99erick@gmail.com, philipp.g.hortmann@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] staging: rtl8723bs: Initialize variables at declaration in hal_btcoex.c Date: Thu, 10 Apr 2025 16:06:10 +0300 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make the code more concise and readable by integrating the initialization directly into the variable declaration in cases where the initialization is simple and doesn't depend on other variables or complex expressions. Signed-off-by: Erick Karanja --- drivers/staging/rtl8723bs/hal/hal_btcoex.c | 174 ++++++--------------- 1 file changed, 45 insertions(+), 129 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/r= tl8723bs/hal/hal_btcoex.c index 9105594d2dde..b29c6cdf2e21 100644 --- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c +++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c @@ -28,10 +28,7 @@ static u8 halbtcoutsrc_IsBtCoexistAvailable(struct btc_c= oexist *pBtCoexist) =20 static void halbtcoutsrc_LeaveLps(struct btc_coexist *pBtCoexist) { - struct adapter *padapter; - - - padapter =3D pBtCoexist->Adapter; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 pBtCoexist->btInfo.bBtCtrlLps =3D true; pBtCoexist->btInfo.bBtLpsOn =3D false; @@ -41,10 +38,7 @@ static void halbtcoutsrc_LeaveLps(struct btc_coexist *pB= tCoexist) =20 static void halbtcoutsrc_EnterLps(struct btc_coexist *pBtCoexist) { - struct adapter *padapter; - - - padapter =3D pBtCoexist->Adapter; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 pBtCoexist->btInfo.bBtCtrlLps =3D true; pBtCoexist->btInfo.bBtLpsOn =3D true; @@ -54,9 +48,7 @@ static void halbtcoutsrc_EnterLps(struct btc_coexist *pBt= Coexist) =20 static void halbtcoutsrc_NormalLps(struct btc_coexist *pBtCoexist) { - struct adapter *padapter; - - padapter =3D pBtCoexist->Adapter; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 if (pBtCoexist->btInfo.bBtCtrlLps) { pBtCoexist->btInfo.bBtLpsOn =3D false; @@ -73,15 +65,13 @@ static void halbtcoutsrc_NormalLps(struct btc_coexist *= pBtCoexist) */ static void halbtcoutsrc_LeaveLowPower(struct btc_coexist *pBtCoexist) { - struct adapter *padapter; - s32 ready; + struct adapter *padapter =3D pBtCoexist->Adapter; + s32 ready =3D _FAIL; unsigned long stime; unsigned long utime; u32 timeout; /* unit: ms */ =20 =20 - padapter =3D pBtCoexist->Adapter; - ready =3D _FAIL; #ifdef LPS_RPWM_WAIT_MS timeout =3D LPS_RPWM_WAIT_MS; #else /* !LPS_RPWM_WAIT_MS */ @@ -108,10 +98,9 @@ static void halbtcoutsrc_LeaveLowPower(struct btc_coexi= st *pBtCoexist) */ static void halbtcoutsrc_NormalLowPower(struct btc_coexist *pBtCoexist) { - struct adapter *padapter; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 =20 - padapter =3D pBtCoexist->Adapter; rtw_unregister_task_alive(padapter, BTCOEX_ALIVE); } =20 @@ -126,12 +115,8 @@ static void halbtcoutsrc_DisableLowPower(struct btc_co= exist *pBtCoexist, u8 bLow =20 static void halbtcoutsrc_AggregationCheck(struct btc_coexist *pBtCoexist) { - struct adapter *padapter; - bool bNeedToAct; - - - padapter =3D pBtCoexist->Adapter; - bNeedToAct =3D false; + struct adapter *padapter =3D pBtCoexist->Adapter; + bool bNeedToAct =3D false; =20 if (pBtCoexist->btInfo.bRejectAggPkt) { rtw_btcoex_RejectApAggregatedPacket(padapter, true); @@ -176,14 +161,9 @@ static u8 halbtcoutsrc_IsWifiBusy(struct adapter *pada= pter) =20 static u32 _halbtcoutsrc_GetWifiLinkStatus(struct adapter *padapter) { - struct mlme_priv *pmlmepriv; - u8 bp2p; - u32 portConnectedStatus; - - - pmlmepriv =3D &padapter->mlmepriv; - bp2p =3D false; - portConnectedStatus =3D 0; + struct mlme_priv *pmlmepriv =3D &padapter->mlmepriv; + u8 bp2p =3D false; + u32 portConnectedStatus =3D 0; =20 if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE) =3D=3D true) { if (check_fwstate(pmlmepriv, WIFI_AP_STATE) =3D=3D true) { @@ -210,14 +190,9 @@ static u32 halbtcoutsrc_GetWifiLinkStatus(struct btc_c= oexist *pBtCoexist) /* [15:0]=3D> port connected bit define */ /* */ =20 - struct adapter *padapter; + struct adapter *padapter =3D pBtCoexist->Adapter; u32 retVal; - u32 portConnectedStatus, numOfConnectedPort; - - - padapter =3D pBtCoexist->Adapter; - portConnectedStatus =3D 0; - numOfConnectedPort =3D 0; + u32 portConnectedStatus =3D 0, numOfConnectedPort =3D 0; =20 retVal =3D _halbtcoutsrc_GetWifiLinkStatus(padapter); if (retVal) { @@ -244,11 +219,9 @@ static s32 halbtcoutsrc_GetWifiRssi(struct adapter *pa= dapter) =20 static u8 halbtcoutsrc_GetWifiScanAPNum(struct adapter *padapter) { - struct mlme_ext_priv *pmlmeext; + struct mlme_ext_priv *pmlmeext =3D &padapter->mlmeextpriv; static u8 scan_AP_num; =20 - pmlmeext =3D &padapter->mlmeextpriv; - if (!GLBtcWiFiInScanState) { if (pmlmeext->sitesurvey_res.bss_cnt > 0xFF) scan_AP_num =3D 0xFF; @@ -363,8 +336,7 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getTyp= e, void *pOutBuf) =20 case BTC_GET_U4_WIFI_TRAFFIC_DIRECTION: { - struct rt_link_detect_t *plinkinfo; - plinkinfo =3D &padapter->mlmepriv.LinkDetectInfo; + struct rt_link_detect_t *plinkinfo =3D &padapter->mlmepriv.LinkDetectIn= fo; =20 if (plinkinfo->NumTxOkInPeriod > plinkinfo->NumRxOkInPeriod) *pU4Tmp =3D BTC_WIFI_TRAFFIC_TX; @@ -425,16 +397,13 @@ static u8 halbtcoutsrc_Get(void *pBtcContext, u8 getT= ype, void *pOutBuf) =20 static u8 halbtcoutsrc_Set(void *pBtcContext, u8 setType, void *pInBuf) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - u8 *pu8; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; + u8 *pu8 =3D pInBuf; u32 *pU4Tmp; u8 ret; =20 =20 - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; - pu8 =3D pInBuf; pU4Tmp =3D pInBuf; ret =3D true; =20 @@ -565,65 +534,43 @@ static u8 halbtcoutsrc_Set(void *pBtcContext, u8 setT= ype, void *pInBuf) /* */ static u8 halbtcoutsrc_Read1Byte(void *pBtcContext, u32 RegAddr) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 return rtw_read8(padapter, RegAddr); } =20 static u16 halbtcoutsrc_Read2Byte(void *pBtcContext, u32 RegAddr) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 return rtw_read16(padapter, RegAddr); } =20 static u32 halbtcoutsrc_Read4Byte(void *pBtcContext, u32 RegAddr) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 return rtw_read32(padapter, RegAddr); } =20 static void halbtcoutsrc_Write1Byte(void *pBtcContext, u32 RegAddr, u8 Dat= a) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 rtw_write8(padapter, RegAddr, Data); } =20 static void halbtcoutsrc_BitMaskWrite1Byte(void *pBtcContext, u32 regAddr,= u8 bitMask, u8 data1b) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - u8 originalValue, bitShift; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; + u8 originalValue =3D 0, bitShift =3D 0; u8 i; =20 - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; - originalValue =3D 0; - bitShift =3D 0; - if (bitMask !=3D 0xFF) { originalValue =3D rtw_read8(padapter, regAddr); =20 @@ -641,24 +588,16 @@ static void halbtcoutsrc_BitMaskWrite1Byte(void *pBtc= Context, u32 regAddr, u8 bi =20 static void halbtcoutsrc_Write2Byte(void *pBtcContext, u32 RegAddr, u16 Da= ta) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 rtw_write16(padapter, RegAddr, Data); } =20 static void halbtcoutsrc_Write4Byte(void *pBtcContext, u32 RegAddr, u32 Da= ta) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 rtw_write32(padapter, RegAddr, Data); } @@ -676,12 +615,8 @@ static void halbtcoutsrc_WriteLocalReg1Byte(void *pBtc= Context, u32 RegAddr, u8 D =20 static void halbtcoutsrc_SetBbReg(void *pBtcContext, u32 RegAddr, u32 BitM= ask, u32 Data) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 PHY_SetBBReg(padapter, RegAddr, BitMask, Data); } @@ -689,44 +624,32 @@ static void halbtcoutsrc_SetBbReg(void *pBtcContext, = u32 RegAddr, u32 BitMask, u =20 static u32 halbtcoutsrc_GetBbReg(void *pBtcContext, u32 RegAddr, u32 BitMa= sk) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 return PHY_QueryBBReg(padapter, RegAddr, BitMask); } =20 static void halbtcoutsrc_SetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAd= dr, u32 BitMask, u32 Data) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 PHY_SetRFReg(padapter, eRFPath, RegAddr, BitMask, Data); } =20 static u32 halbtcoutsrc_GetRfReg(void *pBtcContext, u8 eRFPath, u32 RegAdd= r, u32 BitMask) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 return PHY_QueryRFReg(padapter, eRFPath, RegAddr, BitMask); } =20 static void halbtcoutsrc_SetBtReg(void *pBtcContext, u8 RegType, u32 RegAd= dr, u32 Data) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; u8 CmdBuffer1[4] =3D {0}; u8 CmdBuffer2[4] =3D {0}; u8 *AddrToSet =3D (u8 *)&RegAddr; @@ -734,9 +657,6 @@ static void halbtcoutsrc_SetBtReg(void *pBtcContext, u8= RegType, u32 RegAddr, u3 u8 OperVer =3D 0; u8 ReqNum =3D 0; =20 - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; - CmdBuffer1[0] |=3D (OperVer & 0x0f); /* Set OperVer */ CmdBuffer1[0] |=3D ((ReqNum << 4) & 0xf0); /* Set ReqNum */ CmdBuffer1[1] =3D 0x0d; /* Set OpCode to BT_LO_OP_WRITE_REG_VALUE= */ @@ -761,12 +681,8 @@ static u32 halbtcoutsrc_GetBtReg(void *pBtcContext, u8= RegType, u32 RegAddr) =20 static void halbtcoutsrc_FillH2cCmd(void *pBtcContext, u8 elementId, u32 c= mdLen, u8 *pCmdBuffer) { - struct btc_coexist *pBtCoexist; - struct adapter *padapter; - - - pBtCoexist =3D (struct btc_coexist *)pBtcContext; - padapter =3D pBtCoexist->Adapter; + struct btc_coexist *pBtCoexist =3D (struct btc_coexist *)pBtcContext; + struct adapter *padapter =3D pBtCoexist->Adapter; =20 rtw_hal_fill_h2c_cmd(padapter, elementId, cmdLen, pCmdBuffer); } --=20 2.43.0 From nobody Tue Dec 16 08:39:18 2025 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 753C528CF55 for ; Thu, 10 Apr 2025 13:07:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290427; cv=none; b=g++vvdpwDz9J/fKT4tSCuGziApeuUGmgEVueGNKl/DzuBRRvqtt/+yNs6Vdjoj8P8NZaF4lGZOxnstke2uYYvi/OAatK6HMwedLQL58mwsfCo4QhmsYMxFb+Ovsoo2gf76xDLXUToJii2lL21PWj1TId6tWl3ohlmlnfa0Zmi5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744290427; c=relaxed/simple; bh=gD/ivy8TozAfZl09YY5BEmq3r9BlB+mpS1btyHwFBW0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RpKzymdxfTvmvX77uSM5PurzYB51D3Q8v97loDni446svYsDf0TYtWyjgAY4xFvOk7s+8r5Q9ed5q+ZEeW6R5dGcrwPUcnxfltoA2hSrTm0MuqPOc1GcxnTvOtW+fybR1BxDkS7bx1cx4wWcklo+/+y5ejtUC+Wx/d+FVuxECE4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=b79puNDR; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b79puNDR" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3914bc3e01aso384845f8f.2 for ; Thu, 10 Apr 2025 06:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1744290424; x=1744895224; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Xb4/K9i3KehiCtF/Usls0i0omViTubWO0lqe6s2Xk6Q=; b=b79puNDRKJy/NtWm7YHTzhyxI/TXMHd2I4l/Dz45ReWqPZwDVpKGTeEyJCvQ6RgRvU cAn6cmuazbpXTMtzN9nt1oM4fswtbCOdFWVZzPBeSTrPP99PZawOnKSsJ0/lyz5O2mkg XzhN47AlYEzFGdwTndFWhtpeZMWkumeucSmVcvfZa9YG1txSXn0o0GWW+RlpusvuwiuL LYuqq8eyrlQu/FI+cnKoViRc9h+1C2fNIW6BT2wcPH4r13R1yUmdHzVT0zPNIKozhear +X0F9H6h86+mllBdyN1bjIT7NrtTKp+8TXkPnUp8yflxs81mG9StxdDeNkaNkZSXzz9g kKyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744290424; x=1744895224; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xb4/K9i3KehiCtF/Usls0i0omViTubWO0lqe6s2Xk6Q=; b=gIiYYJc9xuGjlGGikySDT5JfAw9IevIVk60bw4X/lnnJUWPOP7Nwdz4pyvwrlKVy8f c1C/ZdCBdkncnVtNXE5Iu21iRHWXCC5IZHZ4R6Phpq/ElW5UEJNmRaqNAe5+jlsaIfG1 anCgQTW9jgm5Ko60OqGUXqMBgT57b0XcN0vGb51pQ1yaQH4+p1R4wj+5fb8XGxgydMqV xcYx20ddG27rJsamHOS4iF8RJzwXX9qt0y4C1aN3TUhfJ/Fu0UGtWEiDUKZJa3jOxf9T 41NTplu2S05IPgDk5wR10Tt0evlJorq7Qt9FKB0f7tDSKq0B4lf3AK6DtQtRdfbo53Mq /EYA== X-Forwarded-Encrypted: i=1; AJvYcCXzPgpkuXiXMnbEVVsTLq6G51w071YVzblpWlG0Kap6Sfwnq6o1T8/xzfPsUhQovsI6D5jGqkDiQAHg/hw=@vger.kernel.org X-Gm-Message-State: AOJu0YxXMRLmHQ1JcY+LFrjg6JuyDSSb6dGXT3mQRoGOP+vVOTQuNLqk 4TVQiU7jcA4uqNsJApVyszPNkXN8w+BT6RLxzgSFT45BZ0pFgteH X-Gm-Gg: ASbGncu76fKRa25N4P0mVzAq91MGqCIz1IxZQcEm4H7cMhaS5YB8+vviNSy0SdQOVZM 9shDkisCfU6KNs+/dYQCSo/r4cLXYhrr3qY2mNKZEKzcf1990Iv4DhWWRFInXDEnc8tS2Z1ydzq nZU7mBUJamXkDiKdZvREmYuW0rNQS+w67h9RW5uqnj2ay4jtCGf40yKYIlqQhZvE3KQ/90xYoNp rLRLLlFhsGGLIxFhLK83EUXK1Bhwsg/nKBHELssKPRnw7hMALDoeti9mzGFtiU5o9QK1poeoJbt hHwZ7YSgl6SNKXrqp+CEpWDzoaeAGTdLQRo2Gg== X-Google-Smtp-Source: AGHT+IHJXFAWfo5VZ1vG/fakJyccgk0mpHMtlCd905bv/mlWMdNr7tRkIyIJsjHbOLe4gopOeRo1JQ== X-Received: by 2002:a5d:5f4f:0:b0:390:eebc:6f32 with SMTP id ffacd0b85a97d-39d8fda7660mr2252641f8f.48.1744290423424; Thu, 10 Apr 2025 06:07:03 -0700 (PDT) Received: from pc.. ([197.155.71.138]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43f2075fc6dsm55013045e9.28.2025.04.10.06.06.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Apr 2025 06:07:02 -0700 (PDT) From: Erick Karanja To: gregkh@linuxfoundation.org, outreachy@lists.linux.dev Cc: karanja99erick@gmail.com, philipp.g.hortmann@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 6/6] staging: rtl8723bs: Initialize variables at declaration in rtl8723bs_recv.c Date: Thu, 10 Apr 2025 16:06:11 +0300 Message-ID: <6acc4efa84d38f5da7cb718d383664832bfb0370.1744285781.git.karanja99erick@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Make the code more concise and readable by integrating the initialization directly into the variable declaration in cases where the initialization is simple and doesn't depend on other variables or complex expressions. Signed-off-by: Erick Karanja --- drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c b/drivers/stagi= ng/rtl8723bs/hal/rtl8723bs_recv.c index 28c914ec2604..8d0d8e8e837e 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c @@ -367,14 +367,11 @@ static void rtl8723bs_recv_tasklet(struct tasklet_str= uct *t) */ s32 rtl8723bs_init_recv_priv(struct adapter *padapter) { - s32 res; + s32 res =3D _SUCCESS; u32 i, n; - struct recv_priv *precvpriv; + struct recv_priv *precvpriv =3D &padapter->recvpriv; struct recv_buf *precvbuf; =20 - res =3D _SUCCESS; - precvpriv =3D &padapter->recvpriv; - /* 3 1. init recv buffer */ INIT_LIST_HEAD(&precvpriv->free_recv_buf_queue.queue); spin_lock_init(&precvpriv->free_recv_buf_queue.lock); @@ -453,11 +450,9 @@ s32 rtl8723bs_init_recv_priv(struct adapter *padapter) void rtl8723bs_free_recv_priv(struct adapter *padapter) { u32 i; - struct recv_priv *precvpriv; + struct recv_priv *precvpriv =3D &padapter->recvpriv; struct recv_buf *precvbuf; =20 - precvpriv =3D &padapter->recvpriv; - /* 3 1. kill tasklet */ tasklet_kill(&precvpriv->recv_tasklet); =20 --=20 2.43.0