linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Quentin Deslandes <quentin.deslandes@itdev.co.uk>
To: Oscar Carter <oscar.carter@gmx.com>
Cc: Forest Bond <forest@alittletooquiet.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Malcolm Priestley <tvboxspy@gmail.com>,
	Amir Mahdi Ghorbanian <indigoomega021@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code
Date: Fri, 27 Mar 2020 08:44:54 +0000	[thread overview]
Message-ID: <20200327084454.GA25025@jiffies> (raw)
In-Reply-To: <20200326175902.14467-1-oscar.carter@gmx.com>

On 03/26/20 18:59:02, Oscar Carter wrote:
> Use DIV_ROUND_UP macro instead of specific code with the same purpose.
> Also, remove the unused variables.
> 
> Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
> ---
> Changelog v1 -> v2
> - Rebase the original patch [1] against the staging-next branch of the greg's
>   staging.git tree.
> 
>   [1] https://lore.kernel.org/lkml/20200322112342.9040-1-oscar.carter@gmx.com/
> 
>  drivers/staging/vt6656/baseband.c | 21 ++++-----------------
>  1 file changed, 4 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c
> index 0b5729abcbcd..a19a563d8bcc 100644
> --- a/drivers/staging/vt6656/baseband.c
> +++ b/drivers/staging/vt6656/baseband.c
> @@ -23,6 +23,7 @@
>   */
> 
>  #include <linux/bits.h>
> +#include <linux/kernel.h>
>  #include "mac.h"
>  #include "baseband.h"
>  #include "rf.h"
> @@ -133,7 +134,6 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type,
>  {
>  	unsigned int frame_time;
>  	unsigned int preamble;
> -	unsigned int tmp;
>  	unsigned int rate = 0;
> 
>  	if (tx_rate > RATE_54M)
> @@ -147,20 +147,11 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type,
>  		else
>  			preamble = 192;
> 
> -		frame_time = (frame_length * 80) / rate;
> -		tmp = (frame_time * rate) / 80;
> -
> -		if (frame_length != tmp)
> -			frame_time++;
> -
> +		frame_time = DIV_ROUND_UP(frame_length * 80, rate);
>  		return preamble + frame_time;
>  	}
> -	frame_time = (frame_length * 8 + 22) / rate;
> -	tmp = ((frame_time * rate) - 22) / 8;
> -
> -	if (frame_length != tmp)
> -		frame_time++;
> 
> +	frame_time = DIV_ROUND_UP(frame_length * 8 + 22, rate);
>  	frame_time = frame_time * 4;
> 
>  	if (pkt_type != PK_TYPE_11A)
> @@ -214,11 +205,7 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length,
> 
>  		break;
>  	case RATE_5M:
> -		count = (bit_count * 10) / 55;
> -		tmp = (count * 55) / 10;
> -
> -		if (tmp != bit_count)
> -			count++;
> +		count = DIV_ROUND_UP(bit_count * 10, 55);
> 
>  		if (preamble_type == 1)
>  			phy->signal = 0x0a;
> --
> 2.20.1

Reviewed-by: Quentin Deslandes <quentin.deslandes@itdev.co.uk>

Thanks,
Quentin

      reply	other threads:[~2020-03-27  8:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 17:59 [PATCH v2] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code Oscar Carter
2020-03-27  8:44 ` Quentin Deslandes [this message]

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=20200327084454.GA25025@jiffies \
    --to=quentin.deslandes@itdev.co.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=forest@alittletooquiet.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=indigoomega021@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oscar.carter@gmx.com \
    --cc=tvboxspy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).