aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-07 22:22:26 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-07 22:22:26 -0500
commitf2aca47dc3c2d0c2d5dbd972558557e74232bbce (patch)
treeeae58f599a25a1f3ab41bf616a2b7c4b3c6e2277 /net
parent7677ced48e2bbbb8d847d34f37e5d96d2b0e41e4 (diff)
parentb592fcfe7f06c15ec11774b5be7ce0de3aa86e73 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (28 commits) sysfs: Shadow directory support Driver Core: Increase the default timeout value of the firmware subsystem Driver core: allow to delay the uevent at device creation time Driver core: add device_type to struct device Driver core: add uevent vars for devices of a class SYSFS: Fix missing include of list.h in sysfs.h HOWTO: Add a reference to Harbison and Steele sysfs: error handling in sysfs, fill_read_buffer() kobject: kobject_put cleanup sysfs: kobject_put cleanup sysfs: suppress lockdep warnings Driver core: fix race in sysfs between sysfs_remove_file() and read()/write() driver core: Change function call order in device_bind_driver(). driver core: Don't stop probing on ->probe errors. driver core fixes: device_register() retval check in platform.c driver core fixes: make_class_name() retval checks /sys/modules/*/holders USB: add the sysfs driver name to all modules SERIO: add the sysfs driver name to all modules PCI: add the sysfs driver name to all modules ...
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_if.c2
-rw-r--r--net/bridge/br_sysfs_br.c234
-rw-r--r--net/bridge/br_sysfs_if.c2
-rw-r--r--net/core/dev.c6
-rw-r--r--net/core/net-sysfs.c175
-rw-r--r--net/core/skbuff.c2
6 files changed, 226 insertions, 195 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 55bb2634c088..2b7c2c7dad48 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -286,7 +286,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
286 kobject_init(&p->kobj); 286 kobject_init(&p->kobj);
287 kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR); 287 kobject_set_name(&p->kobj, SYSFS_BRIDGE_PORT_ATTR);
288 p->kobj.ktype = &brport_ktype; 288 p->kobj.ktype = &brport_ktype;
289 p->kobj.parent = &(dev->class_dev.kobj); 289 p->kobj.parent = &(dev->dev.kobj);
290 p->kobj.kset = NULL; 290 p->kobj.kset = NULL;
291 291
292 return p; 292 return p;
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index de9d1a9473f2..ce10464716a7 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -21,18 +21,17 @@
21 21
22#include "br_private.h" 22#include "br_private.h"
23 23
24#define to_class_dev(obj) container_of(obj,struct class_device,kobj) 24#define to_dev(obj) container_of(obj, struct device, kobj)
25#define to_net_dev(class) container_of(class, struct net_device, class_dev)
26#define to_bridge(cd) ((struct net_bridge *)(to_net_dev(cd)->priv)) 25#define to_bridge(cd) ((struct net_bridge *)(to_net_dev(cd)->priv))
27 26
28/* 27/*
29 * Common code for storing bridge parameters. 28 * Common code for storing bridge parameters.
30 */ 29 */
31static ssize_t store_bridge_parm(struct class_device *cd, 30static ssize_t store_bridge_parm(struct device *d,
32 const char *buf, size_t len, 31 const char *buf, size_t len,
33 void (*set)(struct net_bridge *, unsigned long)) 32 void (*set)(struct net_bridge *, unsigned long))
34{ 33{
35 struct net_bridge *br = to_bridge(cd); 34 struct net_bridge *br = to_bridge(d);
36 char *endp; 35 char *endp;
37 unsigned long val; 36 unsigned long val;
38 37
@@ -50,9 +49,10 @@ static ssize_t store_bridge_parm(struct class_device *cd,
50} 49}
51 50
52 51
53static ssize_t show_forward_delay(struct class_device *cd, char *buf) 52static ssize_t show_forward_delay(struct device *d,
53 struct device_attribute *attr, char *buf)
54{ 54{
55 struct net_bridge *br = to_bridge(cd); 55 struct net_bridge *br = to_bridge(d);
56 return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->forward_delay)); 56 return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->forward_delay));
57} 57}
58 58
@@ -64,18 +64,20 @@ static void set_forward_delay(struct net_bridge *br, unsigned long val)
64 br->bridge_forward_delay = delay; 64 br->bridge_forward_delay = delay;
65} 65}
66 66
67static ssize_t store_forward_delay(struct class_device *cd, const char *buf, 67static ssize_t store_forward_delay(struct device *d,
68 size_t len) 68 struct device_attribute *attr,
69 const char *buf, size_t len)
69{ 70{
70 return store_bridge_parm(cd, buf, len, set_forward_delay); 71 return store_bridge_parm(d, buf, len, set_forward_delay);
71} 72}
72static CLASS_DEVICE_ATTR(forward_delay, S_IRUGO | S_IWUSR, 73static DEVICE_ATTR(forward_delay, S_IRUGO | S_IWUSR,
73 show_forward_delay, store_forward_delay); 74 show_forward_delay, store_forward_delay);
74 75
75static ssize_t show_hello_time(struct class_device *cd, char *buf) 76static ssize_t show_hello_time(struct device *d, struct device_attribute *attr,
77 char *buf)
76{ 78{
77 return sprintf(buf, "%lu\n", 79 return sprintf(buf, "%lu\n",
78 jiffies_to_clock_t(to_bridge(cd)->hello_time)); 80 jiffies_to_clock_t(to_bridge(d)->hello_time));
79} 81}
80 82
81static void set_hello_time(struct net_bridge *br, unsigned long val) 83static void set_hello_time(struct net_bridge *br, unsigned long val)
@@ -86,19 +88,20 @@ static void set_hello_time(struct net_bridge *br, unsigned long val)
86 br->bridge_hello_time = t; 88 br->bridge_hello_time = t;
87} 89}
88 90
89static ssize_t store_hello_time(struct class_device *cd, const char *buf, 91static ssize_t store_hello_time(struct device *d,
92 struct device_attribute *attr, const char *buf,
90 size_t len) 93 size_t len)
91{ 94{
92 return store_bridge_parm(cd, buf, len, set_hello_time); 95 return store_bridge_parm(d, buf, len, set_hello_time);
93} 96}
97static DEVICE_ATTR(hello_time, S_IRUGO | S_IWUSR, show_hello_time,
98 store_hello_time);
94 99
95static CLASS_DEVICE_ATTR(hello_time, S_IRUGO | S_IWUSR, show_hello_time, 100static ssize_t show_max_age(struct device *d, struct device_attribute *attr,
96 store_hello_time); 101 char *buf)
97
98static ssize_t show_max_age(struct class_device *cd, char *buf)
99{ 102{
100 return sprintf(buf, "%lu\n", 103 return sprintf(buf, "%lu\n",
101 jiffies_to_clock_t(to_bridge(cd)->max_age)); 104 jiffies_to_clock_t(to_bridge(d)->max_age));
102} 105}
103 106
104static void set_max_age(struct net_bridge *br, unsigned long val) 107static void set_max_age(struct net_bridge *br, unsigned long val)
@@ -109,18 +112,17 @@ static void set_max_age(struct net_bridge *br, unsigned long val)
109 br->bridge_max_age = t; 112 br->bridge_max_age = t;
110} 113}
111 114
112static ssize_t store_max_age(struct class_device *cd, const char *buf, 115static ssize_t store_max_age(struct device *d, struct device_attribute *attr,
113 size_t len) 116 const char *buf, size_t len)
114{ 117{
115 return store_bridge_parm(cd, buf, len, set_max_age); 118 return store_bridge_parm(d, buf, len, set_max_age);
116} 119}
120static DEVICE_ATTR(max_age, S_IRUGO | S_IWUSR, show_max_age, store_max_age);
117 121
118static CLASS_DEVICE_ATTR(max_age, S_IRUGO | S_IWUSR, show_max_age, 122static ssize_t show_ageing_time(struct device *d,
119 store_max_age); 123 struct device_attribute *attr, char *buf)
120
121static ssize_t show_ageing_time(struct class_device *cd, char *buf)
122{ 124{
123 struct net_bridge *br = to_bridge(cd); 125 struct net_bridge *br = to_bridge(d);
124 return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->ageing_time)); 126 return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->ageing_time));
125} 127}
126 128
@@ -129,17 +131,19 @@ static void set_ageing_time(struct net_bridge *br, unsigned long val)
129 br->ageing_time = clock_t_to_jiffies(val); 131 br->ageing_time = clock_t_to_jiffies(val);
130} 132}
131 133
132static ssize_t store_ageing_time(struct class_device *cd, const char *buf, 134static ssize_t store_ageing_time(struct device *d,
133 size_t len) 135 struct device_attribute *attr,
136 const char *buf, size_t len)
134{ 137{
135 return store_bridge_parm(cd, buf, len, set_ageing_time); 138 return store_bridge_parm(d, buf, len, set_ageing_time);
136} 139}
140static DEVICE_ATTR(ageing_time, S_IRUGO | S_IWUSR, show_ageing_time,
141 store_ageing_time);
137 142
138static CLASS_DEVICE_ATTR(ageing_time, S_IRUGO | S_IWUSR, show_ageing_time, 143static ssize_t show_stp_state(struct device *d,
139 store_ageing_time); 144 struct device_attribute *attr, char *buf)
140static ssize_t show_stp_state(struct class_device *cd, char *buf)
141{ 145{
142 struct net_bridge *br = to_bridge(cd); 146 struct net_bridge *br = to_bridge(d);
143 return sprintf(buf, "%d\n", br->stp_enabled); 147 return sprintf(buf, "%d\n", br->stp_enabled);
144} 148}
145 149
@@ -148,18 +152,19 @@ static void set_stp_state(struct net_bridge *br, unsigned long val)
148 br->stp_enabled = val; 152 br->stp_enabled = val;
149} 153}
150 154
151static ssize_t store_stp_state(struct class_device *cd, 155static ssize_t store_stp_state(struct device *d,
152 const char *buf, size_t len) 156 struct device_attribute *attr, const char *buf,
157 size_t len)
153{ 158{
154 return store_bridge_parm(cd, buf, len, set_stp_state); 159 return store_bridge_parm(d, buf, len, set_stp_state);
155} 160}
161static DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state,
162 store_stp_state);
156 163
157static CLASS_DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state, 164static ssize_t show_priority(struct device *d, struct device_attribute *attr,
158 store_stp_state); 165 char *buf)
159
160static ssize_t show_priority(struct class_device *cd, char *buf)
161{ 166{
162 struct net_bridge *br = to_bridge(cd); 167 struct net_bridge *br = to_bridge(d);
163 return sprintf(buf, "%d\n", 168 return sprintf(buf, "%d\n",
164 (br->bridge_id.prio[0] << 8) | br->bridge_id.prio[1]); 169 (br->bridge_id.prio[0] << 8) | br->bridge_id.prio[1]);
165} 170}
@@ -169,92 +174,107 @@ static void set_priority(struct net_bridge *br, unsigned long val)
169 br_stp_set_bridge_priority(br, (u16) val); 174 br_stp_set_bridge_priority(br, (u16) val);
170} 175}
171 176
172static ssize_t store_priority(struct class_device *cd, 177static ssize_t store_priority(struct device *d, struct device_attribute *attr,
173 const char *buf, size_t len) 178 const char *buf, size_t len)
174{ 179{
175 return store_bridge_parm(cd, buf, len, set_priority); 180 return store_bridge_parm(d, buf, len, set_priority);
176} 181}
177static CLASS_DEVICE_ATTR(priority, S_IRUGO | S_IWUSR, show_priority, 182static DEVICE_ATTR(priority, S_IRUGO | S_IWUSR, show_priority, store_priority);
178 store_priority);
179 183
180static ssize_t show_root_id(struct class_device *cd, char *buf) 184static ssize_t show_root_id(struct device *d, struct device_attribute *attr,
185 char *buf)
181{ 186{
182 return br_show_bridge_id(buf, &to_bridge(cd)->designated_root); 187 return br_show_bridge_id(buf, &to_bridge(d)->designated_root);
183} 188}
184static CLASS_DEVICE_ATTR(root_id, S_IRUGO, show_root_id, NULL); 189static DEVICE_ATTR(root_id, S_IRUGO, show_root_id, NULL);
185 190
186static ssize_t show_bridge_id(struct class_device *cd, char *buf) 191static ssize_t show_bridge_id(struct device *d, struct device_attribute *attr,
192 char *buf)
187{ 193{
188 return br_show_bridge_id(buf, &to_bridge(cd)->bridge_id); 194 return br_show_bridge_id(buf, &to_bridge(d)->bridge_id);
189} 195}
190static CLASS_DEVICE_ATTR(bridge_id, S_IRUGO, show_bridge_id, NULL); 196static DEVICE_ATTR(bridge_id, S_IRUGO, show_bridge_id, NULL);
191 197
192static ssize_t show_root_port(struct class_device *cd, char *buf) 198static ssize_t show_root_port(struct device *d, struct device_attribute *attr,
199 char *buf)
193{ 200{
194 return sprintf(buf, "%d\n", to_bridge(cd)->root_port); 201 return sprintf(buf, "%d\n", to_bridge(d)->root_port);
195} 202}
196static CLASS_DEVICE_ATTR(root_port, S_IRUGO, show_root_port, NULL); 203static DEVICE_ATTR(root_port, S_IRUGO, show_root_port, NULL);
197 204
198static ssize_t show_root_path_cost(struct class_device *cd, char *buf) 205static ssize_t show_root_path_cost(struct device *d,
206 struct device_attribute *attr, char *buf)
199{ 207{
200 return sprintf(buf, "%d\n", to_bridge(cd)->root_path_cost); 208 return sprintf(buf, "%d\n", to_bridge(d)->root_path_cost);
201} 209}
202static CLASS_DEVICE_ATTR(root_path_cost, S_IRUGO, show_root_path_cost, NULL); 210static DEVICE_ATTR(root_path_cost, S_IRUGO, show_root_path_cost, NULL);
203 211
204static ssize_t show_topology_change(struct class_device *cd, char *buf) 212static ssize_t show_topology_change(struct device *d,
213 struct device_attribute *attr, char *buf)
205{ 214{
206 return sprintf(buf, "%d\n", to_bridge(cd)->topology_change); 215 return sprintf(buf, "%d\n", to_bridge(d)->topology_change);
207} 216}
208static CLASS_DEVICE_ATTR(topology_change, S_IRUGO, show_topology_change, NULL); 217static DEVICE_ATTR(topology_change, S_IRUGO, show_topology_change, NULL);
209 218
210static ssize_t show_topology_change_detected(struct class_device *cd, char *buf) 219static ssize_t show_topology_change_detected(struct device *d,
220 struct device_attribute *attr,
221 char *buf)
211{ 222{
212 struct net_bridge *br = to_bridge(cd); 223 struct net_bridge *br = to_bridge(d);
213 return sprintf(buf, "%d\n", br->topology_change_detected); 224 return sprintf(buf, "%d\n", br->topology_change_detected);
214} 225}
215static CLASS_DEVICE_ATTR(topology_change_detected, S_IRUGO, show_topology_change_detected, NULL); 226static DEVICE_ATTR(topology_change_detected, S_IRUGO,
227 show_topology_change_detected, NULL);
216 228
217static ssize_t show_hello_timer(struct class_device *cd, char *buf) 229static ssize_t show_hello_timer(struct device *d,
230 struct device_attribute *attr, char *buf)
218{ 231{
219 struct net_bridge *br = to_bridge(cd); 232 struct net_bridge *br = to_bridge(d);
220 return sprintf(buf, "%ld\n", br_timer_value(&br->hello_timer)); 233 return sprintf(buf, "%ld\n", br_timer_value(&br->hello_timer));
221} 234}
222static CLASS_DEVICE_ATTR(hello_timer, S_IRUGO, show_hello_timer, NULL); 235static DEVICE_ATTR(hello_timer, S_IRUGO, show_hello_timer, NULL);
223 236
224static ssize_t show_tcn_timer(struct class_device *cd, char *buf) 237static ssize_t show_tcn_timer(struct device *d, struct device_attribute *attr,
238 char *buf)
225{ 239{
226 struct net_bridge *br = to_bridge(cd); 240 struct net_bridge *br = to_bridge(d);
227 return sprintf(buf, "%ld\n", br_timer_value(&br->tcn_timer)); 241 return sprintf(buf, "%ld\n", br_timer_value(&br->tcn_timer));
228} 242}
229static CLASS_DEVICE_ATTR(tcn_timer, S_IRUGO, show_tcn_timer, NULL); 243static DEVICE_ATTR(tcn_timer, S_IRUGO, show_tcn_timer, NULL);
230 244
231static ssize_t show_topology_change_timer(struct class_device *cd, char *buf) 245static ssize_t show_topology_change_timer(struct device *d,
246 struct device_attribute *attr,
247 char *buf)
232{ 248{
233 struct net_bridge *br = to_bridge(cd); 249 struct net_bridge *br = to_bridge(d);
234 return sprintf(buf, "%ld\n", br_timer_value(&br->topology_change_timer)); 250 return sprintf(buf, "%ld\n", br_timer_value(&br->topology_change_timer));
235} 251}
236static CLASS_DEVICE_ATTR(topology_change_timer, S_IRUGO, show_topology_change_timer, NULL); 252static DEVICE_ATTR(topology_change_timer, S_IRUGO, show_topology_change_timer,
253 NULL);
237 254
238static ssize_t show_gc_timer(struct class_device *cd, char *buf) 255static ssize_t show_gc_timer(struct device *d, struct device_attribute *attr,
256 char *buf)
239{ 257{
240 struct net_bridge *br = to_bridge(cd); 258 struct net_bridge *br = to_bridge(d);
241 return sprintf(buf, "%ld\n", br_timer_value(&br->gc_timer)); 259 return sprintf(buf, "%ld\n", br_timer_value(&br->gc_timer));
242} 260}
243static CLASS_DEVICE_ATTR(gc_timer, S_IRUGO, show_gc_timer, NULL); 261static DEVICE_ATTR(gc_timer, S_IRUGO, show_gc_timer, NULL);
244 262
245static ssize_t show_group_addr(struct class_device *cd, char *buf) 263static ssize_t show_group_addr(struct device *d,
264 struct device_attribute *attr, char *buf)
246{ 265{
247 struct net_bridge *br = to_bridge(cd); 266 struct net_bridge *br = to_bridge(d);
248 return sprintf(buf, "%x:%x:%x:%x:%x:%x\n", 267 return sprintf(buf, "%x:%x:%x:%x:%x:%x\n",
249 br->group_addr[0], br->group_addr[1], 268 br->group_addr[0], br->group_addr[1],
250 br->group_addr[2], br->group_addr[3], 269 br->group_addr[2], br->group_addr[3],
251 br->group_addr[4], br->group_addr[5]); 270 br->group_addr[4], br->group_addr[5]);
252} 271}
253 272
254static ssize_t store_group_addr(struct class_device *cd, const char *buf, 273static ssize_t store_group_addr(struct device *d,
255 size_t len) 274 struct device_attribute *attr,
275 const char *buf, size_t len)
256{ 276{
257 struct net_bridge *br = to_bridge(cd); 277 struct net_bridge *br = to_bridge(d);
258 unsigned new_addr[6]; 278 unsigned new_addr[6];
259 int i; 279 int i;
260 280
@@ -286,28 +306,28 @@ static ssize_t store_group_addr(struct class_device *cd, const char *buf,
286 return len; 306 return len;
287} 307}
288 308
289static CLASS_DEVICE_ATTR(group_addr, S_IRUGO | S_IWUSR, 309static DEVICE_ATTR(group_addr, S_IRUGO | S_IWUSR,
290 show_group_addr, store_group_addr); 310 show_group_addr, store_group_addr);
291 311
292 312
293static struct attribute *bridge_attrs[] = { 313static struct attribute *bridge_attrs[] = {
294 &class_device_attr_forward_delay.attr, 314 &dev_attr_forward_delay.attr,
295 &class_device_attr_hello_time.attr, 315 &dev_attr_hello_time.attr,
296 &class_device_attr_max_age.attr, 316 &dev_attr_max_age.attr,
297 &class_device_attr_ageing_time.attr, 317 &dev_attr_ageing_time.attr,
298 &class_device_attr_stp_state.attr, 318 &dev_attr_stp_state.attr,
299 &class_device_attr_priority.attr, 319 &dev_attr_priority.attr,
300 &class_device_attr_bridge_id.attr, 320 &dev_attr_bridge_id.attr,
301 &class_device_attr_root_id.attr, 321 &dev_attr_root_id.attr,
302 &class_device_attr_root_path_cost.attr, 322 &dev_attr_root_path_cost.attr,
303 &class_device_attr_root_port.attr, 323 &dev_attr_root_port.attr,
304 &class_device_attr_topology_change.attr, 324 &dev_attr_topology_change.attr,
305 &class_device_attr_topology_change_detected.attr, 325 &dev_attr_topology_change_detected.attr,
306 &class_device_attr_hello_timer.attr, 326 &dev_attr_hello_timer.attr,
307 &class_device_attr_tcn_timer.attr, 327 &dev_attr_tcn_timer.attr,
308 &class_device_attr_topology_change_timer.attr, 328 &dev_attr_topology_change_timer.attr,
309 &class_device_attr_gc_timer.attr, 329 &dev_attr_gc_timer.attr,
310 &class_device_attr_group_addr.attr, 330 &dev_attr_group_addr.attr,
311 NULL 331 NULL
312}; 332};
313 333
@@ -325,8 +345,8 @@ static struct attribute_group bridge_group = {
325static ssize_t brforward_read(struct kobject *kobj, char *buf, 345static ssize_t brforward_read(struct kobject *kobj, char *buf,
326 loff_t off, size_t count) 346 loff_t off, size_t count)
327{ 347{
328 struct class_device *cdev = to_class_dev(kobj); 348 struct device *dev = to_dev(kobj);
329 struct net_bridge *br = to_bridge(cdev); 349 struct net_bridge *br = to_bridge(dev);
330 int n; 350 int n;
331 351
332 /* must read whole records */ 352 /* must read whole records */
@@ -363,7 +383,7 @@ static struct bin_attribute bridge_forward = {
363 */ 383 */
364int br_sysfs_addbr(struct net_device *dev) 384int br_sysfs_addbr(struct net_device *dev)
365{ 385{
366 struct kobject *brobj = &dev->class_dev.kobj; 386 struct kobject *brobj = &dev->dev.kobj;
367 struct net_bridge *br = netdev_priv(dev); 387 struct net_bridge *br = netdev_priv(dev);
368 int err; 388 int err;
369 389
@@ -395,9 +415,9 @@ int br_sysfs_addbr(struct net_device *dev)
395 } 415 }
396 return 0; 416 return 0;
397 out3: 417 out3:
398 sysfs_remove_bin_file(&dev->class_dev.kobj, &bridge_forward); 418 sysfs_remove_bin_file(&dev->dev.kobj, &bridge_forward);
399 out2: 419 out2:
400 sysfs_remove_group(&dev->class_dev.kobj, &bridge_group); 420 sysfs_remove_group(&dev->dev.kobj, &bridge_group);
401 out1: 421 out1:
402 return err; 422 return err;
403 423
@@ -405,7 +425,7 @@ int br_sysfs_addbr(struct net_device *dev)
405 425
406void br_sysfs_delbr(struct net_device *dev) 426void br_sysfs_delbr(struct net_device *dev)
407{ 427{
408 struct kobject *kobj = &dev->class_dev.kobj; 428 struct kobject *kobj = &dev->dev.kobj;
409 struct net_bridge *br = netdev_priv(dev); 429 struct net_bridge *br = netdev_priv(dev);
410 430
411 kobject_unregister(&br->ifobj); 431 kobject_unregister(&br->ifobj);
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c
index c51c9e42aeb3..0bc2aef8f9f3 100644
--- a/net/bridge/br_sysfs_if.c
+++ b/net/bridge/br_sysfs_if.c
@@ -211,7 +211,7 @@ int br_sysfs_addif(struct net_bridge_port *p)
211 struct brport_attribute **a; 211 struct brport_attribute **a;
212 int err; 212 int err;
213 213
214 err = sysfs_create_link(&p->kobj, &br->dev->class_dev.kobj, 214 err = sysfs_create_link(&p->kobj, &br->dev->dev.kobj,
215 SYSFS_BRIDGE_PORT_LINK); 215 SYSFS_BRIDGE_PORT_LINK);
216 if (err) 216 if (err)
217 goto out2; 217 goto out2;
diff --git a/net/core/dev.c b/net/core/dev.c
index e660cb57e42a..455d589683e8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -751,7 +751,7 @@ int dev_change_name(struct net_device *dev, char *newname)
751 else 751 else
752 strlcpy(dev->name, newname, IFNAMSIZ); 752 strlcpy(dev->name, newname, IFNAMSIZ);
753 753
754 err = class_device_rename(&dev->class_dev, dev->name); 754 err = device_rename(&dev->dev, dev->name);
755 if (!err) { 755 if (!err) {
756 hlist_del(&dev->name_hlist); 756 hlist_del(&dev->name_hlist);
757 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name)); 757 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
@@ -3221,8 +3221,8 @@ void free_netdev(struct net_device *dev)
3221 BUG_ON(dev->reg_state != NETREG_UNREGISTERED); 3221 BUG_ON(dev->reg_state != NETREG_UNREGISTERED);
3222 dev->reg_state = NETREG_RELEASED; 3222 dev->reg_state = NETREG_RELEASED;
3223 3223
3224 /* will free via class release */ 3224 /* will free via device release */
3225 class_device_put(&dev->class_dev); 3225 put_device(&dev->dev);
3226#else 3226#else
3227 kfree((char *)dev - dev->padded); 3227 kfree((char *)dev - dev->padded);
3228#endif 3228#endif
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index f47f319bb7dc..44db095a8f7e 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -18,9 +18,6 @@
18#include <linux/wireless.h> 18#include <linux/wireless.h>
19#include <net/iw_handler.h> 19#include <net/iw_handler.h>
20 20
21#define to_class_dev(obj) container_of(obj,struct class_device,kobj)
22#define to_net_dev(class) container_of(class, struct net_device, class_dev)
23
24static const char fmt_hex[] = "%#x\n"; 21static const char fmt_hex[] = "%#x\n";
25static const char fmt_long_hex[] = "%#lx\n"; 22static const char fmt_long_hex[] = "%#lx\n";
26static const char fmt_dec[] = "%d\n"; 23static const char fmt_dec[] = "%d\n";
@@ -32,10 +29,11 @@ static inline int dev_isalive(const struct net_device *dev)
32} 29}
33 30
34/* use same locking rules as GIF* ioctl's */ 31/* use same locking rules as GIF* ioctl's */
35static ssize_t netdev_show(const struct class_device *cd, char *buf, 32static ssize_t netdev_show(const struct device *dev,
33 struct device_attribute *attr, char *buf,
36 ssize_t (*format)(const struct net_device *, char *)) 34 ssize_t (*format)(const struct net_device *, char *))
37{ 35{
38 struct net_device *net = to_net_dev(cd); 36 struct net_device *net = to_net_dev(dev);
39 ssize_t ret = -EINVAL; 37 ssize_t ret = -EINVAL;
40 38
41 read_lock(&dev_base_lock); 39 read_lock(&dev_base_lock);
@@ -52,14 +50,15 @@ static ssize_t format_##field(const struct net_device *net, char *buf) \
52{ \ 50{ \
53 return sprintf(buf, format_string, net->field); \ 51 return sprintf(buf, format_string, net->field); \
54} \ 52} \
55static ssize_t show_##field(struct class_device *cd, char *buf) \ 53static ssize_t show_##field(struct device *dev, \
54 struct device_attribute *attr, char *buf) \
56{ \ 55{ \
57 return netdev_show(cd, buf, format_##field); \ 56 return netdev_show(dev, attr, buf, format_##field); \
58} 57}
59 58
60 59
61/* use same locking and permission rules as SIF* ioctl's */ 60/* use same locking and permission rules as SIF* ioctl's */
62static ssize_t netdev_store(struct class_device *dev, 61static ssize_t netdev_store(struct device *dev, struct device_attribute *attr,
63 const char *buf, size_t len, 62 const char *buf, size_t len,
64 int (*set)(struct net_device *, unsigned long)) 63 int (*set)(struct net_device *, unsigned long))
65{ 64{
@@ -104,7 +103,8 @@ static ssize_t format_addr(char *buf, const unsigned char *addr, int len)
104 return cp - buf; 103 return cp - buf;
105} 104}
106 105
107static ssize_t show_address(struct class_device *dev, char *buf) 106static ssize_t show_address(struct device *dev, struct device_attribute *attr,
107 char *buf)
108{ 108{
109 struct net_device *net = to_net_dev(dev); 109 struct net_device *net = to_net_dev(dev);
110 ssize_t ret = -EINVAL; 110 ssize_t ret = -EINVAL;
@@ -116,7 +116,8 @@ static ssize_t show_address(struct class_device *dev, char *buf)
116 return ret; 116 return ret;
117} 117}
118 118
119static ssize_t show_broadcast(struct class_device *dev, char *buf) 119static ssize_t show_broadcast(struct device *dev,
120 struct device_attribute *attr, char *buf)
120{ 121{
121 struct net_device *net = to_net_dev(dev); 122 struct net_device *net = to_net_dev(dev);
122 if (dev_isalive(net)) 123 if (dev_isalive(net))
@@ -124,7 +125,8 @@ static ssize_t show_broadcast(struct class_device *dev, char *buf)
124 return -EINVAL; 125 return -EINVAL;
125} 126}
126 127
127static ssize_t show_carrier(struct class_device *dev, char *buf) 128static ssize_t show_carrier(struct device *dev,
129 struct device_attribute *attr, char *buf)
128{ 130{
129 struct net_device *netdev = to_net_dev(dev); 131 struct net_device *netdev = to_net_dev(dev);
130 if (netif_running(netdev)) { 132 if (netif_running(netdev)) {
@@ -133,7 +135,8 @@ static ssize_t show_carrier(struct class_device *dev, char *buf)
133 return -EINVAL; 135 return -EINVAL;
134} 136}
135 137
136static ssize_t show_dormant(struct class_device *dev, char *buf) 138static ssize_t show_dormant(struct device *dev,
139 struct device_attribute *attr, char *buf)
137{ 140{
138 struct net_device *netdev = to_net_dev(dev); 141 struct net_device *netdev = to_net_dev(dev);
139 142
@@ -153,7 +156,8 @@ static const char *operstates[] = {
153 "up" 156 "up"
154}; 157};
155 158
156static ssize_t show_operstate(struct class_device *dev, char *buf) 159static ssize_t show_operstate(struct device *dev,
160 struct device_attribute *attr, char *buf)
157{ 161{
158 const struct net_device *netdev = to_net_dev(dev); 162 const struct net_device *netdev = to_net_dev(dev);
159 unsigned char operstate; 163 unsigned char operstate;
@@ -178,9 +182,10 @@ static int change_mtu(struct net_device *net, unsigned long new_mtu)
178 return dev_set_mtu(net, (int) new_mtu); 182 return dev_set_mtu(net, (int) new_mtu);
179} 183}
180 184
181static ssize_t store_mtu(struct class_device *dev, const char *buf, size_t len) 185static ssize_t store_mtu(struct device *dev, struct device_attribute *attr,
186 const char *buf, size_t len)
182{ 187{
183 return netdev_store(dev, buf, len, change_mtu); 188 return netdev_store(dev, attr, buf, len, change_mtu);
184} 189}
185 190
186NETDEVICE_SHOW(flags, fmt_hex); 191NETDEVICE_SHOW(flags, fmt_hex);
@@ -190,9 +195,10 @@ static int change_flags(struct net_device *net, unsigned long new_flags)
190 return dev_change_flags(net, (unsigned) new_flags); 195 return dev_change_flags(net, (unsigned) new_flags);
191} 196}
192 197
193static ssize_t store_flags(struct class_device *dev, const char *buf, size_t len) 198static ssize_t store_flags(struct device *dev, struct device_attribute *attr,
199 const char *buf, size_t len)
194{ 200{
195 return netdev_store(dev, buf, len, change_flags); 201 return netdev_store(dev, attr, buf, len, change_flags);
196} 202}
197 203
198NETDEVICE_SHOW(tx_queue_len, fmt_ulong); 204NETDEVICE_SHOW(tx_queue_len, fmt_ulong);
@@ -203,9 +209,11 @@ static int change_tx_queue_len(struct net_device *net, unsigned long new_len)
203 return 0; 209 return 0;
204} 210}
205 211
206static ssize_t store_tx_queue_len(struct class_device *dev, const char *buf, size_t len) 212static ssize_t store_tx_queue_len(struct device *dev,
213 struct device_attribute *attr,
214 const char *buf, size_t len)
207{ 215{
208 return netdev_store(dev, buf, len, change_tx_queue_len); 216 return netdev_store(dev, attr, buf, len, change_tx_queue_len);
209} 217}
210 218
211NETDEVICE_SHOW(weight, fmt_dec); 219NETDEVICE_SHOW(weight, fmt_dec);
@@ -216,12 +224,13 @@ static int change_weight(struct net_device *net, unsigned long new_weight)
216 return 0; 224 return 0;
217} 225}
218 226
219static ssize_t store_weight(struct class_device *dev, const char *buf, size_t len) 227static ssize_t store_weight(struct device *dev, struct device_attribute *attr,
228 const char *buf, size_t len)
220{ 229{
221 return netdev_store(dev, buf, len, change_weight); 230 return netdev_store(dev, attr, buf, len, change_weight);
222} 231}
223 232
224static struct class_device_attribute net_class_attributes[] = { 233static struct device_attribute net_class_attributes[] = {
225 __ATTR(addr_len, S_IRUGO, show_addr_len, NULL), 234 __ATTR(addr_len, S_IRUGO, show_addr_len, NULL),
226 __ATTR(iflink, S_IRUGO, show_iflink, NULL), 235 __ATTR(iflink, S_IRUGO, show_iflink, NULL),
227 __ATTR(ifindex, S_IRUGO, show_ifindex, NULL), 236 __ATTR(ifindex, S_IRUGO, show_ifindex, NULL),
@@ -242,10 +251,11 @@ static struct class_device_attribute net_class_attributes[] = {
242}; 251};
243 252
244/* Show a given an attribute in the statistics group */ 253/* Show a given an attribute in the statistics group */
245static ssize_t netstat_show(const struct class_device *cd, char *buf, 254static ssize_t netstat_show(const struct device *d,
255 struct device_attribute *attr, char *buf,
246 unsigned long offset) 256 unsigned long offset)
247{ 257{
248 struct net_device *dev = to_net_dev(cd); 258 struct net_device *dev = to_net_dev(d);
249 struct net_device_stats *stats; 259 struct net_device_stats *stats;
250 ssize_t ret = -EINVAL; 260 ssize_t ret = -EINVAL;
251 261
@@ -265,12 +275,13 @@ static ssize_t netstat_show(const struct class_device *cd, char *buf,
265 275
266/* generate a read-only statistics attribute */ 276/* generate a read-only statistics attribute */
267#define NETSTAT_ENTRY(name) \ 277#define NETSTAT_ENTRY(name) \
268static ssize_t show_##name(struct class_device *cd, char *buf) \ 278static ssize_t show_##name(struct device *d, \
279 struct device_attribute *attr, char *buf) \
269{ \ 280{ \
270 return netstat_show(cd, buf, \ 281 return netstat_show(d, attr, buf, \
271 offsetof(struct net_device_stats, name)); \ 282 offsetof(struct net_device_stats, name)); \
272} \ 283} \
273static CLASS_DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) 284static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
274 285
275NETSTAT_ENTRY(rx_packets); 286NETSTAT_ENTRY(rx_packets);
276NETSTAT_ENTRY(tx_packets); 287NETSTAT_ENTRY(tx_packets);
@@ -297,29 +308,29 @@ NETSTAT_ENTRY(rx_compressed);
297NETSTAT_ENTRY(tx_compressed); 308NETSTAT_ENTRY(tx_compressed);
298 309
299static struct attribute *netstat_attrs[] = { 310static struct attribute *netstat_attrs[] = {
300 &class_device_attr_rx_packets.attr, 311 &dev_attr_rx_packets.attr,
301 &class_device_attr_tx_packets.attr, 312 &dev_attr_tx_packets.attr,
302 &class_device_attr_rx_bytes.attr, 313 &dev_attr_rx_bytes.attr,
303 &class_device_attr_tx_bytes.attr, 314 &dev_attr_tx_bytes.attr,
304 &class_device_attr_rx_errors.attr, 315 &dev_attr_rx_errors.attr,
305 &class_device_attr_tx_errors.attr, 316 &dev_attr_tx_errors.attr,
306 &class_device_attr_rx_dropped.attr, 317 &dev_attr_rx_dropped.attr,
307 &class_device_attr_tx_dropped.attr, 318 &dev_attr_tx_dropped.attr,
308 &class_device_attr_multicast.attr, 319 &dev_attr_multicast.attr,
309 &class_device_attr_collisions.attr, 320 &dev_attr_collisions.attr,
310 &class_device_attr_rx_length_errors.attr, 321 &dev_attr_rx_length_errors.attr,
311 &class_device_attr_rx_over_errors.attr, 322 &dev_attr_rx_over_errors.attr,
312 &class_device_attr_rx_crc_errors.attr, 323 &dev_attr_rx_crc_errors.attr,
313 &class_device_attr_rx_frame_errors.attr, 324 &dev_attr_rx_frame_errors.attr,
314 &class_device_attr_rx_fifo_errors.attr, 325 &dev_attr_rx_fifo_errors.attr,
315 &class_device_attr_rx_missed_errors.attr, 326 &dev_attr_rx_missed_errors.attr,
316 &class_device_attr_tx_aborted_errors.attr, 327 &dev_attr_tx_aborted_errors.attr,
317 &class_device_attr_tx_carrier_errors.attr, 328 &dev_attr_tx_carrier_errors.attr,
318 &class_device_attr_tx_fifo_errors.attr, 329 &dev_attr_tx_fifo_errors.attr,
319 &class_device_attr_tx_heartbeat_errors.attr, 330 &dev_attr_tx_heartbeat_errors.attr,
320 &class_device_attr_tx_window_errors.attr, 331 &dev_attr_tx_window_errors.attr,
321 &class_device_attr_rx_compressed.attr, 332 &dev_attr_rx_compressed.attr,
322 &class_device_attr_tx_compressed.attr, 333 &dev_attr_tx_compressed.attr,
323 NULL 334 NULL
324}; 335};
325 336
@@ -331,11 +342,11 @@ static struct attribute_group netstat_group = {
331 342
332#ifdef WIRELESS_EXT 343#ifdef WIRELESS_EXT
333/* helper function that does all the locking etc for wireless stats */ 344/* helper function that does all the locking etc for wireless stats */
334static ssize_t wireless_show(struct class_device *cd, char *buf, 345static ssize_t wireless_show(struct device *d, char *buf,
335 ssize_t (*format)(const struct iw_statistics *, 346 ssize_t (*format)(const struct iw_statistics *,
336 char *)) 347 char *))
337{ 348{
338 struct net_device *dev = to_net_dev(cd); 349 struct net_device *dev = to_net_dev(d);
339 const struct iw_statistics *iw = NULL; 350 const struct iw_statistics *iw = NULL;
340 ssize_t ret = -EINVAL; 351 ssize_t ret = -EINVAL;
341 352
@@ -358,11 +369,12 @@ static ssize_t format_iw_##name(const struct iw_statistics *iw, char *buf) \
358{ \ 369{ \
359 return sprintf(buf, format_string, iw->field); \ 370 return sprintf(buf, format_string, iw->field); \
360} \ 371} \
361static ssize_t show_iw_##name(struct class_device *cd, char *buf) \ 372static ssize_t show_iw_##name(struct device *d, \
373 struct device_attribute *attr, char *buf) \
362{ \ 374{ \
363 return wireless_show(cd, buf, format_iw_##name); \ 375 return wireless_show(d, buf, format_iw_##name); \
364} \ 376} \
365static CLASS_DEVICE_ATTR(name, S_IRUGO, show_iw_##name, NULL) 377static DEVICE_ATTR(name, S_IRUGO, show_iw_##name, NULL)
366 378
367WIRELESS_SHOW(status, status, fmt_hex); 379WIRELESS_SHOW(status, status, fmt_hex);
368WIRELESS_SHOW(link, qual.qual, fmt_dec); 380WIRELESS_SHOW(link, qual.qual, fmt_dec);
@@ -376,16 +388,16 @@ WIRELESS_SHOW(retries, discard.retries, fmt_dec);
376WIRELESS_SHOW(beacon, miss.beacon, fmt_dec); 388WIRELESS_SHOW(beacon, miss.beacon, fmt_dec);
377 389
378static struct attribute *wireless_attrs[] = { 390static struct attribute *wireless_attrs[] = {
379 &class_device_attr_status.attr, 391 &dev_attr_status.attr,
380 &class_device_attr_link.attr, 392 &dev_attr_link.attr,
381 &class_device_attr_level.attr, 393 &dev_attr_level.attr,
382 &class_device_attr_noise.attr, 394 &dev_attr_noise.attr,
383 &class_device_attr_nwid.attr, 395 &dev_attr_nwid.attr,
384 &class_device_attr_crypt.attr, 396 &dev_attr_crypt.attr,
385 &class_device_attr_fragment.attr, 397 &dev_attr_fragment.attr,
386 &class_device_attr_retries.attr, 398 &dev_attr_retries.attr,
387 &class_device_attr_misc.attr, 399 &dev_attr_misc.attr,
388 &class_device_attr_beacon.attr, 400 &dev_attr_beacon.attr,
389 NULL 401 NULL
390}; 402};
391 403
@@ -396,10 +408,10 @@ static struct attribute_group wireless_group = {
396#endif 408#endif
397 409
398#ifdef CONFIG_HOTPLUG 410#ifdef CONFIG_HOTPLUG
399static int netdev_uevent(struct class_device *cd, char **envp, 411static int netdev_uevent(struct device *d, char **envp,
400 int num_envp, char *buf, int size) 412 int num_envp, char *buf, int size)
401{ 413{
402 struct net_device *dev = to_net_dev(cd); 414 struct net_device *dev = to_net_dev(d);
403 int i = 0; 415 int i = 0;
404 int n; 416 int n;
405 417
@@ -419,12 +431,11 @@ static int netdev_uevent(struct class_device *cd, char **envp,
419 431
420/* 432/*
421 * netdev_release -- destroy and free a dead device. 433 * netdev_release -- destroy and free a dead device.
422 * Called when last reference to class_device kobject is gone. 434 * Called when last reference to device kobject is gone.
423 */ 435 */
424static void netdev_release(struct class_device *cd) 436static void netdev_release(struct device *d)
425{ 437{
426 struct net_device *dev 438 struct net_device *dev = to_net_dev(d);
427 = container_of(cd, struct net_device, class_dev);
428 439
429 BUG_ON(dev->reg_state != NETREG_RELEASED); 440 BUG_ON(dev->reg_state != NETREG_RELEASED);
430 441
@@ -433,31 +444,31 @@ static void netdev_release(struct class_device *cd)
433 444
434static struct class net_class = { 445static struct class net_class = {
435 .name = "net", 446 .name = "net",
436 .release = netdev_release, 447 .dev_release = netdev_release,
437 .class_dev_attrs = net_class_attributes, 448 .dev_attrs = net_class_attributes,
438#ifdef CONFIG_HOTPLUG 449#ifdef CONFIG_HOTPLUG
439 .uevent = netdev_uevent, 450 .dev_uevent = netdev_uevent,
440#endif 451#endif
441}; 452};
442 453
443void netdev_unregister_sysfs(struct net_device * net) 454void netdev_unregister_sysfs(struct net_device * net)
444{ 455{
445 class_device_del(&(net->class_dev)); 456 device_del(&(net->dev));
446} 457}
447 458
448/* Create sysfs entries for network device. */ 459/* Create sysfs entries for network device. */
449int netdev_register_sysfs(struct net_device *net) 460int netdev_register_sysfs(struct net_device *net)
450{ 461{
451 struct class_device *class_dev = &(net->class_dev); 462 struct device *dev = &(net->dev);
452 struct attribute_group **groups = net->sysfs_groups; 463 struct attribute_group **groups = net->sysfs_groups;
453 464
454 class_device_initialize(class_dev); 465 device_initialize(dev);
455 class_dev->class = &net_class; 466 dev->class = &net_class;
456 class_dev->class_data = net; 467 dev->platform_data = net;
457 class_dev->groups = groups; 468 dev->groups = groups;
458 469
459 BUILD_BUG_ON(BUS_ID_SIZE < IFNAMSIZ); 470 BUILD_BUG_ON(BUS_ID_SIZE < IFNAMSIZ);
460 strlcpy(class_dev->class_id, net->name, BUS_ID_SIZE); 471 strlcpy(dev->bus_id, net->name, BUS_ID_SIZE);
461 472
462 if (net->get_stats) 473 if (net->get_stats)
463 *groups++ = &netstat_group; 474 *groups++ = &netstat_group;
@@ -467,7 +478,7 @@ int netdev_register_sysfs(struct net_device *net)
467 *groups++ = &wireless_group; 478 *groups++ = &wireless_group;
468#endif 479#endif
469 480
470 return class_device_add(class_dev); 481 return device_add(dev);
471} 482}
472 483
473int netdev_sysfs_init(void) 484int netdev_sysfs_init(void)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index de7801d589e7..f3404ae9f190 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -268,7 +268,7 @@ nodata:
268struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 268struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
269 unsigned int length, gfp_t gfp_mask) 269 unsigned int length, gfp_t gfp_mask)
270{ 270{
271 int node = dev->class_dev.dev ? dev_to_node(dev->class_dev.dev) : -1; 271 int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1;
272 struct sk_buff *skb; 272 struct sk_buff *skb;
273 273
274 skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node); 274 skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node);