All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
@ 2020-03-20 18:13 ` Oscar Carter
  0 siblings, 0 replies; 10+ messages in thread
From: Oscar Carter @ 2020-03-20 18:13 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman
  Cc: Amir Mahdi Ghorbanian, Oscar Carter, Quentin Deslandes,
	Malcolm Priestley, Colin Ian King, Gabriela Bittencourt, devel,
	linux-kernel

The last parameter in the functions vnt_mac_reg_bits_on and
vnt_mac_reg_bits_off defines the bits to set or unset. So, it's more
clear to use the BIT() macro instead of an hexadecimal value.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
---
 drivers/staging/vt6656/baseband.c | 5 +++--
 drivers/staging/vt6656/card.c     | 4 +++-
 drivers/staging/vt6656/main_usb.c | 3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c
index f18e059ce66b..a29d9f4f575e 100644
--- a/drivers/staging/vt6656/baseband.c
+++ b/drivers/staging/vt6656/baseband.c
@@ -22,6 +22,7 @@
  *
  */

+#include <linux/bits.h>
 #include "mac.h"
 #include "baseband.h"
 #include "rf.h"
@@ -468,7 +469,7 @@ int vnt_vt3184_init(struct vnt_private *priv)
 		if (ret)
 			goto end;

-		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01);
+		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0));
 		if (ret)
 			goto end;
 	} else if (priv->rf_type == RF_VT3226D0) {
@@ -477,7 +478,7 @@ int vnt_vt3184_init(struct vnt_private *priv)
 		if (ret)
 			goto end;

-		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01);
+		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0));
 		if (ret)
 			goto end;
 	}
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 7958fc165462..dc3ab10eb630 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -26,6 +26,7 @@
  *
  */

+#include <linux/bits.h>
 #include "device.h"
 #include "card.h"
 #include "baseband.h"
@@ -63,7 +64,8 @@ void vnt_set_channel(struct vnt_private *priv, u32 connection_channel)
 	vnt_mac_reg_bits_on(priv, MAC_REG_MACCR, MACCR_CLRNAV);

 	/* Set Channel[7] = 0 to tell H/W channel is changing now. */
-	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL, 0xb0);
+	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL,
+			     (BIT(7) | BIT(5) | BIT(4)));

 	vnt_control_out(priv, MESSAGE_TYPE_SELECT_CHANNEL,
 			connection_channel, 0, 0, NULL);
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 5e48b3ddb94c..1196b6e28c22 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -21,6 +21,7 @@
  */
 #undef __NO_VERSION__

+#include <linux/bits.h>
 #include <linux/etherdevice.h>
 #include <linux/file.h>
 #include "device.h"
@@ -370,7 +371,7 @@ static int vnt_init_registers(struct vnt_private *priv)
 	if (ret)
 		goto end;

-	ret = vnt_mac_reg_bits_on(priv, MAC_REG_GPIOCTL0, 0x01);
+	ret = vnt_mac_reg_bits_on(priv, MAC_REG_GPIOCTL0, BIT(0));
 	if (ret)
 		goto end;

--
2.20.1


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

* [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
@ 2020-03-20 18:13 ` Oscar Carter
  0 siblings, 0 replies; 10+ messages in thread
From: Oscar Carter @ 2020-03-20 18:13 UTC (permalink / raw)
  To: Forest Bond, Greg Kroah-Hartman
  Cc: devel, Oscar Carter, Malcolm Priestley, linux-kernel,
	Gabriela Bittencourt, Colin Ian King

The last parameter in the functions vnt_mac_reg_bits_on and
vnt_mac_reg_bits_off defines the bits to set or unset. So, it's more
clear to use the BIT() macro instead of an hexadecimal value.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
---
 drivers/staging/vt6656/baseband.c | 5 +++--
 drivers/staging/vt6656/card.c     | 4 +++-
 drivers/staging/vt6656/main_usb.c | 3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c
index f18e059ce66b..a29d9f4f575e 100644
--- a/drivers/staging/vt6656/baseband.c
+++ b/drivers/staging/vt6656/baseband.c
@@ -22,6 +22,7 @@
  *
  */

