All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code
@ 2020-03-22 11:23 ` Oscar Carter
  0 siblings, 0 replies; 6+ messages in thread
From: Oscar Carter @ 2020-03-22 11:23 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman
  Cc: Amir Mahdi Ghorbanian, Quentin Deslandes, Malcolm Priestley,
	Oscar Carter, devel, linux-kernel

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>
---
 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 f18e059ce66b..e2eb2b98a73d 100644
--- a/drivers/staging/vt6656/baseband.c
+++ b/drivers/staging/vt6656/baseband.c
@@ -22,6 +22,7 @@
  *
  */

+#include <linux/kernel.h>
 #include "mac.h"
 #include "baseband.h"
 #include "rf.h"
@@ -132,7 +133,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)
@@ -146,20 +146,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)
@@ -213,11 +204,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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code
@ 2020-03-22 11:23 ` Oscar Carter
  0 siblings, 0 replies; 6+ messages in thread
From: Oscar Carter @ 2020-03-22 11:23 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman
  Cc: devel, Oscar Carter, Malcolm Priestley, linux-kernel

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>
---
 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 f18e059ce66b..e2eb2b98a73d 100644
--- a/drivers/staging/vt6656/baseband.c
+++ b/drivers/staging/vt6656/baseband.c
@@ -22,6 +22,7 @@
  *
  */

+#include <linux/kernel.h>
 #include "mac.h"
 #include "baseband.h"
 #include "rf.h"
@@ -132,7 +133,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)
@@ -146,20 +146,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)
@@ -213,11 +204,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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code
  2020-03-22 11:23 ` Oscar Carter
@ 2020-03-23 10:42   ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-23 10:42 UTC (permalink / raw)
  To: Oscar Carter; +Cc: Forest Bond, devel, Malcolm Priestley, linux-kernel

On Sun, Mar 22, 2020 at 12:23:42PM +0100, 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>
> ---
>  drivers/staging/vt6656/baseband.c | 21 ++++-----------------
>  1 file changed, 4 insertions(+), 17 deletions(-)

Please rebase this against my staging-next branch of my staging.git tree
and resend it as it does not apply to it at the moment at all.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code
@ 2020-03-23 10:42   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-23 10:42 UTC (permalink / raw)
  To: Oscar Carter; +Cc: devel, Malcolm Priestley, Forest Bond, linux-kernel

On Sun, Mar 22, 2020 at 12:23:42PM +0100, 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>
> ---
>  drivers/staging/vt6656/baseband.c | 21 ++++-----------------
>  1 file changed, 4 insertions(+), 17 deletions(-)

Please rebase this against my staging-next branch of my staging.git tree
and resend it as it does not apply to it at the moment at all.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code
  2020-03-23 10:42   ` Greg Kroah-Hartman
@ 2020-03-24 16:43     ` Oscar Carter
  -1 siblings, 0 replies; 6+ messages in thread
From: Oscar Carter @ 2020-03-24 16:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Oscar Carter, Forest Bond, devel, Malcolm Priestley, linux-kernel

On Mon, Mar 23, 2020 at 11:42:00AM +0100, Greg Kroah-Hartman wrote:
> On Sun, Mar 22, 2020 at 12:23:42PM +0100, 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>
> > ---
> >  drivers/staging/vt6656/baseband.c | 21 ++++-----------------
> >  1 file changed, 4 insertions(+), 17 deletions(-)
>
> Please rebase this against my staging-next branch of my staging.git tree
> and resend it as it does not apply to it at the moment at all.
>
Ok, I rebase against your staging-next branch and I resend the patch as a new
version.

> thanks,
>
> greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code
@ 2020-03-24 16:43     ` Oscar Carter
  0 siblings, 0 replies; 6+ messages in thread
From: Oscar Carter @ 2020-03-24 16:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Malcolm Priestley, Oscar Carter, Forest Bond, linux-kernel

On Mon, Mar 23, 2020 at 11:42:00AM +0100, Greg Kroah-Hartman wrote:
> On Sun, Mar 22, 2020 at 12:23:42PM +0100, 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>
> > ---
> >  drivers/staging/vt6656/baseband.c | 21 ++++-----------------
> >  1 file changed, 4 insertions(+), 17 deletions(-)
>
> Please rebase this against my staging-next branch of my staging.git tree
> and resend it as it does not apply to it at the moment at all.
>
Ok, I rebase against your staging-next branch and I resend the patch as a new
version.

> thanks,
>
> greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-24 16:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-22 11:23 [PATCH] staging: vt6656: Use DIV_ROUND_UP macro instead of specific code Oscar Carter
2020-03-22 11:23 ` Oscar Carter
2020-03-23 10:42 ` Greg Kroah-Hartman
2020-03-23 10:42   ` Greg Kroah-Hartman
2020-03-24 16:43   ` Oscar Carter
2020-03-24 16:43     ` Oscar Carter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.