]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
The semantic of netdev_priv() changed in 2.6.27.
authorhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Tue, 7 Oct 2008 08:08:05 +0000 (08:08 +0000)
committerhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Tue, 7 Oct 2008 08:08:05 +0000 (08:08 +0000)
Detect VCAN devices via trnl_link_ops in newer kernels.

git-svn-id: svn://svn.berlios.de//socketcan/trunk@833 030b6a49-0b11-0410-94ab-b0dab22257f2

kernel/2.6/drivers/net/can/dev.c

index 94f39446f5efcecb6fcebba3a6f814f1679147a7..cd7dd0c675194dc883f509a58b635f935274af42 100644 (file)
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
-#include <linux/rtnetlink.h>
 #include <linux/can.h>
 #include <linux/can/dev.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+#include <net/rtnetlink.h>
+#endif
 
 #include "sysfs.h"
 
@@ -457,16 +459,22 @@ static int can_netdev_notifier_call(struct notifier_block *nb,
                                    void *ndev)
 {
        struct net_device *dev = ndev;
-       struct can_priv *priv;
 
        if (dev->type != ARPHRD_CAN)
                return 0;
 
-       priv = netdev_priv(dev);
-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+       /* omit virtual CAN software network devices */
+       if (dev->rtnl_link_ops) {
+               const struct rtnl_link_ops *ops = dev->rtnl_link_ops;
+               if (!strcmp(ops->kind, "vcan"))
+                       return 0;
+       }
+#else
        /* software CAN devices like 'vcan' do not have private data */
-       if (!priv)
+       if (!dev->priv)
                return 0;
+#endif
 
        switch (state) {
        case NETDEV_REGISTER: