Re: [PATCH] staging: vt6656: Use BIT() macro in vnt_mac_reg_bits_* functions

From: Dan Carpenter
Date: Mon Mar 23 2020 - 03:32:35 EST


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