diff options
Diffstat (limited to 'net/atm/atm_sysfs.c')
-rw-r--r-- | net/atm/atm_sysfs.c | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c index 9ef07eda2c43..1b88311f2130 100644 --- a/net/atm/atm_sysfs.c +++ b/net/atm/atm_sysfs.c | |||
@@ -9,13 +9,15 @@ | |||
9 | 9 | ||
10 | #define to_atm_dev(cldev) container_of(cldev, struct atm_dev, class_dev) | 10 | #define to_atm_dev(cldev) container_of(cldev, struct atm_dev, class_dev) |
11 | 11 | ||
12 | static ssize_t show_type(struct class_device *cdev, char *buf) | 12 | static ssize_t show_type(struct device *cdev, |
13 | struct device_attribute *attr, char *buf) | ||
13 | { | 14 | { |
14 | struct atm_dev *adev = to_atm_dev(cdev); | 15 | struct atm_dev *adev = to_atm_dev(cdev); |
15 | return sprintf(buf, "%s\n", adev->type); | 16 | return sprintf(buf, "%s\n", adev->type); |
16 | } | 17 | } |
17 | 18 | ||
18 | static ssize_t show_address(struct class_device *cdev, char *buf) | 19 | static ssize_t show_address(struct device *cdev, |
20 | struct device_attribute *attr, char *buf) | ||
19 | { | 21 | { |
20 | char *pos = buf; | 22 | char *pos = buf; |
21 | struct atm_dev *adev = to_atm_dev(cdev); | 23 | struct atm_dev *adev = to_atm_dev(cdev); |
@@ -28,7 +30,8 @@ static ssize_t show_address(struct class_device *cdev, char *buf) | |||
28 | return pos - buf; | 30 | return pos - buf; |
29 | } | 31 | } |
30 | 32 | ||
31 | static ssize_t show_atmaddress(struct class_device *cdev, char *buf) | 33 | static ssize_t show_atmaddress(struct device *cdev, |
34 | struct device_attribute *attr, char *buf) | ||
32 | { | 35 | { |
33 | unsigned long flags; | 36 | unsigned long flags; |
34 | char *pos = buf; | 37 | char *pos = buf; |
@@ -54,7 +57,8 @@ static ssize_t show_atmaddress(struct class_device *cdev, char *buf) | |||
54 | return pos - buf; | 57 | return pos - buf; |
55 | } | 58 | } |
56 | 59 | ||
57 | static ssize_t show_carrier(struct class_device *cdev, char *buf) | 60 | static ssize_t show_carrier(struct device *cdev, |
61 | struct device_attribute *attr, char *buf) | ||
58 | { | 62 | { |
59 | char *pos = buf; | 63 | char *pos = buf; |
60 | struct atm_dev *adev = to_atm_dev(cdev); | 64 | struct atm_dev *adev = to_atm_dev(cdev); |
@@ -65,7 +69,8 @@ static ssize_t show_carrier(struct class_device *cdev, char *buf) | |||
65 | return pos - buf; | 69 | return pos - buf; |
66 | } | 70 | } |
67 | 71 | ||
68 | static ssize_t show_link_rate(struct class_device *cdev, char *buf) | 72 | static ssize_t show_link_rate(struct device *cdev, |
73 | struct device_attribute *attr, char *buf) | ||
69 | { | 74 | { |
70 | char *pos = buf; | 75 | char *pos = buf; |
71 | struct atm_dev *adev = to_atm_dev(cdev); | 76 | struct atm_dev *adev = to_atm_dev(cdev); |
@@ -90,22 +95,23 @@ static ssize_t show_link_rate(struct class_device *cdev, char *buf) | |||
90 | return pos - buf; | 95 | return pos - buf; |
91 | } | 96 | } |
92 | 97 | ||
93 | static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL); | 98 | static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); |
94 | static CLASS_DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL); | 99 | static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL); |
95 | static CLASS_DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL); | 100 | static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL); |
96 | static CLASS_DEVICE_ATTR(type, S_IRUGO, show_type, NULL); | 101 | static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); |
97 | static CLASS_DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL); | 102 | static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL); |
98 | 103 | ||
99 | static struct class_device_attribute *atm_attrs[] = { | 104 | static struct device_attribute *atm_attrs[] = { |
100 | &class_device_attr_atmaddress, | 105 | &dev_attr_atmaddress, |
101 | &class_device_attr_address, | 106 | &dev_attr_address, |
102 | &class_device_attr_carrier, | 107 | &dev_attr_carrier, |
103 | &class_device_attr_type, | 108 | &dev_attr_type, |
104 | &class_device_attr_link_rate, | 109 | &dev_attr_link_rate, |
105 | NULL | 110 | NULL |
106 | }; | 111 | }; |
107 | 112 | ||
108 | static int atm_uevent(struct class_device *cdev, struct kobj_uevent_env *env) | 113 | |
114 | static int atm_uevent(struct device *cdev, struct kobj_uevent_env *env) | ||
109 | { | 115 | { |
110 | struct atm_dev *adev; | 116 | struct atm_dev *adev; |
111 | 117 | ||
@@ -122,7 +128,7 @@ static int atm_uevent(struct class_device *cdev, struct kobj_uevent_env *env) | |||
122 | return 0; | 128 | return 0; |
123 | } | 129 | } |
124 | 130 | ||
125 | static void atm_release(struct class_device *cdev) | 131 | static void atm_release(struct device *cdev) |
126 | { | 132 | { |
127 | struct atm_dev *adev = to_atm_dev(cdev); | 133 | struct atm_dev *adev = to_atm_dev(cdev); |
128 | 134 | ||
@@ -131,25 +137,25 @@ static void atm_release(struct class_device *cdev) | |||
131 | 137 | ||
132 | static struct class atm_class = { | 138 | static struct class atm_class = { |
133 | .name = "atm", | 139 | .name = "atm", |
134 | .release = atm_release, | 140 | .dev_release = atm_release, |
135 | .uevent = atm_uevent, | 141 | .dev_uevent = atm_uevent, |
136 | }; | 142 | }; |
137 | 143 | ||
138 | int atm_register_sysfs(struct atm_dev *adev) | 144 | int atm_register_sysfs(struct atm_dev *adev) |
139 | { | 145 | { |
140 | struct class_device *cdev = &adev->class_dev; | 146 | struct device *cdev = &adev->class_dev; |
141 | int i, j, err; | 147 | int i, j, err; |
142 | 148 | ||
143 | cdev->class = &atm_class; | 149 | cdev->class = &atm_class; |
144 | class_set_devdata(cdev, adev); | 150 | dev_set_drvdata(cdev, adev); |
145 | 151 | ||
146 | snprintf(cdev->class_id, BUS_ID_SIZE, "%s%d", adev->type, adev->number); | 152 | snprintf(cdev->bus_id, BUS_ID_SIZE, "%s%d", adev->type, adev->number); |
147 | err = class_device_register(cdev); | 153 | err = device_register(cdev); |
148 | if (err < 0) | 154 | if (err < 0) |
149 | return err; | 155 | return err; |
150 | 156 | ||
151 | for (i = 0; atm_attrs[i]; i++) { | 157 | for (i = 0; atm_attrs[i]; i++) { |
152 | err = class_device_create_file(cdev, atm_attrs[i]); | 158 | err = device_create_file(cdev, atm_attrs[i]); |
153 | if (err) | 159 | if (err) |
154 | goto err_out; | 160 | goto err_out; |
155 | } | 161 | } |
@@ -158,16 +164,16 @@ int atm_register_sysfs(struct atm_dev *adev) | |||
158 | 164 | ||
159 | err_out: | 165 | err_out: |
160 | for (j = 0; j < i; j++) | 166 | for (j = 0; j < i; j++) |
161 | class_device_remove_file(cdev, atm_attrs[j]); | 167 | device_remove_file(cdev, atm_attrs[j]); |
162 | class_device_del(cdev); | 168 | device_del(cdev); |
163 | return err; | 169 | return err; |
164 | } | 170 | } |
165 | 171 | ||
166 | void atm_unregister_sysfs(struct atm_dev *adev) | 172 | void atm_unregister_sysfs(struct atm_dev *adev) |
167 | { | 173 | { |
168 | struct class_device *cdev = &adev->class_dev; | 174 | struct device *cdev = &adev->class_dev; |
169 | 175 | ||
170 | class_device_del(cdev); | 176 | device_del(cdev); |
171 | } | 177 | } |
172 | 178 | ||
173 | int __init atm_sysfs_init(void) | 179 | int __init atm_sysfs_init(void) |