aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
authorWolfgang Grandegger <wg@grandegger.com>2009-09-01 01:26:12 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-04 05:16:14 -0400
commit39e3ab6fded4d7e66e01a878f0cae23ddd480c3b (patch)
tree44439df4436f965269f8f795cdf048290a202ed7 /drivers/net/can
parentfab4e76373a614d3af624caedf18bee43fc6ca16 (diff)
can: add can_free_echo_skb() for upcoming drivers
This patch adds the function can_free_echo_skb to the CAN device interface to allow upcoming drivers to release echo skb's in case of error. Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/dev.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 1d29082d94ac..f0b9a1e1db46 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -315,7 +315,7 @@ void can_get_echo_skb(struct net_device *dev, int idx)
315{ 315{
316 struct can_priv *priv = netdev_priv(dev); 316 struct can_priv *priv = netdev_priv(dev);
317 317
318 if ((dev->flags & IFF_ECHO) && priv->echo_skb[idx]) { 318 if (priv->echo_skb[idx]) {
319 netif_rx(priv->echo_skb[idx]); 319 netif_rx(priv->echo_skb[idx]);
320 priv->echo_skb[idx] = NULL; 320 priv->echo_skb[idx] = NULL;
321 } 321 }
@@ -323,6 +323,22 @@ void can_get_echo_skb(struct net_device *dev, int idx)
323EXPORT_SYMBOL_GPL(can_get_echo_skb); 323EXPORT_SYMBOL_GPL(can_get_echo_skb);
324 324
325/* 325/*
326 * Remove the skb from the stack and free it.
327 *
328 * The function is typically called when TX failed.
329 */
330void can_free_echo_skb(struct net_device *dev, int idx)
331{
332 struct can_priv *priv = netdev_priv(dev);
333
334 if (priv->echo_skb[idx]) {
335 kfree_skb(priv->echo_skb[idx]);
336 priv->echo_skb[idx] = NULL;
337 }
338}
339EXPORT_SYMBOL_GPL(can_free_echo_skb);
340
341/*
326 * CAN device restart for bus-off recovery 342 * CAN device restart for bus-off recovery
327 */ 343 */
328void can_restart(unsigned long data) 344void can_restart(unsigned long data)