Skip to contentSkip to conversation

staging: Prefer using BIT Macro

PATCH New Amitoj Kaur Chawla 1 participant 6 messages Oct 16, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: Prefer using BIT Macro

This patchset replaces bit shifting on 1 with the BIT(x) Macro

The semantic patch used to find this is:
@@ int g; @@

-(1 << g)
+BIT(g)

Amitoj Kaur Chawla (5):
staging: rdma: hfi1: Prefer using BIT Macro
staging: rdma: amso1100: Prefer using BIT Macro
staging: panel: Prefer using BIT Macro
staging: vt6656: Prefer using BIT Macro
staging: vt6655: Prefer using BIT Macro

 drivers/staging/panel/panel.c               | 6 +++---
 drivers/staging/rdma/amso1100/c2_provider.c | 6 +++---
 drivers/staging/rdma/hfi1/file_ops.c        | 2 +-
 drivers/staging/vt6655/card.c               | 2 +-
 drivers/staging/vt6656/card.c               | 2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/5 staging: rdma: hfi1: Prefer using BIT Macro

Replace bit shifting on 1 with the BIT(x) Macro

The semantic patch used to find this is:
@@ int g; @@

-(1 << g)
+BIT(g)

---
 drivers/staging/rdma/hfi1/file_ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rdma/hfi1/file_ops.c +1 -1
index 7d28680..cbaf4f7 100644
@@ -508,7 +508,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma)
 	case PIO_BUFS_SOP:
 		memaddr = ((dd->physaddr + TXE_PIO_SEND) +
 				/* chip pio base */
-			   (uctxt->sc->hw_context * (1 << 16))) +
+			   (uctxt->sc->hw_context * BIT(16))) +
 				/* 64K PIO space / ctxt */
 			(type == PIO_BUFS_SOP ?
 				(TXE_PIO_SIZE / 2) : 0); /* sop? */
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/5 staging: rdma: amso1100: Prefer using BIT Macro

In reply to Amitoj Kaur Chawla

Replace bit shifting on 1 with the BIT(x) Macro

The semantic patch used to find this is:
@@ int g; @@

-(1 << g)
+BIT(g)

---
 drivers/staging/rdma/amso1100/c2_provider.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rdma/amso1100/c2_provider.c +3 -3
index 956d76b..e44ad22 100644
@@ -372,7 +372,7 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd,
 
 		total_len += buffer_list[i].size;
 		pbl_depth += ALIGN(buffer_list[i].size,
-				   (1 << page_shift)) >> page_shift;
+				   BIT(page_shift)) >> page_shift;
 	}
 
 	page_list = vmalloc(sizeof(u64) * pbl_depth);
@@ -387,7 +387,7 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd,
 		int naddrs;
 
  		naddrs = ALIGN(buffer_list[i].size,
-			       (1 << page_shift)) >> page_shift;
+			       BIT(page_shift)) >> page_shift;
 		for (k = 0; k < naddrs; k++)
 			page_list[j++] = (buffer_list[i].addr +
 						     (k << page_shift));
@@ -408,7 +408,7 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd,
 	       	(unsigned long long) page_list[0],
 	       	(unsigned long long) page_list[pbl_depth-1]);
   	err = c2_nsmr_register_phys_kern(to_c2dev(ib_pd->device), page_list,
- 					 (1 << page_shift), pbl_depth,
+ 					 BIT(page_shift), pbl_depth,
 					 total_len, 0, iova_start,
 					 c2_convert_access(acc), mr);
 	vfree(page_list);
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/5 staging: panel: Prefer using BIT Macro

In reply to Amitoj Kaur Chawla

Replace bit shifting on 1 with the BIT(x) Macro

The semantic patch used to find this is:
@@ int g; @@

-(1 << g)
+BIT(g)

---
 drivers/staging/panel/panel.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/panel/panel.c +3 -3
index a7e3875..b47da2b 100644
@@ -1794,7 +1794,7 @@ static void phys_scan_contacts(void)
 		 * So we'll scan them.
 		 */
 		for (bit = 0; bit < 8; bit++) {
-			bitval = 1 << bit;
+			bitval = BIT(bit);
 
 			if (!(scan_mask_o & bitval))	/* skip unused bits */
 				continue;
@@ -2060,12 +2060,12 @@ static int input_name2mask(const char *name, pmask_t *mask, pmask_t *value,
 			return 0;	/* input name not found */
 		neg = (in & 1);	/* odd (lower) names are negated */
 		in >>= 1;
-		im |= (1 << in);
+		im |= BIT(in);
 
 		name++;
 		if (isdigit(*name)) {
 			out = *name - '0';
-			om |= (1 << out);
+			om |= BIT(out);
 		} else if (*name == '-') {
 			out = 8;
 		} else {
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/5 staging: vt6656: Prefer using BIT Macro

In reply to Amitoj Kaur Chawla

Replace bit shifting on 1 with the BIT(x) Macro

The semantic patch used to find this is:
@@ int g; @@

-(1 << g)
+BIT(g)

---
 drivers/staging/vt6656/card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/card.c +1 -1
index 167dca9..70685e5 100644
@@ -473,7 +473,7 @@ int vnt_ofdm_min_rate(struct vnt_private *priv)
 	int ii;
 
 	for (ii = RATE_54M; ii >= RATE_6M; ii--) {
-		if ((priv->basic_rates) & ((u16)(1 << ii)))
+		if ((priv->basic_rates) & ((u16)BIT(ii)))
 			return true;
 	}
 
Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/5 staging: vt6655: Prefer using BIT Macro

In reply to Amitoj Kaur Chawla

Replace bit shifting on 1 with the BIT(x) Macro

The semantic patch used to find this is:
@@ int g; @@

-(1 << g)
+BIT(g)

---
 drivers/staging/vt6655/card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/card.c +1 -1
index 4640b56..f07d933 100644
@@ -808,7 +808,7 @@ bool CARDbIsOFDMinBasicRate(struct vnt_private *pDevice)
 	int ii;
 
 	for (ii = RATE_54M; ii >= RATE_6M; ii--) {
-		if ((pDevice->basic_rates) & ((u32)(1 << ii)))
+		if ((pDevice->basic_rates) & ((u32)BIT(ii)))
 			return true;
 	}
 	return false;
Signature · 1 line
1.9.1