Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752289Ab0KSFv3 (ORCPT ); Fri, 19 Nov 2010 00:51:29 -0500 Received: from sm-d311v.smileserver.ne.jp ([203.211.202.206]:15215 "EHLO sm-d311v.smileserver.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751998Ab0KSFv1 (ORCPT ); Fri, 19 Nov 2010 00:51:27 -0500 Message-ID: <4CE6104C.3090401@dsn.okisemi.com> Date: Fri, 19 Nov 2010 14:51:08 +0900 From: Tomoya MORINAGA User-Agent: Mozilla/5.0 (X11; U; Linux i686; ja; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 MIME-Version: 1.0 To: Wolfgang Grandegger , Wolfram Sang , Christian Pellegrin , Barry Song <21cnbao@gmail.com>, Samuel Ortiz , socketcan-core@lists.berlios.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" CC: qi.wang@intel.com, yong.y.wang@intel.com, andrew.chih.howe.khor@intel.com, joel.clark@intel.com, kok.howg.ewe@intel.com, margie.foster@intel.com Subject: [PATCH net-next-2.6 16/17] can: EG20T PCH: Fix incorrect return processing Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1982 Lines: 61 Fix incorrect return processing Signed-off-by: Tomoya MORINAGA --- drivers/net/can/pch_can.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index c612a99..48f4a2e 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c @@ -589,10 +589,12 @@ static irqreturn_t pch_can_interrupt(int irq, void *dev_id) struct net_device *ndev = (struct net_device *)dev_id; struct pch_can_priv *priv = netdev_priv(ndev); - pch_can_set_int_enables(priv, PCH_CAN_NONE); - napi_schedule(&priv->napi); - - return IRQ_HANDLED; + if ((pch_can_int_pending(priv) > 0) && (dev_id != NULL)) { + pch_can_set_int_enables(priv, PCH_CAN_NONE); + napi_schedule(&priv->napi); + return IRQ_HANDLED; + } + return IRQ_NONE; } static void pch_fifo_thresh(struct pch_can_priv *priv, int obj_id) @@ -674,7 +676,7 @@ static int pch_can_rx_normal(struct net_device *ndev, u32 obj_num, int quota) if (reg & PCH_IF_MCONT_MSGLOST) { rtn = pch_can_rx_msg_lost(ndev, obj_num); if (!rtn) - return rtn; + return rcv_pkts; rcv_pkts++; quota--; obj_num++; @@ -777,10 +779,12 @@ static int pch_can_poll(struct napi_struct *napi, int quota) goto end; if ((int_stat >= PCH_RX_OBJ_START) && (int_stat <= PCH_RX_OBJ_END)) { - rcv_pkts += pch_can_rx_normal(ndev, int_stat, quota); - quota -= rcv_pkts; - if (quota < 0) + rcv_pkts = pch_can_rx_normal(ndev, int_stat, quota); + if (rcv_pkts < 0) { + rcv_pkts = 0; goto end; + } + quota -= rcv_pkts; } else if ((int_stat >= PCH_TX_OBJ_START) && (int_stat <= PCH_TX_OBJ_END)) { /* Handle transmission interrupt */ -- 1.6.0.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/