Skip to content

Commit 1aab144

Browse files
bwallanJeff Kirsher
authored andcommitted
fm10k: Move constants to the right of binary operators
The semantic patch that makes this change is available in scripts/coccinelle/misc/compare_const_fl.cocci. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Bruce Allan <[email protected]> Tested-by: Krishneil Singh <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 265bee7 commit 1aab144

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

drivers/net/ethernet/intel/fm10k/fm10k_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ static inline void fm10k_rx_hash(struct fm10k_ring *ring,
420420
return;
421421

422422
skb_set_hash(skb, le32_to_cpu(rx_desc->d.rss),
423-
(FM10K_RSS_L4_TYPES_MASK & (1ul << rss_type)) ?
423+
((1ul << rss_type) & FM10K_RSS_L4_TYPES_MASK) ?
424424
PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
425425
}
426426

drivers/net/ethernet/intel/fm10k/fm10k_pci.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ static void fm10k_configure_tx_ring(struct fm10k_intfc *interface,
579579
u64 tdba = ring->dma;
580580
u32 size = ring->count * sizeof(struct fm10k_tx_desc);
581581
u32 txint = FM10K_INT_MAP_DISABLE;
582-
u32 txdctl = FM10K_TXDCTL_ENABLE | (1 << FM10K_TXDCTL_MAX_TIME_SHIFT);
582+
u32 txdctl = (1 << FM10K_TXDCTL_MAX_TIME_SHIFT) | FM10K_TXDCTL_ENABLE;
583583
u8 reg_idx = ring->reg_idx;
584584

585585
/* disable queue to avoid issues while updating state */
@@ -903,8 +903,8 @@ static irqreturn_t fm10k_msix_mbx_vf(int __always_unused irq, void *data)
903903

904904
/* re-enable mailbox interrupt and indicate 20us delay */
905905
fm10k_write_reg(hw, FM10K_VFITR(FM10K_MBX_VECTOR),
906-
FM10K_ITR_ENABLE | (FM10K_MBX_INT_DELAY >>
907-
hw->mac.itr_scale));
906+
(FM10K_MBX_INT_DELAY >> hw->mac.itr_scale) |
907+
FM10K_ITR_ENABLE);
908908

909909
/* service upstream mailbox */
910910
if (fm10k_mbx_trylock(interface)) {
@@ -1135,8 +1135,8 @@ static irqreturn_t fm10k_msix_mbx_pf(int __always_unused irq, void *data)
11351135

11361136
/* re-enable mailbox interrupt and indicate 20us delay */
11371137
fm10k_write_reg(hw, FM10K_ITR(FM10K_MBX_VECTOR),
1138-
FM10K_ITR_ENABLE | (FM10K_MBX_INT_DELAY >>
1139-
hw->mac.itr_scale));
1138+
(FM10K_MBX_INT_DELAY >> hw->mac.itr_scale) |
1139+
FM10K_ITR_ENABLE);
11401140

11411141
return IRQ_HANDLED;
11421142
}
@@ -1253,7 +1253,7 @@ static int fm10k_mbx_request_irq_vf(struct fm10k_intfc *interface)
12531253
int err;
12541254

12551255
/* Use timer0 for interrupt moderation on the mailbox */
1256-
u32 itr = FM10K_INT_MAP_TIMER0 | entry->entry;
1256+
u32 itr = entry->entry | FM10K_INT_MAP_TIMER0;
12571257

12581258
/* register mailbox handlers */
12591259
err = hw->mbx.ops.register_handlers(&hw->mbx, vf_mbx_data);
@@ -1420,8 +1420,8 @@ static int fm10k_mbx_request_irq_pf(struct fm10k_intfc *interface)
14201420
int err;
14211421

14221422
/* Use timer0 for interrupt moderation on the mailbox */
1423-
u32 mbx_itr = FM10K_INT_MAP_TIMER0 | entry->entry;
1424-
u32 other_itr = FM10K_INT_MAP_IMMEDIATE | entry->entry;
1423+
u32 mbx_itr = entry->entry | FM10K_INT_MAP_TIMER0;
1424+
u32 other_itr = entry->entry | FM10K_INT_MAP_IMMEDIATE;
14251425

14261426
/* register mailbox handlers */
14271427
err = hw->mbx.ops.register_handlers(&hw->mbx, pf_mbx_data);

drivers/net/ethernet/intel/fm10k/fm10k_pf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,8 @@ static s32 fm10k_iov_assign_resources_pf(struct fm10k_hw *hw, u16 num_vfs,
711711
FM10K_RXDCTL_WRITE_BACK_MIN_DELAY |
712712
FM10K_RXDCTL_DROP_ON_EMPTY);
713713
fm10k_write_reg(hw, FM10K_RXQCTL(vf_q_idx),
714-
FM10K_RXQCTL_VF |
715-
(i << FM10K_RXQCTL_VF_SHIFT));
714+
(i << FM10K_RXQCTL_VF_SHIFT) |
715+
FM10K_RXQCTL_VF);
716716

717717
/* map queue pair to VF */
718718
fm10k_write_reg(hw, FM10K_TQMAP(qmap_idx), vf_q_idx);
@@ -987,7 +987,7 @@ static s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
987987
txqctl = ((u32)vf_vid << FM10K_TXQCTL_VID_SHIFT) |
988988
(vf_idx << FM10K_TXQCTL_TC_SHIFT) |
989989
FM10K_TXQCTL_VF | vf_idx;
990-
rxqctl = FM10K_RXQCTL_VF | (vf_idx << FM10K_RXQCTL_VF_SHIFT);
990+
rxqctl = (vf_idx << FM10K_RXQCTL_VF_SHIFT) | FM10K_RXQCTL_VF;
991991

992992
/* stop further DMA and reset queue ownership back to VF */
993993
for (i = vf_q_idx; i < (queues_per_pool + vf_q_idx); i++) {

0 commit comments

Comments
 (0)