aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/vxcan.c
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2018-10-08 09:02:39 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2019-09-04 13:29:15 +0200
commit8df9ffb888c021fa68f9075d545f2ec5eca37200 (patch)
treec783503e0599f77685c82925a36bfa3f0a2a9794 /drivers/net/can/vxcan.c
parentcan: introduce CAN midlayer private and allocate it automatically (diff)
downloadlinux-dev-8df9ffb888c021fa68f9075d545f2ec5eca37200.tar.xz
linux-dev-8df9ffb888c021fa68f9075d545f2ec5eca37200.zip
can: make use of preallocated can_ml_priv for per device struct can_dev_rcv_lists
This patch removes the old method of allocating the per device protocol specific memory via a netdevice_notifier. This had the drawback, that the allocation can fail, leading to a lot of null pointer checks in the code. This also makes the live cycle management of this memory quite complicated. This patch switches from the allocating the struct can_dev_rcv_lists in a NETDEV_REGISTER call to using the dev->ml_priv, which is allocated by the driver since the previous patch. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/vxcan.c')
-rw-r--r--drivers/net/can/vxcan.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c
index 4c3eed796432..d6ba9426be4d 100644
--- a/drivers/net/can/vxcan.c
+++ b/drivers/net/can/vxcan.c
@@ -147,6 +147,7 @@ static void vxcan_setup(struct net_device *dev)
dev->flags = (IFF_NOARP|IFF_ECHO);
dev->netdev_ops = &vxcan_netdev_ops;
dev->needs_free_netdev = true;
+ dev->ml_priv = netdev_priv(dev) + ALIGN(sizeof(struct vxcan_priv), NETDEV_ALIGN);
}
/* forward declaration for rtnl_create_link() */