From: Wambui Karuga <wambui.karugax@gmail•com>
To: outreachy-kernel@googlegroups•com
Cc: devel@driverdev•osuosl.org, gregkh@linuxfoundation•org,
linux-kernel@vger•kernel.org, eric@anholt•net,
bcm-kernel-feedback-list@broadcom•com, wahrenst@gmx•net,
linux-arm-kernel@lists•infradead.org,
linux-rpi-kernel@lists•infradead.org
Subject: [PATCH v2] staging: rtl8723bs: use DIV_ROUND_UP helper macro
Date: Sun, 13 Oct 2019 22:10:27 +0300 [thread overview]
Message-ID: <20191013191027.6470-1-wambui.karugax@gmail.com> (raw)
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 <wambui.karugax@gmail•com>
---
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2019-10-13 19:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-13 19:10 Wambui Karuga [this message]
2019-10-13 19:31 ` [Outreachy kernel] [PATCH v2] staging: rtl8723bs: use DIV_ROUND_UP helper macro Julia Lawall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191013191027.6470-1-wambui.karugax@gmail.com \
--to=wambui.karugax@gmail$(echo .)com \
--cc=bcm-kernel-feedback-list@broadcom$(echo .)com \
--cc=devel@driverdev$(echo .)osuosl.org \
--cc=eric@anholt$(echo .)net \
--cc=gregkh@linuxfoundation$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-rpi-kernel@lists$(echo .)infradead.org \
--cc=outreachy-kernel@googlegroups$(echo .)com \
--cc=wahrenst@gmx$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox