aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_lib.c
diff options
context:
space:
mode:
authorBrett Creeley <brett.creeley@intel.com>2019-02-08 15:50:51 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2019-03-19 19:51:08 -0400
commit16c3301b55668fe8b163cad5c6b4d064bfa7c6fc (patch)
tree614da67949a59fa8a923660ba673a0c254fb6e77 /drivers/net/ethernet/intel/ice/ice_lib.c
parent77ed84f49aeed11d72a3559e35d624706e364940 (diff)
ice: remove redundant variable and if condition
In ice_pf_rxq_wait we are using an unnecessary local variable and also we are checking if the timeout time was reached after the loop. Get rid of the local variable and return 0 right when we get a successful result. This makes it so we can return -ETIMEDOUT if we ever exit the loop because we know the timeout time has been hit. Signed-off-by: Brett Creeley <brett.creeley@intel.com> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_lib.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_lib.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index fa61203bee26..5215180d08a3 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -175,17 +175,14 @@ static int ice_pf_rxq_wait(struct ice_pf *pf, int pf_q, bool ena)
175 int i; 175 int i;
176 176
177 for (i = 0; i < ICE_Q_WAIT_MAX_RETRY; i++) { 177 for (i = 0; i < ICE_Q_WAIT_MAX_RETRY; i++) {
178 u32 rx_reg = rd32(&pf->hw, QRX_CTRL(pf_q)); 178 if (ena == !!(rd32(&pf->hw, QRX_CTRL(pf_q)) &
179 179 QRX_CTRL_QENA_STAT_M))
180 if (ena == !!(rx_reg & QRX_CTRL_QENA_STAT_M)) 180 return 0;
181 break;
182 181
183 usleep_range(20, 40); 182 usleep_range(20, 40);
184 } 183 }
185 if (i >= ICE_Q_WAIT_MAX_RETRY)
186 return -ETIMEDOUT;
187 184
188 return 0; 185 return -ETIMEDOUT;
189} 186}
190 187
191/** 188/**