+#endif /* CAN_BCM_H */
diff -N -u -r b/include/linux/can/core.h c/include/linux/can/core.h
--- b/include/linux/can/core.h 1970-01-01 01:00:00.000000000 +0100
-+++ c/include/linux/can/core.h 2007-03-08 12:03:06.000000000 +0100
-@@ -0,0 +1,62 @@
++++ c/include/linux/can/core.h 2007-03-09 17:24:11.000000000 +0100
+@@ -0,0 +1,56 @@
+/*
+ * linux/can/core.h
+ *
+ int protocol;
+ int capability;
+ struct proto_ops *ops;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+ struct proto *prot;
-+#else
-+ struct module *owner;
-+ int (*init)(struct sock *sk);
-+ size_t obj_size;
-+#endif
+};
+
+/* function prototypes for the CAN networklayer core (af_can.c) */
+#endif /* CAN_H */
diff -N -u -r b/net/can/af_can.c c/net/can/af_can.c
--- b/net/can/af_can.c 1970-01-01 01:00:00.000000000 +0100
-+++ c/net/can/af_can.c 2007-03-09 13:47:12.000000000 +0100
-@@ -0,0 +1,973 @@
++++ c/net/can/af_can.c 2007-03-09 17:25:16.000000000 +0100
+@@ -0,0 +1,934 @@
+/*
+ * af_can.c - Protocol family CAN core module
+ * (used by different CAN protocol modules)
+static int can_notifier(struct notifier_block *nb,
+ unsigned long msg, void *data);
+static int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
+static int can_rcv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt, struct net_device *orig_dev);
-+#else
-+static int can_rcv(struct sk_buff *skb, struct net_device *dev,
-+ struct packet_type *pt);
-+#endif
+static int can_rcv_filter(struct dev_rcv_lists *d, struct sk_buff *skb);
+static struct dev_rcv_lists *find_dev_rcv_lists(struct net_device *dev);
+static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask,
+static struct dev_rcv_lists rx_alldev_list;
+static spinlock_t rcv_lists_lock = SPIN_LOCK_UNLOCKED;
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+static struct kmem_cache *rcv_cache __read_mostly;
-+#else
-+static kmem_cache_t *rcv_cache;
-+#endif
+
+static struct packet_type can_packet = {
+ .type = __constant_htons(ETH_P_CAN),
+ return;
+ }
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+ if (proto_register(cp->prot, 0) != 0) {
+ return;
+ }
-+#endif
+ proto_tab[proto] = cp;
+
+ /* use generic ioctl function if the module doesn't bring its own */
+ printk(KERN_ERR "CAN: protocol %d is not registered\n", proto);
+ return;
+ }
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+ proto_unregister(cp->prot);
-+#endif
+ proto_tab[proto] = NULL;
+}
+
+
+ sock->ops = cp->ops;
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+ sk = sk_alloc(PF_CAN, GFP_KERNEL, cp->prot, 1);
+ if (!sk)
+ goto oom;
-+#else
-+ sk = sk_alloc(PF_CAN, GFP_KERNEL, 1, 0);
-+ if (!sk)
-+ goto oom;
-+ if (cp->obj_size &&
-+ !(sk->sk_protinfo = kmalloc(cp->obj_size, GFP_KERNEL))) {
-+ sk_free(sk);
-+ goto oom;
-+ }
-+ sk_set_owner(sk, proto_tab[protocol]->owner);
-+#endif
+ sock_init_data(sock, sk);
+ sk->sk_destruct = can_sock_destruct;
+
+ DBG("created sock: %p\n", sk);
+
+ ret = 0;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+ if (sk->sk_prot->init)
+ ret = sk->sk_prot->init(sk);
-+#else
-+ if (cp->init)
-+ ret = cp->init(sk);
-+#endif
+ if (ret) {
+ /* we must release sk */
+ sock_orphan(sk);
+ case SIOCGSTAMP:
+ return sock_get_timestamp(sk, (struct timeval __user *)arg);
+ default:
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+ return -ENOIOCTLCMD;
-+#else
-+ return dev_ioctl(cmd, (void __user *)arg);
-+#endif
+ }
+ return 0;
+}
+ return ret;
+}
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
+static int can_rcv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt, struct net_device *orig_dev)
-+#else
-+static int can_rcv(struct sk_buff *skb, struct net_device *dev,
-+ struct packet_type *pt)
-+#endif
+{
+ struct dev_rcv_lists *d;
+ int matches;
+#endif /* AF_CAN_H */
diff -N -u -r b/net/can/bcm.c c/net/can/bcm.c
--- b/net/can/bcm.c 1970-01-01 01:00:00.000000000 +0100
-+++ c/net/can/bcm.c 2007-03-09 13:47:12.000000000 +0100
-@@ -0,0 +1,1614 @@
++++ c/net/can/bcm.c 2007-03-09 17:26:51.000000000 +0100
+@@ -0,0 +1,1600 @@
+/*
+ * bcm.c - Broadcast Manager to filter/send (cyclic) CAN content
+ *
+#define BCM_CAP CAP_NET_RAW
+#endif
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+struct bcm_sock {
+ struct sock sk;
+ struct bcm_opt opt;
+ .ops = &bcm_ops,
+ .prot = &bcm_proto,
+};
-+#else
-+#define bcm_sk(sk) ((struct bcm_opt *)(sk)->sk_protinfo)
-+
-+static struct can_proto bcm_can_proto = {
-+ .type = SOCK_DGRAM,
-+ .protocol = CAN_BCM,
-+ .capability = BCM_CAP,
-+ .ops = &bcm_ops,
-+ .owner = THIS_MODULE,
-+ .obj_size = sizeof(struct bcm_opt),
-+ .init = bcm_init,
-+};
-+#endif
+
+#define CFSIZ sizeof(struct can_frame)
+#define OPSIZ sizeof(struct bcm_op)
+}
diff -N -u -r b/net/can/raw.c c/net/can/raw.c
--- b/net/can/raw.c 1970-01-01 01:00:00.000000000 +0100
-+++ c/net/can/raw.c 2007-03-09 13:47:12.000000000 +0100
-@@ -0,0 +1,738 @@
++++ c/net/can/raw.c 2007-03-09 17:27:37.000000000 +0100
+@@ -0,0 +1,724 @@
+/*
+ * raw.c - Raw sockets for protocol family CAN
+ *
+
+#undef CAN_RAW_SUPPORT_REBIND /* use bind on already bound socket */
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+struct raw_sock {
+ struct sock sk;
+ struct raw_opt opt;
+ .ops = &raw_ops,
+ .prot = &raw_proto,
+};
-+#else
-+#define raw_sk(sk) ((struct raw_opt *)(sk)->sk_protinfo)
-+
-+static struct can_proto raw_can_proto = {
-+ .type = SOCK_RAW,
-+ .protocol = CAN_RAW,
-+ .capability = RAW_CAP,
-+ .ops = &raw_ops,
-+ .owner = THIS_MODULE,
-+ .obj_size = sizeof(struct raw_opt),
-+ .init = raw_init,
-+};
-+#endif
+
+#define MASK_ALL 0
+
+#endif /* CAN_BCM_H */
diff -N -u -r a/include/linux/can/core.h c/include/linux/can/core.h
--- a/include/linux/can/core.h 1970-01-01 01:00:00.000000000 +0100
-+++ c/include/linux/can/core.h 2007-03-08 12:03:06.000000000 +0100
-@@ -0,0 +1,62 @@
++++ c/include/linux/can/core.h 2007-03-09 17:24:11.000000000 +0100
+@@ -0,0 +1,56 @@
+/*
+ * linux/can/core.h
+ *
+ int protocol;
+ int capability;
+ struct proto_ops *ops;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+ struct proto *prot;
-+#else
-+ struct module *owner;
-+ int (*init)(struct sock *sk);
-+ size_t obj_size;
-+#endif
+};
+
+/* function prototypes for the CAN networklayer core (af_can.c) */
M: muli@il.ibm.com
diff -N -u -r a/net/can/af_can.c c/net/can/af_can.c
--- a/net/can/af_can.c 1970-01-01 01:00:00.000000000 +0100
-+++ c/net/can/af_can.c 2007-03-09 13:47:12.000000000 +0100
-@@ -0,0 +1,973 @@
++++ c/net/can/af_can.c 2007-03-09 17:25:16.000000000 +0100
+@@ -0,0 +1,934 @@
+/*
+ * af_can.c - Protocol family CAN core module
+ * (used by different CAN protocol modules)
+static int can_notifier(struct notifier_block *nb,
+ unsigned long msg, void *data);
+static int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
+static int can_rcv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt, struct net_device *orig_dev);
-+#else
-+static int can_rcv(struct sk_buff *skb, struct net_device *dev,
-+ struct packet_type *pt);
-+#endif
+static int can_rcv_filter(struct dev_rcv_lists *d, struct sk_buff *skb);
+static struct dev_rcv_lists *find_dev_rcv_lists(struct net_device *dev);
+static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask,
+static struct dev_rcv_lists rx_alldev_list;
+static spinlock_t rcv_lists_lock = SPIN_LOCK_UNLOCKED;
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+static struct kmem_cache *rcv_cache __read_mostly;
-+#else
-+static kmem_cache_t *rcv_cache;
-+#endif
+
+static struct packet_type can_packet = {
+ .type = __constant_htons(ETH_P_CAN),
+ return;
+ }
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+ if (proto_register(cp->prot, 0) != 0) {
+ return;
+ }
-+#endif
+ proto_tab[proto] = cp;
+
+ /* use generic ioctl function if the module doesn't bring its own */
+ printk(KERN_ERR "CAN: protocol %d is not registered\n", proto);
+ return;
+ }
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+ proto_unregister(cp->prot);
-+#endif
+ proto_tab[proto] = NULL;
+}
+
+
+ sock->ops = cp->ops;
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+ sk = sk_alloc(PF_CAN, GFP_KERNEL, cp->prot, 1);
+ if (!sk)
+ goto oom;
-+#else
-+ sk = sk_alloc(PF_CAN, GFP_KERNEL, 1, 0);
-+ if (!sk)
-+ goto oom;
-+ if (cp->obj_size &&
-+ !(sk->sk_protinfo = kmalloc(cp->obj_size, GFP_KERNEL))) {
-+ sk_free(sk);
-+ goto oom;
-+ }
-+ sk_set_owner(sk, proto_tab[protocol]->owner);
-+#endif
+ sock_init_data(sock, sk);
+ sk->sk_destruct = can_sock_destruct;
+
+ DBG("created sock: %p\n", sk);
+
+ ret = 0;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+ if (sk->sk_prot->init)
+ ret = sk->sk_prot->init(sk);
-+#else
-+ if (cp->init)
-+ ret = cp->init(sk);
-+#endif
+ if (ret) {
+ /* we must release sk */
+ sock_orphan(sk);
+ case SIOCGSTAMP:
+ return sock_get_timestamp(sk, (struct timeval __user *)arg);
+ default:
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+ return -ENOIOCTLCMD;
-+#else
-+ return dev_ioctl(cmd, (void __user *)arg);
-+#endif
+ }
+ return 0;
+}
+ return ret;
+}
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
+static int can_rcv(struct sk_buff *skb, struct net_device *dev,
+ struct packet_type *pt, struct net_device *orig_dev)
-+#else
-+static int can_rcv(struct sk_buff *skb, struct net_device *dev,
-+ struct packet_type *pt)
-+#endif
+{
+ struct dev_rcv_lists *d;
+ int matches;
+#endif /* AF_CAN_H */
diff -N -u -r a/net/can/bcm.c c/net/can/bcm.c
--- a/net/can/bcm.c 1970-01-01 01:00:00.000000000 +0100
-+++ c/net/can/bcm.c 2007-03-09 13:47:12.000000000 +0100
-@@ -0,0 +1,1614 @@
++++ c/net/can/bcm.c 2007-03-09 17:26:51.000000000 +0100
+@@ -0,0 +1,1600 @@
+/*
+ * bcm.c - Broadcast Manager to filter/send (cyclic) CAN content
+ *
+#define BCM_CAP CAP_NET_RAW
+#endif
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+struct bcm_sock {
+ struct sock sk;
+ struct bcm_opt opt;
+ .ops = &bcm_ops,
+ .prot = &bcm_proto,
+};
-+#else
-+#define bcm_sk(sk) ((struct bcm_opt *)(sk)->sk_protinfo)
-+
-+static struct can_proto bcm_can_proto = {
-+ .type = SOCK_DGRAM,
-+ .protocol = CAN_BCM,
-+ .capability = BCM_CAP,
-+ .ops = &bcm_ops,
-+ .owner = THIS_MODULE,
-+ .obj_size = sizeof(struct bcm_opt),
-+ .init = bcm_init,
-+};
-+#endif
+
+#define CFSIZ sizeof(struct can_frame)
+#define OPSIZ sizeof(struct bcm_op)
+}
diff -N -u -r a/net/can/raw.c c/net/can/raw.c
--- a/net/can/raw.c 1970-01-01 01:00:00.000000000 +0100
-+++ c/net/can/raw.c 2007-03-09 13:47:12.000000000 +0100
-@@ -0,0 +1,738 @@
++++ c/net/can/raw.c 2007-03-09 17:27:37.000000000 +0100
+@@ -0,0 +1,724 @@
+/*
+ * raw.c - Raw sockets for protocol family CAN
+ *
+
+#undef CAN_RAW_SUPPORT_REBIND /* use bind on already bound socket */
+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13)
+struct raw_sock {
+ struct sock sk;
+ struct raw_opt opt;
+ .ops = &raw_ops,
+ .prot = &raw_proto,
+};
-+#else
-+#define raw_sk(sk) ((struct raw_opt *)(sk)->sk_protinfo)
-+
-+static struct can_proto raw_can_proto = {
-+ .type = SOCK_RAW,
-+ .protocol = CAN_RAW,
-+ .capability = RAW_CAP,
-+ .ops = &raw_ops,
-+ .owner = THIS_MODULE,
-+ .obj_size = sizeof(struct raw_opt),
-+ .init = raw_init,
-+};
-+#endif
+
+#define MASK_ALL 0
+