2 * Copyright (C) 2005 Marc Kleine-Budde, Pengutronix
3 * Copyright (C) 2006 Andrey Volkov, Varma Electronics
4 * Copyright (C) 2008-2009 Wolfgang Grandegger <wg@grandegger.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the version 2 of the GNU General Public License
8 * as published by the Free Software Foundation
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <linux/module.h>
21 #include <linux/kernel.h>
22 #include <linux/slab.h>
23 #include <linux/netdevice.h>
24 #include <linux/if_arp.h>
25 #include <linux/can.h>
26 #include <linux/can/dev.h>
27 #include <linux/can/netlink.h>
28 #include <net/rtnetlink.h>
30 #define MOD_DESC "CAN device driver interface"
32 MODULE_DESCRIPTION(MOD_DESC
);
33 MODULE_LICENSE("GPL v2");
34 MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>");
36 #ifdef CONFIG_CAN_CALC_BITTIMING
37 #define CAN_CALC_MAX_ERROR 50 /* in one-tenth of a percent */
40 * Bit-timing calculation derived from:
42 * Code based on LinCAN sources and H8S2638 project
43 * Copyright 2004-2006 Pavel Pisa - DCE FELK CVUT cz
44 * Copyright 2005 Stanislav Marek
45 * email: pisa@cmp.felk.cvut.cz
47 * Calculates proper bit-timing parameters for a specified bit-rate
48 * and sample-point, which can then be used to set the bit-timing
49 * registers of the CAN controller. You can find more information
50 * in the header file linux/can/netlink.h.
52 static int can_update_spt(const struct can_bittiming_const
*btc
,
53 int sampl_pt
, int tseg
, int *tseg1
, int *tseg2
)
55 *tseg2
= tseg
+ 1 - (sampl_pt
* (tseg
+ 1)) / 1000;
56 if (*tseg2
< btc
->tseg2_min
)
57 *tseg2
= btc
->tseg2_min
;
58 if (*tseg2
> btc
->tseg2_max
)
59 *tseg2
= btc
->tseg2_max
;
60 *tseg1
= tseg
- *tseg2
;
61 if (*tseg1
> btc
->tseg1_max
) {
62 *tseg1
= btc
->tseg1_max
;
63 *tseg2
= tseg
- *tseg1
;
65 return 1000 * (tseg
+ 1 - *tseg2
) / (tseg
+ 1);
68 static int can_calc_bittiming(struct net_device
*dev
, struct can_bittiming
*bt
)
70 struct can_priv
*priv
= netdev_priv(dev
);
71 const struct can_bittiming_const
*btc
= priv
->bittiming_const
;
72 long rate
, best_rate
= 0;
73 long best_error
= 1000000000, error
= 0;
74 int best_tseg
= 0, best_brp
= 0, brp
= 0;
75 int tsegall
, tseg
= 0, tseg1
= 0, tseg2
= 0;
76 int spt_error
= 1000, spt
= 0, sampl_pt
;
79 if (!priv
->bittiming_const
)
82 /* Use CIA recommended sample points */
83 if (bt
->sample_point
) {
84 sampl_pt
= bt
->sample_point
;
86 if (bt
->bitrate
> 800000)
88 else if (bt
->bitrate
> 500000)
94 /* tseg even = round down, odd = round up */
95 for (tseg
= (btc
->tseg1_max
+ btc
->tseg2_max
) * 2 + 1;
96 tseg
>= (btc
->tseg1_min
+ btc
->tseg2_min
) * 2; tseg
--) {
97 tsegall
= 1 + tseg
/ 2;
98 /* Compute all possible tseg choices (tseg=tseg1+tseg2) */
99 brp
= priv
->clock
.freq
/ (tsegall
* bt
->bitrate
) + tseg
% 2;
100 /* chose brp step which is possible in system */
101 brp
= (brp
/ btc
->brp_inc
) * btc
->brp_inc
;
102 if ((brp
< btc
->brp_min
) || (brp
> btc
->brp_max
))
104 rate
= priv
->clock
.freq
/ (brp
* tsegall
);
105 error
= bt
->bitrate
- rate
;
106 /* tseg brp biterror */
109 if (error
> best_error
)
113 spt
= can_update_spt(btc
, sampl_pt
, tseg
/ 2,
115 error
= sampl_pt
- spt
;
118 if (error
> spt_error
)
122 best_tseg
= tseg
/ 2;
130 /* Error in one-tenth of a percent */
131 error
= (best_error
* 1000) / bt
->bitrate
;
132 if (error
> CAN_CALC_MAX_ERROR
) {
133 dev_err(dev
->dev
.parent
,
134 "bitrate error %ld.%ld%% too high\n",
135 error
/ 10, error
% 10);
138 dev_warn(dev
->dev
.parent
, "bitrate error %ld.%ld%%\n",
139 error
/ 10, error
% 10);
143 /* real sample point */
144 bt
->sample_point
= can_update_spt(btc
, sampl_pt
, best_tseg
,
147 v64
= (u64
)best_brp
* 1000000000UL;
148 do_div(v64
, priv
->clock
.freq
);
150 bt
->prop_seg
= tseg1
/ 2;
151 bt
->phase_seg1
= tseg1
- bt
->prop_seg
;
152 bt
->phase_seg2
= tseg2
;
154 /* check for sjw user settings */
155 if (!bt
->sjw
|| !btc
->sjw_max
)
158 /* bt->sjw is at least 1 -> sanitize upper bound to sjw_max */
159 if (bt
->sjw
> btc
->sjw_max
)
160 bt
->sjw
= btc
->sjw_max
;
161 /* bt->sjw must not be higher than tseg2 */
168 bt
->bitrate
= priv
->clock
.freq
/ (bt
->brp
* (tseg1
+ tseg2
+ 1));
172 #else /* !CONFIG_CAN_CALC_BITTIMING */
173 static int can_calc_bittiming(struct net_device
*dev
, struct can_bittiming
*bt
)
175 dev_err(dev
->dev
.parent
, "bit-timing calculation not available\n");
178 #endif /* CONFIG_CAN_CALC_BITTIMING */
181 * Checks the validity of the specified bit-timing parameters prop_seg,
182 * phase_seg1, phase_seg2 and sjw and tries to determine the bitrate
183 * prescaler value brp. You can find more information in the header
184 * file linux/can/netlink.h.
186 static int can_fixup_bittiming(struct net_device
*dev
, struct can_bittiming
*bt
)
188 struct can_priv
*priv
= netdev_priv(dev
);
189 const struct can_bittiming_const
*btc
= priv
->bittiming_const
;
193 if (!priv
->bittiming_const
)
196 tseg1
= bt
->prop_seg
+ bt
->phase_seg1
;
199 if (bt
->sjw
> btc
->sjw_max
||
200 tseg1
< btc
->tseg1_min
|| tseg1
> btc
->tseg1_max
||
201 bt
->phase_seg2
< btc
->tseg2_min
|| bt
->phase_seg2
> btc
->tseg2_max
)
204 brp64
= (u64
)priv
->clock
.freq
* (u64
)bt
->tq
;
205 if (btc
->brp_inc
> 1)
206 do_div(brp64
, btc
->brp_inc
);
207 brp64
+= 500000000UL - 1;
208 do_div(brp64
, 1000000000UL); /* the practicable BRP */
209 if (btc
->brp_inc
> 1)
210 brp64
*= btc
->brp_inc
;
211 bt
->brp
= (u32
)brp64
;
213 if (bt
->brp
< btc
->brp_min
|| bt
->brp
> btc
->brp_max
)
216 alltseg
= bt
->prop_seg
+ bt
->phase_seg1
+ bt
->phase_seg2
+ 1;
217 bt
->bitrate
= priv
->clock
.freq
/ (bt
->brp
* alltseg
);
218 bt
->sample_point
= ((tseg1
+ 1) * 1000) / alltseg
;
223 static int can_get_bittiming(struct net_device
*dev
, struct can_bittiming
*bt
)
225 struct can_priv
*priv
= netdev_priv(dev
);
228 /* Check if the CAN device has bit-timing parameters */
229 if (priv
->bittiming_const
) {
231 /* Non-expert mode? Check if the bitrate has been pre-defined */
233 /* Determine bit-timing parameters */
234 err
= can_calc_bittiming(dev
, bt
);
236 /* Check bit-timing params and calculate proper brp */
237 err
= can_fixup_bittiming(dev
, bt
);
246 * Local echo of CAN messages
248 * CAN network devices *should* support a local echo functionality
249 * (see Documentation/networking/can.txt). To test the handling of CAN
250 * interfaces that do not support the local echo both driver types are
251 * implemented. In the case that the driver does not support the echo
252 * the IFF_ECHO remains clear in dev->flags. This causes the PF_CAN core
253 * to perform the echo as a fallback solution.
255 static void can_flush_echo_skb(struct net_device
*dev
)
257 struct can_priv
*priv
= netdev_priv(dev
);
258 struct net_device_stats
*stats
= &dev
->stats
;
261 for (i
= 0; i
< priv
->echo_skb_max
; i
++) {
262 if (priv
->echo_skb
[i
]) {
263 kfree_skb(priv
->echo_skb
[i
]);
264 priv
->echo_skb
[i
] = NULL
;
266 stats
->tx_aborted_errors
++;
272 * Put the skb on the stack to be looped backed locally lateron
274 * The function is typically called in the start_xmit function
275 * of the device driver. The driver must protect access to
276 * priv->echo_skb, if necessary.
278 void can_put_echo_skb(struct sk_buff
*skb
, struct net_device
*dev
,
281 struct can_priv
*priv
= netdev_priv(dev
);
283 BUG_ON(idx
>= priv
->echo_skb_max
);
285 /* check flag whether this packet has to be looped back */
286 if (!(dev
->flags
& IFF_ECHO
) || skb
->pkt_type
!= PACKET_LOOPBACK
) {
291 if (!priv
->echo_skb
[idx
]) {
292 struct sock
*srcsk
= skb
->sk
;
294 if (atomic_read(&skb
->users
) != 1) {
295 struct sk_buff
*old_skb
= skb
;
297 skb
= skb_clone(old_skb
, GFP_ATOMIC
);
306 /* make settings for echo to reduce code in irq context */
307 skb
->protocol
= htons(ETH_P_CAN
);
308 skb
->pkt_type
= PACKET_BROADCAST
;
309 skb
->ip_summed
= CHECKSUM_UNNECESSARY
;
312 /* save this skb for tx interrupt echo handling */
313 priv
->echo_skb
[idx
] = skb
;
315 /* locking problem with netif_stop_queue() ?? */
316 dev_err(dev
->dev
.parent
, "%s: BUG! echo_skb is occupied!\n",
321 EXPORT_SYMBOL_GPL(can_put_echo_skb
);
324 * Get the skb from the stack and loop it back locally
326 * The function is typically called when the TX done interrupt
327 * is handled in the device driver. The driver must protect
328 * access to priv->echo_skb, if necessary.
330 void can_get_echo_skb(struct net_device
*dev
, unsigned int idx
)
332 struct can_priv
*priv
= netdev_priv(dev
);
334 BUG_ON(idx
>= priv
->echo_skb_max
);
336 if (priv
->echo_skb
[idx
]) {
337 netif_rx(priv
->echo_skb
[idx
]);
338 priv
->echo_skb
[idx
] = NULL
;
341 EXPORT_SYMBOL_GPL(can_get_echo_skb
);
344 * Remove the skb from the stack and free it.
346 * The function is typically called when TX failed.
348 void can_free_echo_skb(struct net_device
*dev
, unsigned int idx
)
350 struct can_priv
*priv
= netdev_priv(dev
);
352 BUG_ON(idx
>= priv
->echo_skb_max
);
354 if (priv
->echo_skb
[idx
]) {
355 kfree_skb(priv
->echo_skb
[idx
]);
356 priv
->echo_skb
[idx
] = NULL
;
359 EXPORT_SYMBOL_GPL(can_free_echo_skb
);
362 * CAN device restart for bus-off recovery
364 void can_restart(unsigned long data
)
366 struct net_device
*dev
= (struct net_device
*)data
;
367 struct can_priv
*priv
= netdev_priv(dev
);
368 struct net_device_stats
*stats
= &dev
->stats
;
370 struct can_frame
*cf
;
373 BUG_ON(netif_carrier_ok(dev
));
376 * No synchronization needed because the device is bus-off and
377 * no messages can come in or go out.
379 can_flush_echo_skb(dev
);
381 /* send restart message upstream */
382 skb
= alloc_can_err_skb(dev
, &cf
);
387 cf
->can_id
|= CAN_ERR_RESTARTED
;
392 stats
->rx_bytes
+= cf
->can_dlc
;
395 dev_dbg(dev
->dev
.parent
, "restarted\n");
396 priv
->can_stats
.restarts
++;
398 /* Now restart the device */
399 err
= priv
->do_set_mode(dev
, CAN_MODE_START
);
401 netif_carrier_on(dev
);
403 dev_err(dev
->dev
.parent
, "Error %d during restart", err
);
406 int can_restart_now(struct net_device
*dev
)
408 struct can_priv
*priv
= netdev_priv(dev
);
411 * A manual restart is only permitted if automatic restart is
412 * disabled and the device is in the bus-off state
414 if (priv
->restart_ms
)
416 if (priv
->state
!= CAN_STATE_BUS_OFF
)
419 /* Runs as soon as possible in the timer context */
420 mod_timer(&priv
->restart_timer
, jiffies
);
428 * This functions should be called when the device goes bus-off to
429 * tell the netif layer that no more packets can be sent or received.
430 * If enabled, a timer is started to trigger bus-off recovery.
432 void can_bus_off(struct net_device
*dev
)
434 struct can_priv
*priv
= netdev_priv(dev
);
436 dev_dbg(dev
->dev
.parent
, "bus-off\n");
438 netif_carrier_off(dev
);
439 priv
->can_stats
.bus_off
++;
441 if (priv
->restart_ms
)
442 mod_timer(&priv
->restart_timer
,
443 jiffies
+ (priv
->restart_ms
* HZ
) / 1000);
445 EXPORT_SYMBOL_GPL(can_bus_off
);
447 static void can_setup(struct net_device
*dev
)
449 dev
->type
= ARPHRD_CAN
;
450 dev
->mtu
= sizeof(struct can_frame
);
451 dev
->hard_header_len
= 0;
453 dev
->tx_queue_len
= 10;
455 /* New-style flags. */
456 dev
->flags
= IFF_NOARP
;
457 dev
->features
= NETIF_F_NO_CSUM
;
460 struct sk_buff
*alloc_can_skb(struct net_device
*dev
, struct can_frame
**cf
)
464 skb
= netdev_alloc_skb(dev
, sizeof(struct can_frame
));
468 skb
->protocol
= htons(ETH_P_CAN
);
469 skb
->pkt_type
= PACKET_BROADCAST
;
470 skb
->ip_summed
= CHECKSUM_UNNECESSARY
;
471 *cf
= (struct can_frame
*)skb_put(skb
, sizeof(struct can_frame
));
472 memset(*cf
, 0, sizeof(struct can_frame
));
476 EXPORT_SYMBOL_GPL(alloc_can_skb
);
478 struct sk_buff
*alloc_can_err_skb(struct net_device
*dev
, struct can_frame
**cf
)
482 skb
= alloc_can_skb(dev
, cf
);
486 (*cf
)->can_id
= CAN_ERR_FLAG
;
487 (*cf
)->can_dlc
= CAN_ERR_DLC
;
491 EXPORT_SYMBOL_GPL(alloc_can_err_skb
);
494 * Allocate and setup space for the CAN network device
496 struct net_device
*alloc_candev(int sizeof_priv
, unsigned int echo_skb_max
)
498 struct net_device
*dev
;
499 struct can_priv
*priv
;
503 size
= ALIGN(sizeof_priv
, sizeof(struct sk_buff
*)) +
504 echo_skb_max
* sizeof(struct sk_buff
*);
508 dev
= alloc_netdev(size
, "can%d", can_setup
);
512 priv
= netdev_priv(dev
);
515 priv
->echo_skb_max
= echo_skb_max
;
516 priv
->echo_skb
= (void *)priv
+
517 ALIGN(sizeof_priv
, sizeof(struct sk_buff
*));
520 priv
->state
= CAN_STATE_STOPPED
;
522 init_timer(&priv
->restart_timer
);
526 EXPORT_SYMBOL_GPL(alloc_candev
);
529 * Free space of the CAN network device
531 void free_candev(struct net_device
*dev
)
535 EXPORT_SYMBOL_GPL(free_candev
);
538 * Common open function when the device gets opened.
540 * This function should be called in the open function of the device
543 int open_candev(struct net_device
*dev
)
545 struct can_priv
*priv
= netdev_priv(dev
);
547 if (!priv
->bittiming
.tq
&& !priv
->bittiming
.bitrate
) {
548 dev_err(dev
->dev
.parent
, "bit-timing not yet defined\n");
552 /* Switch carrier on if device was stopped while in bus-off state */
553 if (!netif_carrier_ok(dev
))
554 netif_carrier_on(dev
);
556 setup_timer(&priv
->restart_timer
, can_restart
, (unsigned long)dev
);
560 EXPORT_SYMBOL_GPL(open_candev
);
563 * Common close function for cleanup before the device gets closed.
565 * This function should be called in the close function of the device
568 void close_candev(struct net_device
*dev
)
570 struct can_priv
*priv
= netdev_priv(dev
);
572 if (del_timer_sync(&priv
->restart_timer
))
574 can_flush_echo_skb(dev
);
576 EXPORT_SYMBOL_GPL(close_candev
);
579 * CAN netlink interface
581 static const struct nla_policy can_policy
[IFLA_CAN_MAX
+ 1] = {
582 [IFLA_CAN_STATE
] = { .type
= NLA_U32
},
583 [IFLA_CAN_CTRLMODE
] = { .len
= sizeof(struct can_ctrlmode
) },
584 [IFLA_CAN_RESTART_MS
] = { .type
= NLA_U32
},
585 [IFLA_CAN_RESTART
] = { .type
= NLA_U32
},
586 [IFLA_CAN_BITTIMING
] = { .len
= sizeof(struct can_bittiming
) },
587 [IFLA_CAN_BITTIMING_CONST
]
588 = { .len
= sizeof(struct can_bittiming_const
) },
589 [IFLA_CAN_CLOCK
] = { .len
= sizeof(struct can_clock
) },
590 [IFLA_CAN_BERR_COUNTER
] = { .len
= sizeof(struct can_berr_counter
) },
593 static int can_changelink(struct net_device
*dev
,
594 struct nlattr
*tb
[], struct nlattr
*data
[])
596 struct can_priv
*priv
= netdev_priv(dev
);
599 /* We need synchronization with dev->stop() */
602 if (data
[IFLA_CAN_CTRLMODE
]) {
603 struct can_ctrlmode
*cm
;
605 /* Do not allow changing controller mode while running */
606 if (dev
->flags
& IFF_UP
)
608 cm
= nla_data(data
[IFLA_CAN_CTRLMODE
]);
609 if (cm
->flags
& ~priv
->ctrlmode_supported
)
611 priv
->ctrlmode
&= ~cm
->mask
;
612 priv
->ctrlmode
|= cm
->flags
;
615 if (data
[IFLA_CAN_BITTIMING
]) {
616 struct can_bittiming bt
;
618 /* Do not allow changing bittiming while running */
619 if (dev
->flags
& IFF_UP
)
621 memcpy(&bt
, nla_data(data
[IFLA_CAN_BITTIMING
]), sizeof(bt
));
622 if ((!bt
.bitrate
&& !bt
.tq
) || (bt
.bitrate
&& bt
.tq
))
624 err
= can_get_bittiming(dev
, &bt
);
627 memcpy(&priv
->bittiming
, &bt
, sizeof(bt
));
629 if (priv
->do_set_bittiming
) {
630 /* Finally, set the bit-timing registers */
631 err
= priv
->do_set_bittiming(dev
);
637 if (data
[IFLA_CAN_RESTART_MS
]) {
638 /* Do not allow changing restart delay while running */
639 if (dev
->flags
& IFF_UP
)
641 priv
->restart_ms
= nla_get_u32(data
[IFLA_CAN_RESTART_MS
]);
644 if (data
[IFLA_CAN_RESTART
]) {
645 /* Do not allow a restart while not running */
646 if (!(dev
->flags
& IFF_UP
))
648 err
= can_restart_now(dev
);
656 static size_t can_get_size(const struct net_device
*dev
)
658 struct can_priv
*priv
= netdev_priv(dev
);
661 size
= nla_total_size(sizeof(u32
)); /* IFLA_CAN_STATE */
662 size
+= sizeof(struct can_ctrlmode
); /* IFLA_CAN_CTRLMODE */
663 size
+= nla_total_size(sizeof(u32
)); /* IFLA_CAN_RESTART_MS */
664 size
+= sizeof(struct can_bittiming
); /* IFLA_CAN_BITTIMING */
665 size
+= sizeof(struct can_clock
); /* IFLA_CAN_CLOCK */
666 if (priv
->do_get_berr_counter
) /* IFLA_CAN_BERR_COUNTER */
667 size
+= sizeof(struct can_berr_counter
);
668 if (priv
->bittiming_const
) /* IFLA_CAN_BITTIMING_CONST */
669 size
+= sizeof(struct can_bittiming_const
);
674 static int can_fill_info(struct sk_buff
*skb
, const struct net_device
*dev
)
676 struct can_priv
*priv
= netdev_priv(dev
);
677 struct can_ctrlmode cm
= {.flags
= priv
->ctrlmode
};
678 struct can_berr_counter bec
;
679 enum can_state state
= priv
->state
;
681 if (priv
->do_get_state
)
682 priv
->do_get_state(dev
, &state
);
683 NLA_PUT_U32(skb
, IFLA_CAN_STATE
, state
);
684 NLA_PUT(skb
, IFLA_CAN_CTRLMODE
, sizeof(cm
), &cm
);
685 NLA_PUT_U32(skb
, IFLA_CAN_RESTART_MS
, priv
->restart_ms
);
686 NLA_PUT(skb
, IFLA_CAN_BITTIMING
,
687 sizeof(priv
->bittiming
), &priv
->bittiming
);
688 NLA_PUT(skb
, IFLA_CAN_CLOCK
, sizeof(cm
), &priv
->clock
);
689 if (priv
->do_get_berr_counter
&& !priv
->do_get_berr_counter(dev
, &bec
))
690 NLA_PUT(skb
, IFLA_CAN_BERR_COUNTER
, sizeof(bec
), &bec
);
691 if (priv
->bittiming_const
)
692 NLA_PUT(skb
, IFLA_CAN_BITTIMING_CONST
,
693 sizeof(*priv
->bittiming_const
), priv
->bittiming_const
);
701 static size_t can_get_xstats_size(const struct net_device
*dev
)
703 return sizeof(struct can_device_stats
);
706 static int can_fill_xstats(struct sk_buff
*skb
, const struct net_device
*dev
)
708 struct can_priv
*priv
= netdev_priv(dev
);
710 NLA_PUT(skb
, IFLA_INFO_XSTATS
,
711 sizeof(priv
->can_stats
), &priv
->can_stats
);
719 static int can_newlink(struct net
*src_net
, struct net_device
*dev
,
720 struct nlattr
*tb
[], struct nlattr
*data
[])
725 static struct rtnl_link_ops can_link_ops __read_mostly
= {
727 .maxtype
= IFLA_CAN_MAX
,
728 .policy
= can_policy
,
730 .newlink
= can_newlink
,
731 .changelink
= can_changelink
,
732 .get_size
= can_get_size
,
733 .fill_info
= can_fill_info
,
734 .get_xstats_size
= can_get_xstats_size
,
735 .fill_xstats
= can_fill_xstats
,
739 * Register the CAN network device
741 int register_candev(struct net_device
*dev
)
743 dev
->rtnl_link_ops
= &can_link_ops
;
744 return register_netdev(dev
);
746 EXPORT_SYMBOL_GPL(register_candev
);
749 * Unregister the CAN network device
751 void unregister_candev(struct net_device
*dev
)
753 unregister_netdev(dev
);
755 EXPORT_SYMBOL_GPL(unregister_candev
);
757 static __init
int can_dev_init(void)
761 err
= rtnl_link_register(&can_link_ops
);
763 printk(KERN_INFO MOD_DESC
"\n");
767 module_init(can_dev_init
);
769 static __exit
void can_dev_exit(void)
771 rtnl_link_unregister(&can_link_ops
);
773 module_exit(can_dev_exit
);
775 MODULE_ALIAS_RTNL_LINK("can");