can: af_can: export can_sock_destruct()

In j1939 we need our own struct sock::sk_destruct callback. Export the
generic af_can can_sock_destruct() that allows us to chain-call it.

Fixes: 9d71dd0c70 ("can: add support of SAE J1939 protocol")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
This commit is contained in:
Oleksij Rempel 2019-11-07 11:55:42 +01:00 committed by Marc Kleine-Budde
parent 5aa4277d43
commit 975987e701
2 changed files with 3 additions and 1 deletions

View File

@ -65,5 +65,6 @@ extern void can_rx_unregister(struct net *net, struct net_device *dev,
void *data); void *data);
extern int can_send(struct sk_buff *skb, int loop); extern int can_send(struct sk_buff *skb, int loop);
void can_sock_destruct(struct sock *sk);
#endif /* !_CAN_CORE_H */ #endif /* !_CAN_CORE_H */

View File

@ -86,11 +86,12 @@ static atomic_t skbcounter = ATOMIC_INIT(0);
/* af_can socket functions */ /* af_can socket functions */
static void can_sock_destruct(struct sock *sk) void can_sock_destruct(struct sock *sk)
{ {
skb_queue_purge(&sk->sk_receive_queue); skb_queue_purge(&sk->sk_receive_queue);
skb_queue_purge(&sk->sk_error_queue); skb_queue_purge(&sk->sk_error_queue);
} }
EXPORT_SYMBOL(can_sock_destruct);
static const struct can_proto *can_get_proto(int protocol) static const struct can_proto *can_get_proto(int protocol)
{ {