| .. | .. |
|---|
| 55 | 55 | #include <linux/workqueue.h> |
|---|
| 56 | 56 | #include <linux/can.h> |
|---|
| 57 | 57 | #include <linux/can/skb.h> |
|---|
| 58 | +#include <linux/can/can-ml.h> |
|---|
| 58 | 59 | |
|---|
| 59 | 60 | MODULE_ALIAS_LDISC(N_SLCAN); |
|---|
| 60 | 61 | MODULE_DESCRIPTION("serial line CAN interface"); |
|---|
| .. | .. |
|---|
| 152 | 153 | switch (*cmd) { |
|---|
| 153 | 154 | case 'r': |
|---|
| 154 | 155 | cf.can_id = CAN_RTR_FLAG; |
|---|
| 155 | | - /* fallthrough */ |
|---|
| 156 | + fallthrough; |
|---|
| 156 | 157 | case 't': |
|---|
| 157 | 158 | /* store dlc ASCII value and terminate SFF CAN ID string */ |
|---|
| 158 | 159 | cf.can_dlc = sl->rbuff[SLC_CMD_LEN + SLC_SFF_ID_LEN]; |
|---|
| .. | .. |
|---|
| 162 | 163 | break; |
|---|
| 163 | 164 | case 'R': |
|---|
| 164 | 165 | cf.can_id = CAN_RTR_FLAG; |
|---|
| 165 | | - /* fallthrough */ |
|---|
| 166 | + fallthrough; |
|---|
| 166 | 167 | case 'T': |
|---|
| 167 | 168 | cf.can_id |= CAN_EFF_FLAG; |
|---|
| 168 | 169 | /* store dlc ASCII value and terminate EFF CAN ID string */ |
|---|
| .. | .. |
|---|
| 345 | 346 | |
|---|
| 346 | 347 | rcu_read_lock(); |
|---|
| 347 | 348 | sl = rcu_dereference(tty->disc_data); |
|---|
| 348 | | - if (!sl) |
|---|
| 349 | | - goto out; |
|---|
| 350 | | - |
|---|
| 351 | | - schedule_work(&sl->tx_work); |
|---|
| 352 | | -out: |
|---|
| 349 | + if (sl) |
|---|
| 350 | + schedule_work(&sl->tx_work); |
|---|
| 353 | 351 | rcu_read_unlock(); |
|---|
| 354 | 352 | } |
|---|
| 355 | 353 | |
|---|
| .. | .. |
|---|
| 518 | 516 | int i; |
|---|
| 519 | 517 | char name[IFNAMSIZ]; |
|---|
| 520 | 518 | struct net_device *dev = NULL; |
|---|
| 519 | + struct can_ml_priv *can_ml; |
|---|
| 521 | 520 | struct slcan *sl; |
|---|
| 521 | + int size; |
|---|
| 522 | 522 | |
|---|
| 523 | 523 | for (i = 0; i < maxdev; i++) { |
|---|
| 524 | 524 | dev = slcan_devs[i]; |
|---|
| .. | .. |
|---|
| 532 | 532 | return NULL; |
|---|
| 533 | 533 | |
|---|
| 534 | 534 | sprintf(name, "slcan%d", i); |
|---|
| 535 | | - dev = alloc_netdev(sizeof(*sl), name, NET_NAME_UNKNOWN, slc_setup); |
|---|
| 535 | + size = ALIGN(sizeof(*sl), NETDEV_ALIGN) + sizeof(struct can_ml_priv); |
|---|
| 536 | + dev = alloc_netdev(size, name, NET_NAME_UNKNOWN, slc_setup); |
|---|
| 536 | 537 | if (!dev) |
|---|
| 537 | 538 | return NULL; |
|---|
| 538 | 539 | |
|---|
| 539 | 540 | dev->base_addr = i; |
|---|
| 540 | 541 | sl = netdev_priv(dev); |
|---|
| 542 | + can_ml = (void *)sl + ALIGN(sizeof(*sl), NETDEV_ALIGN); |
|---|
| 543 | + can_set_ml_priv(dev, can_ml); |
|---|
| 541 | 544 | |
|---|
| 542 | 545 | /* Initialize channel control data */ |
|---|
| 543 | 546 | sl->magic = SLCAN_MAGIC; |
|---|