>From 3f5bcfcc93ecc8634e5da95cc58a751e39a1ec9f Mon Sep 17 00:00:00 2001 Message-Id: <3f5bcfcc93ecc8634e5da95cc58a751e39a1ec9f.1439418772.git.romieu@fr.zoreil.com> From: Francois Romieu Date: Sun, 19 Apr 2015 00:23:51 +0200 Subject: [PATCH 1/5] atl1c: use return value where argument pointer makes no sense. X-Organisation: Land of Sunshine Inc. Signed-off-by: Francois Romieu --- drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 932bd18..282ec17 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c @@ -56,8 +56,7 @@ static int atl1c_stop_mac(struct atl1c_hw *hw); static void atl1c_disable_l0s_l1(struct atl1c_hw *hw); static void atl1c_set_aspm(struct atl1c_hw *hw, u16 link_speed); static void atl1c_start_mac(struct atl1c_adapter *adapter); -static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, - int *work_done, int work_to_do); +static int atl1c_clean_rx_irq(struct atl1c_adapter *adapter, int budget); static int atl1c_up(struct atl1c_adapter *adapter); static void atl1c_down(struct atl1c_adapter *adapter); static int atl1c_reset_mac(struct atl1c_hw *hw); @@ -1787,11 +1786,10 @@ static void atl1c_clean_rfd(struct atl1c_rfd_ring *rfd_ring, rfd_ring->next_to_clean = rfd_index; } -static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, - int *work_done, int work_to_do) +static int atl1c_clean_rx_irq(struct atl1c_adapter *adapter, int budget) { u16 rfd_num, rfd_index; - u16 count = 0; + u16 count; u16 length; struct pci_dev *pdev = adapter->pdev; struct net_device *netdev = adapter->netdev; @@ -1801,9 +1799,7 @@ static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter, struct atl1c_recv_ret_status *rrs; struct atl1c_buffer *buffer_info; - while (1) { - if (*work_done >= work_to_do) - break; + for (count = 0; count < budget; count++) { rrs = ATL1C_RRD_DESC(rrd_ring, rrd_ring->next_to_clean); if (likely(RRS_RXD_IS_VALID(rrs->word3))) { rfd_num = (rrs->word0 >> RRS_RX_RFD_CNT_SHIFT) & @@ -1857,12 +1853,11 @@ rrs_checked: __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan); } netif_receive_skb(skb); - - (*work_done)++; - count++; } if (count) atl1c_alloc_rx_buffer(adapter); + + return count; } /** @@ -1875,10 +1870,10 @@ static int atl1c_clean(struct napi_struct *napi, int budget) int work_done = 0; /* Keep link state information with original netdev */ - if (!netif_carrier_ok(adapter->netdev)) + if (unlikely(!netif_carrier_ok(adapter->netdev))) goto quit_polling; /* just enable one RXQ */ - atl1c_clean_rx_irq(adapter, &work_done, budget); + work_done = atl1c_clean_rx_irq(adapter, budget); if (work_done < budget) { quit_polling: -- 2.4.3