+#include <linux/bits.h>
 #include "mac.h"
 #include "baseband.h"
 #include "rf.h"
@@ -468,7 +469,7 @@ int vnt_vt3184_init(struct vnt_private *priv)
 		if (ret)
 			goto end;

-		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01);
+		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0));
 		if (ret)
 			goto end;
 	} else if (priv->rf_type == RF_VT3226D0) {
@@ -477,7 +478,7 @@ int vnt_vt3184_init(struct vnt_private *priv)
 		if (ret)
 			goto end;

-		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01);
+		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0));
 		if (ret)
 			goto end;
 	}
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 7958fc165462..dc3ab10eb630 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -26,6 +26,7 @@
  *
  */

+#include <linux/bits.h>
 #include "device.h"
 #include "card.h"
 #include "baseband.h"
@@ -63,7 +64,8 @@ void vnt_set_channel(struct vnt_private *priv, u32 connection_channel)
 	vnt_mac_reg_bits_on(priv, MAC_REG_MACCR, MACCR_CLRNAV);

 	/* Set Channel[7] = 0 to tell H/W channel is changing now. */
-	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL, 0xb0);
+	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL,
+			     (BIT(7) | BIT(5) | BIT(4)));

 	vnt_control_out(priv, MESSAGE_TYPE_SELECT_CHANNEL,
 			connection_channel, 0, 0, NULL);
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 5e48b3ddb94c..1196b6e28c22 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -21,6 +21,7 @@
  */
 #undef __NO_VERSION__

+#include <linux/bits.h>
 #include <linux/etherdevice.h>
 #include <linux/file.h>
 #include "device.h"
@@ -370,7 +371,7 @@ static int vnt_init_registers(struct vnt_private *priv)
 	if (ret)
 		goto end;

-	ret = vnt_mac_reg_bits_on(priv, MAC_REG_GPIOCTL0, 0x01);
+	ret = vnt_mac_reg_bits_on(priv, MAC_REG_GPIOCTL0, BIT(0));
 	if (ret)
 		goto end;

--
2.20.1

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

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

* Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
  2020-03-20 18:13 ` Oscar Carter
@ 2020-03-23  7:32   ` Dan Carpenter
  -1 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2020-03-23  7:32 UTC (permalink / raw)
  To: Oscar Carter
  Cc: Forest Bond, Greg Kroah-Hartman, devel, Malcolm Priestley,
	linux-kernel, Gabriela Bittencourt, Colin Ian King

On Fri, Mar 20, 2020 at 07:13:26PM +0100, Oscar Carter wrote:
> +#include <linux/bits.h>
>  #include "mac.h"
>  #include "baseband.h"
>  #include "rf.h"
> @@ -468,7 +469,7 @@ int vnt_vt3184_init(struct vnt_private *priv)
>  		if (ret)
>  			goto end;
> 
> -		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01);
> +		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0));

Everyone knows 0x01 is bit(0) already.  This isn't more clear.  It
should be a define instead of a magic number.

> @@ -63,7 +64,8 @@ void vnt_set_channel(struct vnt_private *priv, u32 connection_channel)
>  	vnt_mac_reg_bits_on(priv, MAC_REG_MACCR, MACCR_CLRNAV);
> 
>  	/* Set Channel[7] = 0 to tell H/W channel is changing now. */
> -	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL, 0xb0);
> +	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL,
> +			     (BIT(7) | BIT(5) | BIT(4)));

This one especially is just a lot longer now but still not clear.

regards,
dan carpenter


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

* Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
@ 2020-03-23  7:32   ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2020-03-23  7:32 UTC (permalink / raw)
  To: Oscar Carter
  Cc: devel, Malcolm Priestley, Greg Kroah-Hartman, linux-kernel,
	Forest Bond, Gabriela Bittencourt, Colin Ian King

On Fri, Mar 20, 2020 at 07:13:26PM +0100, Oscar Carter wrote:
> +#include <linux/bits.h>
>  #include "mac.h"
>  #include "baseband.h"
>  #include "rf.h"
> @@ -468,7 +469,7 @@ int vnt_vt3184_init(struct vnt_private *priv)
>  		if (ret)
>  			goto end;
> 
> -		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01);
> +		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0));

