can: mcp251x: fix reception of standard RTR frames
authorMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 21 Oct 2010 06:37:10 +0000 (06:37 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Oct 2010 17:48:59 +0000 (10:48 -0700)
This patch sets the missing CAN_RTR_FLAG if a standard RTR frame is
received.
(For extended frames the CAN_RTR_FLAG was already set correctly.)

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/can/mcp251x.c

index 6aadc3e32bd5c8bc31c1d5c231e1e9ff99ae9188..7ab534aee4525ded6c8db75e0dde6cbd542d618d 100644 (file)
 #  define RXBSIDH_SHIFT 3
 #define RXBSIDL(n)  (((n) * 0x10) + 0x60 + RXBSIDL_OFF)
 #  define RXBSIDL_IDE   0x08
+#  define RXBSIDL_SRR   0x10
 #  define RXBSIDL_EID   3
 #  define RXBSIDL_SHIFT 5
 #define RXBEID8(n)  (((n) * 0x10) + 0x60 + RXBEID8_OFF)
@@ -475,6 +476,8 @@ static void mcp251x_hw_rx(struct spi_device *spi, int buf_idx)
                frame->can_id =
                        (buf[RXBSIDH_OFF] << RXBSIDH_SHIFT) |
                        (buf[RXBSIDL_OFF] >> RXBSIDL_SHIFT);
+               if (buf[RXBSIDL_OFF] & RXBSIDL_SRR)
+                       frame->can_id |= CAN_RTR_FLAG;
        }
        /* Data length */
        frame->can_dlc = get_can_dlc(buf[RXBDLC_OFF] & RXBDLC_LEN_MASK);