]> rtime.felk.cvut.cz Git - socketcan-devel.git/blob - patches/2.6.25.diff
Add kernel version depency for Kernel 3.1.x which extended __rtnl_register().
[socketcan-devel.git] / patches / 2.6.25.diff
1 diff -ruN linux-2.6.25-orig/drivers/net/can/Kconfig linux-2.6.25/drivers/net/can/Kconfig
2 --- linux-2.6.25-orig/drivers/net/can/Kconfig   2008-04-17 04:49:44.000000000 +0200
3 +++ linux-2.6.25/drivers/net/can/Kconfig        1970-01-01 01:00:00.000000000 +0100
4 @@ -1,25 +0,0 @@
5 -menu "CAN Device Drivers"
6 -       depends on CAN
7 -
8 -config CAN_VCAN
9 -       tristate "Virtual Local CAN Interface (vcan)"
10 -       depends on CAN
11 -       default N
12 -       ---help---
13 -         Similar to the network loopback devices, vcan offers a
14 -         virtual local CAN interface.
15 -
16 -         This driver can also be built as a module.  If so, the module
17 -         will be called vcan.
18 -
19 -config CAN_DEBUG_DEVICES
20 -       bool "CAN devices debugging messages"
21 -       depends on CAN
22 -       default N
23 -       ---help---
24 -         Say Y here if you want the CAN device drivers to produce a bunch of
25 -         debug messages to the system log.  Select this if you are having
26 -         a problem with CAN support and want to see more of what is going
27 -         on.
28 -
29 -endmenu
30 diff -ruN linux-2.6.25-orig/drivers/net/can/Makefile linux-2.6.25/drivers/net/can/Makefile
31 --- linux-2.6.25-orig/drivers/net/can/Makefile  2008-04-17 04:49:44.000000000 +0200
32 +++ linux-2.6.25/drivers/net/can/Makefile       1970-01-01 01:00:00.000000000 +0100
33 @@ -1,5 +0,0 @@
34 -#
35 -#  Makefile for the Linux Controller Area Network drivers.
36 -#
37 -
38 -obj-$(CONFIG_CAN_VCAN)         += vcan.o
39 diff -ruN linux-2.6.25-orig/drivers/net/can/vcan.c linux-2.6.25/drivers/net/can/vcan.c
40 --- linux-2.6.25-orig/drivers/net/can/vcan.c    2008-04-17 04:49:44.000000000 +0200
41 +++ linux-2.6.25/drivers/net/can/vcan.c 1970-01-01 01:00:00.000000000 +0100
42 @@ -1,169 +0,0 @@
43 -/*
44 - * vcan.c - Virtual CAN interface
45 - *
46 - * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
47 - * All rights reserved.
48 - *
49 - * Redistribution and use in source and binary forms, with or without
50 - * modification, are permitted provided that the following conditions
51 - * are met:
52 - * 1. Redistributions of source code must retain the above copyright
53 - *    notice, this list of conditions and the following disclaimer.
54 - * 2. Redistributions in binary form must reproduce the above copyright
55 - *    notice, this list of conditions and the following disclaimer in the
56 - *    documentation and/or other materials provided with the distribution.
57 - * 3. Neither the name of Volkswagen nor the names of its contributors
58 - *    may be used to endorse or promote products derived from this software
59 - *    without specific prior written permission.
60 - *
61 - * Alternatively, provided that this notice is retained in full, this
62 - * software may be distributed under the terms of the GNU General
63 - * Public License ("GPL") version 2, in which case the provisions of the
64 - * GPL apply INSTEAD OF those given above.
65 - *
66 - * The provided data structures and external interfaces from this code
67 - * are not restricted to be used by modules with a GPL compatible license.
68 - *
69 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
70 - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
71 - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
72 - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
73 - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
74 - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
75 - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
76 - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
77 - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
78 - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
79 - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
80 - * DAMAGE.
81 - *
82 - * Send feedback to <socketcan-users@lists.berlios.de>
83 - *
84 - */
85 -
86 -#include <linux/module.h>
87 -#include <linux/init.h>
88 -#include <linux/netdevice.h>
89 -#include <linux/if_arp.h>
90 -#include <linux/if_ether.h>
91 -#include <linux/can.h>
92 -#include <net/rtnetlink.h>
93 -
94 -static __initdata const char banner[] =
95 -       KERN_INFO "vcan: Virtual CAN interface driver\n";
96 -
97 -MODULE_DESCRIPTION("virtual CAN interface");
98 -MODULE_LICENSE("Dual BSD/GPL");
99 -MODULE_AUTHOR("Urs Thuermann <urs.thuermann@volkswagen.de>");
100 -
101 -
102 -/*
103 - * CAN test feature:
104 - * Enable the echo on driver level for testing the CAN core echo modes.
105 - * See Documentation/networking/can.txt for details.
106 - */
107 -
108 -static int echo; /* echo testing. Default: 0 (Off) */
109 -module_param(echo, bool, S_IRUGO);
110 -MODULE_PARM_DESC(echo, "Echo sent frames (for testing). Default: 0 (Off)");
111 -
112 -
113 -static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
114 -{
115 -       struct net_device_stats *stats = &dev->stats;
116 -
117 -       stats->rx_packets++;
118 -       stats->rx_bytes += skb->len;
119 -
120 -       skb->protocol  = htons(ETH_P_CAN);
121 -       skb->pkt_type  = PACKET_BROADCAST;
122 -       skb->dev       = dev;
123 -       skb->ip_summed = CHECKSUM_UNNECESSARY;
124 -
125 -       netif_rx(skb);
126 -}
127 -
128 -static int vcan_tx(struct sk_buff *skb, struct net_device *dev)
129 -{
130 -       struct net_device_stats *stats = &dev->stats;
131 -       int loop;
132 -
133 -       stats->tx_packets++;
134 -       stats->tx_bytes += skb->len;
135 -
136 -       /* set flag whether this packet has to be looped back */
137 -       loop = skb->pkt_type == PACKET_LOOPBACK;
138 -
139 -       if (!echo) {
140 -               /* no echo handling available inside this driver */
141 -
142 -               if (loop) {
143 -                       /*
144 -                        * only count the packets here, because the
145 -                        * CAN core already did the echo for us
146 -                        */
147 -                       stats->rx_packets++;
148 -                       stats->rx_bytes += skb->len;
149 -               }
150 -               kfree_skb(skb);
151 -               return NETDEV_TX_OK;
152 -       }
153 -
154 -       /* perform standard echo handling for CAN network interfaces */
155 -
156 -       if (loop) {
157 -               struct sock *srcsk = skb->sk;
158 -
159 -               skb = skb_share_check(skb, GFP_ATOMIC);
160 -               if (!skb)
161 -                       return NETDEV_TX_OK;
162 -
163 -               /* receive with packet counting */
164 -               skb->sk = srcsk;
165 -               vcan_rx(skb, dev);
166 -       } else {
167 -               /* no looped packets => no counting */
168 -               kfree_skb(skb);
169 -       }
170 -       return NETDEV_TX_OK;
171 -}
172 -
173 -static void vcan_setup(struct net_device *dev)
174 -{
175 -       dev->type              = ARPHRD_CAN;
176 -       dev->mtu               = sizeof(struct can_frame);
177 -       dev->hard_header_len   = 0;
178 -       dev->addr_len          = 0;
179 -       dev->tx_queue_len      = 0;
180 -       dev->flags             = IFF_NOARP;
181 -
182 -       /* set flags according to driver capabilities */
183 -       if (echo)
184 -               dev->flags |= IFF_ECHO;
185 -
186 -       dev->hard_start_xmit   = vcan_tx;
187 -       dev->destructor        = free_netdev;
188 -}
189 -
190 -static struct rtnl_link_ops vcan_link_ops __read_mostly = {
191 -       .kind           = "vcan",
192 -       .setup          = vcan_setup,
193 -};
194 -
195 -static __init int vcan_init_module(void)
196 -{
197 -       printk(banner);
198 -
199 -       if (echo)
200 -               printk(KERN_INFO "vcan: enabled echo on driver level.\n");
201 -
202 -       return rtnl_link_register(&vcan_link_ops);
203 -}
204 -
205 -static __exit void vcan_cleanup_module(void)
206 -{
207 -       rtnl_link_unregister(&vcan_link_ops);
208 -}
209 -
210 -module_init(vcan_init_module);
211 -module_exit(vcan_cleanup_module);