add support for the AVR32 platform, namely the ATNGW100 board - joint work with wigyori
[openwrt.git] / target / linux / generic-2.4 / patches / 224-atm_hotplug.patch
1 diff -urN linux.old/include/linux/atmdev.h linux.dev/include/linux/atmdev.h
2 --- linux.old/include/linux/atmdev.h 2005-11-17 12:51:55.883585000 +0100
3 +++ linux.dev/include/linux/atmdev.h 2005-11-17 13:49:22.012671000 +0100
4 @@ -408,6 +408,7 @@
5 struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
6 int number,atm_dev_flags_t *flags); /* number == -1: pick first available */
7 struct atm_dev *atm_dev_lookup(int number);
8 +void atm_dev_set_link_status(struct atm_dev *dev, int status);
9 void atm_dev_deregister(struct atm_dev *dev);
10 void shutdown_atm_dev(struct atm_dev *dev);
11 void vcc_insert_socket(struct sock *sk);
12 diff -urN linux.old/net/atm/resources.c linux.dev/net/atm/resources.c
13 --- linux.old/net/atm/resources.c 2003-11-28 19:26:21.000000000 +0100
14 +++ linux.dev/net/atm/resources.c 2005-11-17 14:27:26.514267750 +0100
15 @@ -10,6 +10,7 @@
16 #include <linux/sonet.h>
17 #include <linux/kernel.h> /* for barrier */
18 #include <linux/module.h>
19 +#include <linux/kmod.h>
20 #include <linux/bitops.h>
21 #include <net/sock.h> /* for struct sock */
22 #include <asm/segment.h> /* for get_fs_long and put_fs_long */
23 @@ -70,6 +71,44 @@
24 return dev;
25 }
26
27 +#ifdef CONFIG_HOTPLUG
28 +static void atm_run_sbin_hotplug(struct atm_dev *dev, char *action)
29 +{
30 + char *argv[3], *envp[5], ifname[12 + IFNAMSIZ], atmname[255], action_str[32];
31 + int i;
32 +
33 + sprintf(ifname, "INTERFACE=atm%d", dev->number);
34 + sprintf(atmname, "ATMDRIVER=%s", dev->type);
35 + sprintf(action_str, "ACTION=%s", action);
36 +
37 + i = 0;
38 + argv[i++] = hotplug_path;
39 + argv[i++] = "net";
40 + argv[i] = 0;
41 +
42 + i = 0;
43 + /* minimal command environment */
44 + envp [i++] = "HOME=/";
45 + envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
46 + envp [i++] = ifname;
47 + envp [i++] = atmname;
48 + envp [i++] = action_str;
49 + envp [i] = 0;
50 +
51 + return call_usermodehelper(argv [0], argv, envp);
52 +}
53 +#endif
54 +
55 +void atm_dev_set_link_status(struct atm_dev *dev, int status)
56 +{
57 +#ifdef CONFIG_HOTPLUG
58 + if (status)
59 + atm_run_sbin_hotplug(dev, "up");
60 + else
61 + atm_run_sbin_hotplug(dev, "down");
62 +#endif
63 +}
64 +
65 struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
66 int number, atm_dev_flags_t *flags)
67 {
68 @@ -123,7 +162,10 @@
69 }
70 }
71 #endif
72 -
73 +#ifdef CONFIG_HOTPLUG
74 + atm_run_sbin_hotplug(dev, "register");
75 +#endif
76 +
77 return dev;
78 }
79
80 @@ -131,6 +173,10 @@
81 void atm_dev_deregister(struct atm_dev *dev)
82 {
83 unsigned long warning_time;
84 +
85 +#ifdef CONFIG_HOTPLUG
86 + atm_run_sbin_hotplug(dev, "unregister");
87 +#endif
88
89 #ifdef CONFIG_PROC_FS
90 if (dev->ops->proc_read)
91 @@ -399,6 +445,7 @@
92 }
93
94
95 +EXPORT_SYMBOL(atm_dev_set_link_status);
96 EXPORT_SYMBOL(atm_dev_register);
97 EXPORT_SYMBOL(atm_dev_deregister);
98 EXPORT_SYMBOL(atm_dev_lookup);
This page took 0.059355 seconds and 5 git commands to generate.