[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4CECC118.9070301@dsn.okisemi.com>
Date: Wed, 24 Nov 2010 16:39:04 +0900
From: Tomoya MORINAGA <tomoya-linux@....okisemi.com>
To: Wolfgang Grandegger <wg@...ndegger.com>,
Wolfram Sang <w.sang@...gutronix.de>,
Christian Pellegrin <chripell@...e.org>,
Barry Song <21cnbao@...il.com>,
Samuel Ortiz <sameo@...ux.intel.com>,
socketcan-core@...ts.berlios.de, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>
CC: qi.wang@...el.com, yong.y.wang@...el.com,
andrew.chih.howe.khor@...el.com, joel.clark@...el.com,
kok.howg.ewe@...el.com, margie.foster@...el.com
Subject: [PATCH net-next-2.6 16/17 v2] can: EG20T PCH: Fix incorrect return
processing
Fix incorrect return processing
Signed-off-by: Tomoya MORINAGA <tomoya-linux@....okisemi.com>
---
drivers/net/can/pch_can.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
index c612a99..ecb1a8c 100644
--- a/drivers/net/can/pch_can.c
+++ b/drivers/net/can/pch_can.c
@@ -589,9 +589,11 @@ 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);
+ if (!pch_can_int_pending(priv))
+ return IRQ_NONE;
+
pch_can_set_int_enables(priv, PCH_CAN_NONE);
napi_schedule(&priv->napi);
-
return IRQ_HANDLED;
}
@@ -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++;
@@ -685,8 +687,10 @@ static int pch_can_rx_normal(struct net_device
*ndev, u32 obj_num, int quota)
}
skb = alloc_can_skb(priv->ndev, &cf);
- if (!skb)
- return -ENOMEM;
+ if (!skb) {
+ netdev_err(ndev, "alloc_can_skb Failed\n");
+ return rcv_pkts;
+ }
/* Get Received data */
id2 = ioread32(&priv->regs->ifregs[0].id2);
@@ -747,8 +751,8 @@ static int pch_can_poll(struct napi_struct *napi,
int quota)
struct net_device *ndev = napi->dev;
struct pch_can_priv *priv = netdev_priv(ndev);
u32 int_stat;
- int rcv_pkts = 0;
u32 reg_stat;
+ int quota_save = quota;
int_stat = pch_can_int_pending(priv);
if (!int_stat)
@@ -777,10 +781,7 @@ 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)
- goto end;
+ quota -= pch_can_rx_normal(ndev, int_stat, quota);
} else if ((int_stat >= PCH_TX_OBJ_START) &&
(int_stat <= PCH_TX_OBJ_END)) {
/* Handle transmission interrupt */
@@ -791,7 +792,7 @@ end:
napi_complete(napi);
pch_can_set_int_enables(priv, PCH_CAN_ALL);
- return rcv_pkts;
+ return (quota_save - quota);
}
static int pch_set_bittiming(struct net_device *ndev)
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists