Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966339AbbD2Pla (ORCPT ); Wed, 29 Apr 2015 11:41:30 -0400 Received: from mail-am1on0146.outbound.protection.outlook.com ([157.56.112.146]:43703 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966307AbbD2Pl1 (ORCPT ); Wed, 29 Apr 2015 11:41:27 -0400 X-Greylist: delayed 2042 seconds by postgrey-1.27 at vger.kernel.org; Wed, 29 Apr 2015 11:41:26 EDT Authentication-Results: grandegger.com; dkim=none (message not signed) header.d=none; From: Jeppe Ledet-Pedersen To: , , , , CC: , , , Jeppe Ledet-Pedersen Subject: [PATCH] net: can: xilinx_can: fix extended frame handling Date: Wed, 29 Apr 2015 17:05:01 +0200 Message-ID: <1430319901-19242-1-git-send-email-jlp@gomspace.com> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [77.243.61.136] X-ClientProxiedBy: DB4PR04CA0003.eurprd04.prod.outlook.com (25.160.41.13) To AM2PR04MB0626.eurprd04.prod.outlook.com (25.160.32.152) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM2PR04MB0626; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:AM2PR04MB0626;BCL:0;PCL:0;RULEID:;SRVR:AM2PR04MB0626; X-Forefront-PRVS: 05610E64EE X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(979002)(6009001)(6069001)(87976001)(92566002)(19580395003)(122386002)(106356001)(66066001)(50986999)(33646002)(229853001)(46102003)(40100003)(48376002)(2201001)(50466002)(86362001)(36756003)(19580405001)(50226001)(77156002)(47776003)(5001770100001)(42186005)(62966003)(7059030)(4001430100001)(2101003)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1102;SCL:1;SRVR:AM2PR04MB0626;H:localhost.localdomain;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; X-OriginatorOrg: gomspace.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2015 15:07:19.9308 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR04MB0626 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1647 Lines: 41 Using IDR_SRR in RXFIFO_ID to test for the presence of data is only valid for standard frames. For extended frames the bit is always 1 and IDR_RTR should be used instead. This patch switches the check to use CAN_RTR_FLAG which is correctly set when reading the ID. The patch also changes the DW1/DW2 to be read unconditionally, since this is necessary to remove the frame from the RXFIFO. Signed-off-by: Jeppe Ledet-Pedersen Acked-by: Kedareswara rao Appana --- drivers/net/can/xilinx_can.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 6c67643..0b27769 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -509,10 +509,11 @@ static int xcan_rx(struct net_device *ndev) cf->can_id |= CAN_RTR_FLAG; } - if (!(id_xcan & XCAN_IDR_SRR_MASK)) { - data[0] = priv->read_reg(priv, XCAN_RXFIFO_DW1_OFFSET); - data[1] = priv->read_reg(priv, XCAN_RXFIFO_DW2_OFFSET); + /* DW1/DW2 must always be read to remove message from RXFIFO */ + data[0] = priv->read_reg(priv, XCAN_RXFIFO_DW1_OFFSET); + data[1] = priv->read_reg(priv, XCAN_RXFIFO_DW2_OFFSET); + if (!(cf->can_id & CAN_RTR_FLAG)) { /* Change Xilinx CAN data format to socketCAN data format */ if (cf->can_dlc > 0) *(__be32 *)(cf->data) = cpu_to_be32(data[0]); -- 2.1.0 -- 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/