[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200326171043.GB3629@ubuntu>
Date: Thu, 26 Mar 2020 18:10:43 +0100
From: Oscar Carter <oscar.carter@....com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Oscar Carter <oscar.carter@....com>,
Forest Bond <forest@...ttletooquiet.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org, Malcolm Priestley <tvboxspy@...il.com>,
linux-kernel@...r.kernel.org,
Gabriela Bittencourt <gabrielabittencourt00@...il.com>,
Colin Ian King <colin.king@...onical.com>
Subject: Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_*
functions
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
Powered by blists - more mailing lists