Everyone knows 0x01 is bit(0) already.  This isn't more clear.  It
should be a define instead of a magic number.

> @@ -63,7 +64,8 @@ void vnt_set_channel(struct vnt_private *priv, u32 connection_channel)
>  	vnt_mac_reg_bits_on(priv, MAC_REG_MACCR, MACCR_CLRNAV);
> 
>  	/* Set Channel[7] = 0 to tell H/W channel is changing now. */
> -	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL, 0xb0);
> +	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL,
> +			     (BIT(7) | BIT(5) | BIT(4)));

This one especially is just a lot longer now but still not clear.

regards,
dan carpenter

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

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

* Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
  2020-03-23  7:32   ` Dan Carpenter
@ 2020-03-26 17:10     ` Oscar Carter
  -1 siblings, 0 replies; 10+ messages in thread
From: Oscar Carter @ 2020-03-26 17:10 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Oscar Carter, Forest Bond, Greg Kroah-Hartman, devel,
	Malcolm Priestley, linux-kernel, Gabriela Bittencourt,
	Colin Ian King

On Mon, Mar 23, 2020 at 10:32:14AM +0300, Dan Carpenter wrote:
> On Fri, Mar 20, 2020 at 07:13:26PM +0100, Oscar Carter wrote:
> > +#include <linux/bits.h>
> >  #include "mac.h"
> >  #include "baseband.h"
> >  #include "rf.h"
> > @@ -468,7 +469,7 @@ int vnt_vt3184_init(struct vnt_private *priv)
> >  		if (ret)
> >  			goto end;
> >
> > -		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01);
> > +		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0));
>
> Everyone knows 0x01 is bit(0) already.  This isn't more clear.  It
> should be a define instead of a magic number.
>
I agree. I create a new define for this case.

> > @@ -63,7 +64,8 @@ void vnt_set_channel(struct vnt_private *priv, u32 connection_channel)
> >  	vnt_mac_reg_bits_on(priv, MAC_REG_MACCR, MACCR_CLRNAV);
> >
> >  	/* Set Channel[7] = 0 to tell H/W channel is changing now. */
> > -	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL, 0xb0);
> > +	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL,
> > +			     (BIT(7) | BIT(5) | BIT(4)));
>
> This one especially is just a lot longer now but still not clear.
>
Like the previous one, i create a define. In this case to avoid the magic
number or the OR operation between BIT macros.

> regards,
> dan carpenter
>
I will make these changes and i will send and incremental patch with the
"Fixes:" tag due to the this patch has already been added to the staging-next
branch of the greg staging tree.

thanks,
oscar carter

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

* Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
@ 2020-03-26 17:10     ` Oscar Carter
  0 siblings, 0 replies; 10+ messages in thread
From: Oscar Carter @ 2020-03-26 17:10 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, Oscar Carter, Malcolm Priestley, Greg Kroah-Hartman,
	linux-kernel, Forest Bond, Gabriela Bittencourt, Colin Ian King

On Mon, Mar 23, 2020 at 10:32:14AM +0300, Dan Carpenter wrote:
> On Fri, Mar 20, 2020 at 07:13:26PM +0100, Oscar Carter wrote:
> > +#include <linux/bits.h>
> >  #include "mac.h"
> >  #include "baseband.h"
> >  #include "rf.h"
> > @@ -468,7 +469,7 @@ int vnt_vt3184_init(struct vnt_private *priv)
> >  		if (ret)
> >  			goto end;
> >
> > -		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, 0x01);
> > +		ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0));
>
> Everyone knows 0x01 is bit(0) already.  This isn't more clear.  It
> should be a define instead of a magic number.
>
I agree. I create a new define for this case.

> > @@ -63,7 +64,8 @@ void vnt_set_channel(struct vnt_private *priv, u32 connection_channel)
> >  	vnt_mac_reg_bits_on(priv, MAC_REG_MACCR, MACCR_CLRNAV);
> >
> >  	/* Set Channel[7] = 0 to tell H/W channel is changing now. */
> > -	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL, 0xb0);
> > +	vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL,
> > +			     (BIT(7) | BIT(5) | BIT(4)));
>
> This one especially is just a lot longer now but still not clear.
>
Like the previous one, i create a define. In this case to avoid the magic
number or the OR operation between BIT macros.

> regards,
> dan carpenter
>
I will make these changes and i will send and incremental patch with the
"Fixes:" tag due to the this patch has already been added to the staging-next
branch of the greg staging tree.

thanks,
oscar carter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
  2020-03-26 17:10     ` Oscar Carter
