diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2009-11-16 15:57:52 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-17 14:54:04 +0300 |
commit | 74ff60b29ec602322178d32cb2a82b24ddb884fc (patch) | |
tree | a40c1fbec527711284eabfe18d9f50eb097e877f /drivers/net/can/mscan/mscan.c | |
parent | 81593c1cea7afdcd653c77d626aa186993e39c91 (diff) | |
download | linux-74ff60b29ec602322178d32cb2a82b24ddb884fc.tar.xz |
net/can/mscan: replace hardcoded values with defines
Not all hardcoded values have been replaced as this made the code quite
unreadable. IMHO this compromise serves the purpose of readability.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/mscan/mscan.c')
-rw-r--r-- | drivers/net/can/mscan/mscan.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c index 20d1991b9094..263d1a9f0880 100644 --- a/drivers/net/can/mscan/mscan.c +++ b/drivers/net/can/mscan/mscan.c @@ -211,18 +211,23 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev) rtr = frame->can_id & CAN_RTR_FLAG; + /* RTR is always the lowest bit of interest, then IDs follow */ if (frame->can_id & CAN_EFF_FLAG) { - can_id = (frame->can_id & CAN_EFF_MASK) << 1; + can_id = (frame->can_id & CAN_EFF_MASK) + << (MSCAN_EFF_RTR_SHIFT + 1); if (rtr) - can_id |= 1; + can_id |= 1 << MSCAN_EFF_RTR_SHIFT; out_be16(®s->tx.idr3_2, can_id); can_id >>= 16; - can_id = (can_id & 0x7) | ((can_id << 2) & 0xffe0) | (3 << 3); + /* EFF_FLAGS are inbetween the IDs :( */ + can_id = (can_id & 0x7) | ((can_id << 2) & 0xffe0) + | MSCAN_EFF_FLAGS; } else { - can_id = (frame->can_id & CAN_SFF_MASK) << 5; + can_id = (frame->can_id & CAN_SFF_MASK) + << (MSCAN_SFF_RTR_SHIFT + 1); if (rtr) - can_id |= 1 << 4; + can_id |= 1 << MSCAN_SFF_RTR_SHIFT; } out_be16(®s->tx.idr1_0, can_id); |