diff options
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/Kconfig | 2 | ||||
-rw-r--r-- | drivers/net/can/dev.c | 15 | ||||
-rw-r--r-- | drivers/net/can/flexcan.c | 7 | ||||
-rw-r--r-- | drivers/net/can/janz-ican3.c | 20 | ||||
-rw-r--r-- | drivers/net/can/vcan.c | 9 |
5 files changed, 18 insertions, 35 deletions
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig index d447b881bbde..9e7d95dae2c7 100644 --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig | |||
@@ -104,7 +104,7 @@ config CAN_JANZ_ICAN3 | |||
104 | 104 | ||
105 | config CAN_FLEXCAN | 105 | config CAN_FLEXCAN |
106 | tristate "Support for Freescale FLEXCAN based chips" | 106 | tristate "Support for Freescale FLEXCAN based chips" |
107 | depends on (ARM && CPU_LITTLE_ENDIAN) || PPC | 107 | depends on ARM || PPC |
108 | ---help--- | 108 | ---help--- |
109 | Say Y here if you want to support for Freescale FlexCAN. | 109 | Say Y here if you want to support for Freescale FlexCAN. |
110 | 110 | ||
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 13a909822e25..fc59bc6f040b 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -323,19 +323,10 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, | |||
323 | } | 323 | } |
324 | 324 | ||
325 | if (!priv->echo_skb[idx]) { | 325 | if (!priv->echo_skb[idx]) { |
326 | struct sock *srcsk = skb->sk; | ||
327 | 326 | ||
328 | if (atomic_read(&skb->users) != 1) { | 327 | skb = can_create_echo_skb(skb); |
329 | struct sk_buff *old_skb = skb; | 328 | if (!skb) |
330 | 329 | return; | |
331 | skb = skb_clone(old_skb, GFP_ATOMIC); | ||
332 | kfree_skb(old_skb); | ||
333 | if (!skb) | ||
334 | return; | ||
335 | } else | ||
336 | skb_orphan(skb); | ||
337 | |||
338 | skb->sk = srcsk; | ||
339 | 330 | ||
340 | /* make settings for echo to reduce code in irq context */ | 331 | /* make settings for echo to reduce code in irq context */ |
341 | skb->protocol = htons(ETH_P_CAN); | 332 | skb->protocol = htons(ETH_P_CAN); |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index aaed97bee471..320bef2dba42 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -235,9 +235,12 @@ static const struct can_bittiming_const flexcan_bittiming_const = { | |||
235 | }; | 235 | }; |
236 | 236 | ||
237 | /* | 237 | /* |
238 | * Abstract off the read/write for arm versus ppc. | 238 | * Abstract off the read/write for arm versus ppc. This |
239 | * assumes that PPC uses big-endian registers and everything | ||
240 | * else uses little-endian registers, independent of CPU | ||
241 | * endianess. | ||
239 | */ | 242 | */ |
240 | #if defined(__BIG_ENDIAN) | 243 | #if defined(CONFIG_PPC) |
241 | static inline u32 flexcan_read(void __iomem *addr) | 244 | static inline u32 flexcan_read(void __iomem *addr) |
242 | { | 245 | { |
243 | return in_be32(addr); | 246 | return in_be32(addr); |
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c index e24e6690d672..71594e5676fd 100644 --- a/drivers/net/can/janz-ican3.c +++ b/drivers/net/can/janz-ican3.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/netdevice.h> | 18 | #include <linux/netdevice.h> |
19 | #include <linux/can.h> | 19 | #include <linux/can.h> |
20 | #include <linux/can/dev.h> | 20 | #include <linux/can/dev.h> |
21 | #include <linux/can/skb.h> | ||
21 | #include <linux/can/error.h> | 22 | #include <linux/can/error.h> |
22 | 23 | ||
23 | #include <linux/mfd/janz.h> | 24 | #include <linux/mfd/janz.h> |
@@ -1133,20 +1134,9 @@ static void ican3_handle_message(struct ican3_dev *mod, struct ican3_msg *msg) | |||
1133 | */ | 1134 | */ |
1134 | static void ican3_put_echo_skb(struct ican3_dev *mod, struct sk_buff *skb) | 1135 | static void ican3_put_echo_skb(struct ican3_dev *mod, struct sk_buff *skb) |
1135 | { | 1136 | { |
1136 | struct sock *srcsk = skb->sk; | 1137 | skb = can_create_echo_skb(skb); |
1137 | 1138 | if (!skb) | |
1138 | if (atomic_read(&skb->users) != 1) { | 1139 | return; |
1139 | struct sk_buff *old_skb = skb; | ||
1140 | |||
1141 | skb = skb_clone(old_skb, GFP_ATOMIC); | ||
1142 | kfree_skb(old_skb); | ||
1143 | if (!skb) | ||
1144 | return; | ||
1145 | } else { | ||
1146 | skb_orphan(skb); | ||
1147 | } | ||
1148 | |||
1149 | skb->sk = srcsk; | ||
1150 | 1140 | ||
1151 | /* save this skb for tx interrupt echo handling */ | 1141 | /* save this skb for tx interrupt echo handling */ |
1152 | skb_queue_tail(&mod->echoq, skb); | 1142 | skb_queue_tail(&mod->echoq, skb); |
@@ -1322,7 +1312,7 @@ static int ican3_napi(struct napi_struct *napi, int budget) | |||
1322 | 1312 | ||
1323 | /* process all communication messages */ | 1313 | /* process all communication messages */ |
1324 | while (true) { | 1314 | while (true) { |
1325 | struct ican3_msg msg; | 1315 | struct ican3_msg uninitialized_var(msg); |
1326 | ret = ican3_recv_msg(mod, &msg); | 1316 | ret = ican3_recv_msg(mod, &msg); |
1327 | if (ret) | 1317 | if (ret) |
1328 | break; | 1318 | break; |
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c index 0a2a5ee79a17..4e94057ef5cf 100644 --- a/drivers/net/can/vcan.c +++ b/drivers/net/can/vcan.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/if_ether.h> | 46 | #include <linux/if_ether.h> |
47 | #include <linux/can.h> | 47 | #include <linux/can.h> |
48 | #include <linux/can/dev.h> | 48 | #include <linux/can/dev.h> |
49 | #include <linux/can/skb.h> | ||
49 | #include <linux/slab.h> | 50 | #include <linux/slab.h> |
50 | #include <net/rtnetlink.h> | 51 | #include <net/rtnetlink.h> |
51 | 52 | ||
@@ -109,25 +110,23 @@ static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev) | |||
109 | stats->rx_packets++; | 110 | stats->rx_packets++; |
110 | stats->rx_bytes += cfd->len; | 111 | stats->rx_bytes += cfd->len; |
111 | } | 112 | } |
112 | kfree_skb(skb); | 113 | consume_skb(skb); |
113 | return NETDEV_TX_OK; | 114 | return NETDEV_TX_OK; |
114 | } | 115 | } |
115 | 116 | ||
116 | /* perform standard echo handling for CAN network interfaces */ | 117 | /* perform standard echo handling for CAN network interfaces */ |
117 | 118 | ||
118 | if (loop) { | 119 | if (loop) { |
119 | struct sock *srcsk = skb->sk; | ||
120 | 120 | ||
121 | skb = skb_share_check(skb, GFP_ATOMIC); | 121 | skb = can_create_echo_skb(skb); |
122 | if (!skb) | 122 | if (!skb) |
123 | return NETDEV_TX_OK; | 123 | return NETDEV_TX_OK; |
124 | 124 | ||
125 | /* receive with packet counting */ | 125 | /* receive with packet counting */ |
126 | skb->sk = srcsk; | ||
127 | vcan_rx(skb, dev); | 126 | vcan_rx(skb, dev); |
128 | } else { | 127 | } else { |
129 | /* no looped packets => no counting */ | 128 | /* no looped packets => no counting */ |
130 | kfree_skb(skb); | 129 | consume_skb(skb); |
131 | } | 130 | } |
132 | return NETDEV_TX_OK; | 131 | return NETDEV_TX_OK; |
133 | } | 132 | } |