@ 2020-03-31 10:41       ` Dan Carpenter
  -1 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2020-03-31 10:41 UTC (permalink / raw)
  To: Oscar Carter
  Cc: Forest Bond, Greg Kroah-Hartman, devel, Malcolm Priestley,
	linux-kernel, Gabriela Bittencourt, Colin Ian King

On Thu, Mar 26, 2020 at 06:10:43PM +0100, Oscar Carter wrote:
> I will make these changes and i will send and incremental patch with the
> "Fixes:" tag due to the this patch has already been added to the staging-next
> branch of the greg staging tree.

Fixes is only for bug fixes, not style issues.

regards,
dan carpenter


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

* Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
@ 2020-03-31 10:41       ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2020-03-31 10:41 UTC (permalink / raw)
  To: Oscar Carter
  Cc: devel, Malcolm Priestley, Greg Kroah-Hartman, linux-kernel,
	Forest Bond, Gabriela Bittencourt, Colin Ian King

On Thu, Mar 26, 2020 at 06:10:43PM +0100, Oscar Carter wrote:
> I will make these changes and i will send and incremental patch with the
> "Fixes:" tag due to the this patch has already been added to the staging-next
> branch of the greg staging tree.

Fixes is only for bug fixes, not style issues.

regards,
dan carpenter

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

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

* Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
  2020-03-31 10:41       ` Dan Carpenter
@ 2020-04-01 15:31         ` Oscar Carter
  -1 siblings, 0 replies; 10+ messages in thread
From: Oscar Carter @ 2020-04-01 15:31 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Oscar Carter, Forest Bond, Greg Kroah-Hartman, devel,
	Malcolm Priestley, linux-kernel, Gabriela Bittencourt,
	Colin Ian King

On Tue, Mar 31, 2020 at 01:41:30PM +0300, Dan Carpenter wrote:
> On Thu, Mar 26, 2020 at 06:10:43PM +0100, Oscar Carter wrote:
> > I will make these changes and i will send and incremental patch with the
> > "Fixes:" tag due to the this patch has already been added to the staging-next
> > branch of the greg staging tree.
>
> Fixes is only for bug fixes, not style issues.
>
Ok, thanks for the explanation.

> regards,
> dan carpenter
>
regards,
oscar carter

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

* Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions
@ 2020-04-01 15:31         ` Oscar Carter
  0 siblings, 0 replies; 10+ messages in thread
From: Oscar Carter @ 2020-04-01 15:31 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, Oscar Carter, Malcolm Priestley, Greg Kroah-Hartman,
	linux-kernel, Forest Bond, Gabriela Bittencourt, Colin Ian King

On Tue, Mar 31, 2020 at 01:41:30PM +0300, Dan Carpenter wrote:
> On Thu, Mar 26, 2020 at 06:10:43PM +0100, Oscar Carter wrote:
> > I will make these changes and i will send and incremental patch with the
> > "Fixes:" tag due to the this patch has already been added to the staging-next
> > branch of the greg staging tree.
>
> Fixes is only for bug fixes, not style issues.
>
Ok, thanks for the explanation.

> regards,
> dan carpenter
>
regards,
oscar carter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2020-04-01 15:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 18:13 [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions Oscar Carter
2020-03-20 18:13 ` Oscar Carter
2020-03-23  7:32 ` Dan Carpenter
2020-03-23  7:32   ` Dan Carpenter
2020-03-26 17:10   ` Oscar Carter
2020-03-26 17:10     ` Oscar Carter
2020-03-31 10:41     ` Dan Carpenter
2020-03-31 10:41       ` Dan Carpenter
2020-04-01 15:31       ` Oscar Carter
2020-04-01 15:31         ` 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.