diff options
Diffstat (limited to 'drivers/net/dummy.c')
-rw-r--r-- | drivers/net/dummy.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index 2146cf74425e..60673bc292c0 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c | |||
@@ -11,7 +11,7 @@ | |||
11 | One solution is to set up a dummy link using PPP/SLIP/PLIP, | 11 | One solution is to set up a dummy link using PPP/SLIP/PLIP, |
12 | but this seems (to me) too much overhead for too little gain. | 12 | but this seems (to me) too much overhead for too little gain. |
13 | This driver provides a small alternative. Thus you can do | 13 | This driver provides a small alternative. Thus you can do |
14 | 14 | ||
15 | [when not running slip] | 15 | [when not running slip] |
16 | ifconfig dummy slip.addr.ess.here up | 16 | ifconfig dummy slip.addr.ess.here up |
17 | [to go to slip] | 17 | [to go to slip] |
@@ -44,9 +44,9 @@ static int dummy_set_address(struct net_device *dev, void *p) | |||
44 | { | 44 | { |
45 | struct sockaddr *sa = p; | 45 | struct sockaddr *sa = p; |
46 | 46 | ||
47 | if (!is_valid_ether_addr(sa->sa_data)) | 47 | if (!is_valid_ether_addr(sa->sa_data)) |
48 | return -EADDRNOTAVAIL; | 48 | return -EADDRNOTAVAIL; |
49 | 49 | ||
50 | memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN); | 50 | memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN); |
51 | return 0; | 51 | return 0; |
52 | } | 52 | } |
@@ -111,7 +111,7 @@ static int __init dummy_init_one(int index) | |||
111 | free_netdev(dev_dummy); | 111 | free_netdev(dev_dummy); |
112 | dev_dummy = NULL; | 112 | dev_dummy = NULL; |
113 | } else { | 113 | } else { |
114 | dummies[index] = dev_dummy; | 114 | dummies[index] = dev_dummy; |
115 | } | 115 | } |
116 | 116 | ||
117 | return err; | 117 | return err; |
@@ -121,30 +121,30 @@ static void dummy_free_one(int index) | |||
121 | { | 121 | { |
122 | unregister_netdev(dummies[index]); | 122 | unregister_netdev(dummies[index]); |
123 | free_netdev(dummies[index]); | 123 | free_netdev(dummies[index]); |
124 | } | 124 | } |
125 | 125 | ||
126 | static int __init dummy_init_module(void) | 126 | static int __init dummy_init_module(void) |
127 | { | 127 | { |
128 | int i, err = 0; | 128 | int i, err = 0; |
129 | dummies = kmalloc(numdummies * sizeof(void *), GFP_KERNEL); | 129 | dummies = kmalloc(numdummies * sizeof(void *), GFP_KERNEL); |
130 | if (!dummies) | 130 | if (!dummies) |
131 | return -ENOMEM; | 131 | return -ENOMEM; |
132 | for (i = 0; i < numdummies && !err; i++) | 132 | for (i = 0; i < numdummies && !err; i++) |
133 | err = dummy_init_one(i); | 133 | err = dummy_init_one(i); |
134 | if (err) { | 134 | if (err) { |
135 | i--; | 135 | i--; |
136 | while (--i >= 0) | 136 | while (--i >= 0) |
137 | dummy_free_one(i); | 137 | dummy_free_one(i); |
138 | } | 138 | } |
139 | return err; | 139 | return err; |
140 | } | 140 | } |
141 | 141 | ||
142 | static void __exit dummy_cleanup_module(void) | 142 | static void __exit dummy_cleanup_module(void) |
143 | { | 143 | { |
144 | int i; | 144 | int i; |
145 | for (i = 0; i < numdummies; i++) | 145 | for (i = 0; i < numdummies; i++) |
146 | dummy_free_one(i); | 146 | dummy_free_one(i); |
147 | kfree(dummies); | 147 | kfree(dummies); |
148 | } | 148 | } |
149 | 149 | ||
150 | module_init(dummy_init_module); | 150 | module_init(dummy_init_module); |