Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3645700ybp; Sun, 13 Oct 2019 11:09:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMxFmUMSLK4Eb7HEj2V2D6eh4RYYPUy203UhZvvsfnoCKFshG5iljvyEP6QDS/LVWyF3It X-Received: by 2002:aa7:c959:: with SMTP id h25mr24655395edt.216.1570990144509; Sun, 13 Oct 2019 11:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570990144; cv=none; d=google.com; s=arc-20160816; b=R17yv09/h+vo3zODZ7dHOtPAJF8jvzpwteGuhWiP54HuHzGoOSNXwPWTSgRgb7JAwF U/Xf5DLajrOHkjV+de8jjHmupcGeszeD++4YqAcYXQ9yL1pp2PJ9Q4vDqz+gONW6T9aH LZzul11mJ3/iqaHO+5BnU5FeJ3Vlq4QMB4kDmrROI0M9zo4OnQBNZ2DxWggUp2zubH5+ gV9ygcCPU3s2aKNEVzrzN2cNUbRPxSYYHtLgPVjtMX+w+Fd71eRXm7xRdfm9rl2bwl6s f66xSAfFStzlFtaXE7DnTu26Vg0RLY8zdGFXnF9nrda2eU74j+afqeXOCzdosolBwsw2 8m8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=9ynqPh6joa0YVVDFF8aTI3yQdG0vTNli2Vi2zUpaDwE=; b=YjD9y/vzfCWTMZbawXZk9N2A/YLGPqNSWly+52LTRoLfV+rlYaBVlOgg4mo2W9TdPx 5UxZR2qUDnoxDG0dlws4Eep373vz0ki556k90lftAkTXwnlqqKq8sn84KjuXIZCA/fWa Isa5wgRwkbwE3jnf+tL0+7YBLyFqTySRscPI0t2EH5FrdcdC/c8I+FEBRSCupTuXiWgb TwlwDobL/Raw+WRTn8oND4tSvy67QRifXSpYauddwKeDil7yKP0R0zjcDVThjqxImE9k LxRA6QofeyYaMxj/gTjOnm4XOWPjsh02K657LZw1hYMOX+L9LZvR5hofTae7ldyiKWyw awoQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12si11514411edc.50.2019.10.13.11.08.40; Sun, 13 Oct 2019 11:09:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728469AbfJMSGR (ORCPT + 99 others); Sun, 13 Oct 2019 14:06:17 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:34246 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727141AbfJMSGR (ORCPT ); Sun, 13 Oct 2019 14:06:17 -0400 X-IronPort-AV: E=Sophos;i="5.67,292,1566856800"; d="scan'208";a="322545345" Received: from 81-65-53-202.rev.numericable.fr (HELO hadrien) ([81.65.53.202]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Oct 2019 20:06:14 +0200 Date: Sun, 13 Oct 2019 20:06:14 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Wambui Karuga cc: outreachy-kernel@googlegroups.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: use DIV_ROUND_UP helper macro In-Reply-To: <20191013180033.31882-1-wambui.karugax@gmail.com> Message-ID: References: <20191013180033.31882-1-wambui.karugax@gmail.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 13 Oct 2019, Wambui Karuga wrote: > 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 > --- > drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c > index 87535a4c2e14..74312e8bb32e 100644 > --- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c > +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c > @@ -4158,7 +4158,8 @@ void SetHwReg8723B(struct adapter *padapter, u8 variable, u8 *val) > > /* The value of ((usNavUpper + HAL_NAV_UPPER_UNIT_8723B - 1) / HAL_NAV_UPPER_UNIT_8723B) */ > /* is getting the upper integer. */ It's a nice change. Maybe the above comment could also be dropped, since the code is more understandable now. julia > - 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 > > -- > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191013180033.31882-1-wambui.karugax%40gmail.com. >