lkml.org 
[lkml]   [2010]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH net-next-2.6 16/17] can: EG20T PCH: Fix incorrect return processing
Fix incorrect return processing

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.okisemi.com>
---
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


\
 
 \ /
  Last update: 2010-11-19 06:53    [W:0.032 / U:6.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site