Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3697319ybp; Sun, 13 Oct 2019 12:11:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjKPu3DXJXorDxoDNtnMEwXm4UzoNVRp2o87GL+49nVe02i71LzTn7791lBT5lUm1IVHJA X-Received: by 2002:a17:906:48d4:: with SMTP id d20mr20370593ejt.246.1570993882214; Sun, 13 Oct 2019 12:11:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570993882; cv=none; d=google.com; s=arc-20160816; b=DqDcQdxO0/MRhTs1L08x/9SoY1gep0fCjGiC0TgRHCb0JDualz2h26/eypI33SrxkO JsSuay9N/vLDgSVQl/sEMCjwsnsUBrOoJDr71GuaBHKXnEA2x35074IKu4aVWx64sHSg ov+315qB6mc069XEg+k0yN2wHowaKoJ+lCl3tdmn2lp6xVKrco/JKclEKpsNvqKh0lx1 52BX8zaaEd1vIxRsPLUYWvshK+u8t0uEWRz4QgWgy6AzpkcWNWN0Kn3h48Etr2Wuij6I zzxHpVRkVKznevXU/FDNTyj6frGx/v/TPJmaF61TQlPQ6NqEXCQIr25Br01DCQHYMMpq R66w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=b80mjczMKdynxDiqihftIRC/nvOfe2fufAmH1zUWecg=; b=V5ShWqhmroWQSRahUDRU9qQ4I+HMHXv2f3t54zbTCoRfSrtRtjdc7JFy8UY/CrGWXZ S9+cS/8yLNG5j5vv3cIuutVszMl8cRFwVSjBx+++ZSW9r/vn0Rewrmxd7zrnGdMf+vOp tZFUUYzv8tRcTOGWK4IhmO/SzN3kGP2ghLdl2VXEcpCkiuqRGWO61xx3hOB1inyF7QIH Y051cTMO5aIwGUU0UZyJxk+Ix8REwU0CI4tpvfRZ22ZVbakGy92nkCLSGVMTXU3oj8vk n4O2WAQpsZKeQiAjLBJ4ZLmiOQ8DjJRbRDySJ1r774NvbigW1dxGlw73/ET3YHaKx6cJ +FSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Rnt3TaLC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ca9si10114707edb.79.2019.10.13.12.10.58; Sun, 13 Oct 2019 12:11:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Rnt3TaLC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729495AbfJMTKr (ORCPT + 99 others); Sun, 13 Oct 2019 15:10:47 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37183 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729335AbfJMTKr (ORCPT ); Sun, 13 Oct 2019 15:10:47 -0400 Received: by mail-pg1-f193.google.com with SMTP id p1so8774853pgi.4 for ; Sun, 13 Oct 2019 12:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=b80mjczMKdynxDiqihftIRC/nvOfe2fufAmH1zUWecg=; b=Rnt3TaLC3t5HfsHxd7aOpUWt1ltyyk0x1kQ4RXg7fRL316JzXDZRbp2fDirHoNbT+p TkG0KrYAXKYZNnszzkD7/wFIkEvaGtbd6sfhQ9e1SXbZgrRjSeI1ZAOdRbbwp9vIhfgU iCEGzzxe/taIIbL0bD56GdvxKmVDDlcE1Vnjet4RvBSzT7GlQ3a+GswEBA7O057MD433 sZzmLWGxZq9bfq5CEi4K3+GMVHY/tdb7BA11kXrydINEflM9jUm+rQRyrwdTux7LKIgh h/gqD6dw+6LHAe+ajJrvsqNJBYbke0Zs0T56BFwmnZGs7Hz0ldSo7y/uJhwQpGC8aFmR 0o5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=b80mjczMKdynxDiqihftIRC/nvOfe2fufAmH1zUWecg=; b=aW+ecXTaqKkXaNO9aEKiA6sKO/slag7A1Y6G1zk7XC3ezoYLnzvhHdO3fvq0yGG33m mXkGpq7w6TI0u48TNt9m5PKFWrHY/APb/Oj/cOITkKRXoCoDg3XZVjvZ9b3CJjpoRCJo Jmhxot7/1mEUHsTRoa3saY8pYVvs2umEGLSbNSV4+t+WVkN1tb1nR372v+LThQWzfRCm F9F1uqSnH1TpWXWglxh/02iVtlMaOlZuoWvVI7Tv9ChiaRHHxR+dloaQL07Hm0AQGlPl lT55whKmsvxrdRer1ujYK8z7mXfXPysn0ECneS8u7qEpqPSQ3PHB+r3MEKghcepbP0dT VCKw== X-Gm-Message-State: APjAAAXEGHok63nQVwgdjeA4psnr1ifdG9q5Wd6Bbd2OpFKxTtokUN6/ h4G8m3SJsLCEETz9vOqrnbU= X-Received: by 2002:a17:90a:bc41:: with SMTP id t1mr31936123pjv.67.1570993846203; Sun, 13 Oct 2019 12:10:46 -0700 (PDT) Received: from wambui.zuku.co.ke ([197.237.61.225]) by smtp.googlemail.com with ESMTPSA id m5sm15261216pgt.15.2019.10.13.12.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2019 12:10:45 -0700 (PDT) From: Wambui Karuga To: outreachy-kernel@googlegroups.com Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, eric@anholt.net, wahrenst@gmx.net, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] staging: rtl8723bs: use DIV_ROUND_UP helper macro Date: Sun, 13 Oct 2019 22:10:27 +0300 Message-Id: <20191013191027.6470-1-wambui.karugax@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the DIV_ROUND_UP macro to replace open-coded divisor calculation to improve readability. Issue found using coccinelle: @@ expression n,d; @@ ( - ((n + d - 1) / d) + DIV_ROUND_UP(n,d) | - ((n + (d - 1)) / d) + DIV_ROUND_UP(n,d) ) Signed-off-by: Wambui Karuga --- Changes in v2: - Remove comment that explained previously used calculation. --- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c index 87535a4c2e14..22931ab3a5fc 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c @@ -4156,9 +4156,8 @@ void SetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val) break; } - /* The value of ((usNavUpper + HAL_NAV_UPPER_UNIT_8723B - 1) / HAL_NAV_UPPER_UNIT_8723B) */ - /* is getting the upper integer. */ - usNavUpper = (usNavUpper + HAL_NAV_UPPER_UNIT_8723B - 1) / HAL_NAV_UPPER_UNIT_8723B; + usNavUpper = DIV_ROUND_UP(usNavUpper, + HAL_NAV_UPPER_UNIT_8723B); rtw_write8(padapter, REG_NAV_UPPER, (u8)usNavUpper); } break; -- 2.23.0