diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2007-02-13 00:40:06 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-02-13 00:40:06 -0500 |
commit | 4409d28140d9a6e6e3f4f1fdaf7234c4b965d954 (patch) | |
tree | b12acbebc292de5146c89ba274eea38237ec7f91 | |
parent | ec2f9d1331f658433411c58077871e1eef4ee1b4 (diff) |
Convert network devices to use struct device instead of class_device
Convert network devices to use struct device instead of class_device. Greg
missed this one in his cleanup path.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r-- | drivers/net/gianfar_sysfs.c | 108 |
1 files changed, 55 insertions, 53 deletions
diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c index 9dd387fb3d74..6e2166a7601a 100644 --- a/drivers/net/gianfar_sysfs.c +++ b/drivers/net/gianfar_sysfs.c | |||
@@ -39,13 +39,15 @@ | |||
39 | #include "gianfar.h" | 39 | #include "gianfar.h" |
40 | 40 | ||
41 | #define GFAR_ATTR(_name) \ | 41 | #define GFAR_ATTR(_name) \ |
42 | static ssize_t gfar_show_##_name(struct class_device *cdev, char *buf); \ | 42 | static ssize_t gfar_show_##_name(struct device *dev, \ |
43 | static ssize_t gfar_set_##_name(struct class_device *cdev, \ | 43 | struct device_attribute *attr, char *buf); \ |
44 | static ssize_t gfar_set_##_name(struct device *dev, \ | ||
45 | struct device_attribute *attr, \ | ||
44 | const char *buf, size_t count); \ | 46 | const char *buf, size_t count); \ |
45 | static CLASS_DEVICE_ATTR(_name, 0644, gfar_show_##_name, gfar_set_##_name) | 47 | static DEVICE_ATTR(_name, 0644, gfar_show_##_name, gfar_set_##_name) |
46 | 48 | ||
47 | #define GFAR_CREATE_FILE(_dev, _name) \ | 49 | #define GFAR_CREATE_FILE(_dev, _name) \ |
48 | class_device_create_file(&_dev->class_dev, &class_device_attr_##_name) | 50 | device_create_file(&_dev->dev, &dev_attr_##_name) |
49 | 51 | ||
50 | GFAR_ATTR(bd_stash); | 52 | GFAR_ATTR(bd_stash); |
51 | GFAR_ATTR(rx_stash_size); | 53 | GFAR_ATTR(rx_stash_size); |
@@ -54,29 +56,28 @@ GFAR_ATTR(fifo_threshold); | |||
54 | GFAR_ATTR(fifo_starve); | 56 | GFAR_ATTR(fifo_starve); |
55 | GFAR_ATTR(fifo_starve_off); | 57 | GFAR_ATTR(fifo_starve_off); |
56 | 58 | ||
57 | #define to_net_dev(cd) container_of(cd, struct net_device, class_dev) | 59 | static ssize_t gfar_show_bd_stash(struct device *dev, |
58 | 60 | struct device_attribute *attr, char *buf) | |
59 | static ssize_t gfar_show_bd_stash(struct class_device *cdev, char *buf) | ||
60 | { | 61 | { |
61 | struct net_device *dev = to_net_dev(cdev); | 62 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
62 | struct gfar_private *priv = netdev_priv(dev); | ||
63 | 63 | ||
64 | return sprintf(buf, "%s\n", priv->bd_stash_en? "on" : "off"); | 64 | return sprintf(buf, "%s\n", priv->bd_stash_en ? "on" : "off"); |
65 | } | 65 | } |
66 | 66 | ||
67 | static ssize_t gfar_set_bd_stash(struct class_device *cdev, | 67 | static ssize_t gfar_set_bd_stash(struct device *dev, |
68 | const char *buf, size_t count) | 68 | struct device_attribute *attr, |
69 | const char *buf, size_t count) | ||
69 | { | 70 | { |
70 | struct net_device *dev = to_net_dev(cdev); | 71 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
71 | struct gfar_private *priv = netdev_priv(dev); | ||
72 | int new_setting = 0; | 72 | int new_setting = 0; |
73 | u32 temp; | 73 | u32 temp; |
74 | unsigned long flags; | 74 | unsigned long flags; |
75 | 75 | ||
76 | /* Find out the new setting */ | 76 | /* Find out the new setting */ |
77 | if (!strncmp("on", buf, count-1) || !strncmp("1", buf, count-1)) | 77 | if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1)) |
78 | new_setting = 1; | 78 | new_setting = 1; |
79 | else if (!strncmp("off", buf, count-1) || !strncmp("0", buf, count-1)) | 79 | else if (!strncmp("off", buf, count - 1) |
80 | || !strncmp("0", buf, count - 1)) | ||
80 | new_setting = 0; | 81 | new_setting = 0; |
81 | else | 82 | else |
82 | return count; | 83 | return count; |
@@ -100,19 +101,19 @@ static ssize_t gfar_set_bd_stash(struct class_device *cdev, | |||
100 | return count; | 101 | return count; |
101 | } | 102 | } |
102 | 103 | ||
103 | static ssize_t gfar_show_rx_stash_size(struct class_device *cdev, char *buf) | 104 | static ssize_t gfar_show_rx_stash_size(struct device *dev, |
105 | struct device_attribute *attr, char *buf) | ||
104 | { | 106 | { |
105 | struct net_device *dev = to_net_dev(cdev); | 107 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
106 | struct gfar_private *priv = netdev_priv(dev); | ||
107 | 108 | ||
108 | return sprintf(buf, "%d\n", priv->rx_stash_size); | 109 | return sprintf(buf, "%d\n", priv->rx_stash_size); |
109 | } | 110 | } |
110 | 111 | ||
111 | static ssize_t gfar_set_rx_stash_size(struct class_device *cdev, | 112 | static ssize_t gfar_set_rx_stash_size(struct device *dev, |
112 | const char *buf, size_t count) | 113 | struct device_attribute *attr, |
114 | const char *buf, size_t count) | ||
113 | { | 115 | { |
114 | struct net_device *dev = to_net_dev(cdev); | 116 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
115 | struct gfar_private *priv = netdev_priv(dev); | ||
116 | unsigned int length = simple_strtoul(buf, NULL, 0); | 117 | unsigned int length = simple_strtoul(buf, NULL, 0); |
117 | u32 temp; | 118 | u32 temp; |
118 | unsigned long flags; | 119 | unsigned long flags; |
@@ -146,21 +147,21 @@ static ssize_t gfar_set_rx_stash_size(struct class_device *cdev, | |||
146 | return count; | 147 | return count; |
147 | } | 148 | } |
148 | 149 | ||
149 | |||
150 | /* Stashing will only be enabled when rx_stash_size != 0 */ | 150 | /* Stashing will only be enabled when rx_stash_size != 0 */ |
151 | static ssize_t gfar_show_rx_stash_index(struct class_device *cdev, char *buf) | 151 | static ssize_t gfar_show_rx_stash_index(struct device *dev, |
152 | struct device_attribute *attr, | ||
153 | char *buf) | ||
152 | { | 154 | { |
153 | struct net_device *dev = to_net_dev(cdev); | 155 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
154 | struct gfar_private *priv = netdev_priv(dev); | ||
155 | 156 | ||
156 | return sprintf(buf, "%d\n", priv->rx_stash_index); | 157 | return sprintf(buf, "%d\n", priv->rx_stash_index); |
157 | } | 158 | } |
158 | 159 | ||
159 | static ssize_t gfar_set_rx_stash_index(struct class_device *cdev, | 160 | static ssize_t gfar_set_rx_stash_index(struct device *dev, |
160 | const char *buf, size_t count) | 161 | struct device_attribute *attr, |
162 | const char *buf, size_t count) | ||
161 | { | 163 | { |
162 | struct net_device *dev = to_net_dev(cdev); | 164 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
163 | struct gfar_private *priv = netdev_priv(dev); | ||
164 | unsigned short index = simple_strtoul(buf, NULL, 0); | 165 | unsigned short index = simple_strtoul(buf, NULL, 0); |
165 | u32 temp; | 166 | u32 temp; |
166 | unsigned long flags; | 167 | unsigned long flags; |
@@ -184,19 +185,20 @@ static ssize_t gfar_set_rx_stash_index(struct class_device *cdev, | |||
184 | return count; | 185 | return count; |
185 | } | 186 | } |
186 | 187 | ||
187 | static ssize_t gfar_show_fifo_threshold(struct class_device *cdev, char *buf) | 188 | static ssize_t gfar_show_fifo_threshold(struct device *dev, |
189 | struct device_attribute *attr, | ||
190 | char *buf) | ||
188 | { | 191 | { |
189 | struct net_device *dev = to_net_dev(cdev); | 192 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
190 | struct gfar_private *priv = netdev_priv(dev); | ||
191 | 193 | ||
192 | return sprintf(buf, "%d\n", priv->fifo_threshold); | 194 | return sprintf(buf, "%d\n", priv->fifo_threshold); |
193 | } | 195 | } |
194 | 196 | ||
195 | static ssize_t gfar_set_fifo_threshold(struct class_device *cdev, | 197 | static ssize_t gfar_set_fifo_threshold(struct device *dev, |
196 | const char *buf, size_t count) | 198 | struct device_attribute *attr, |
199 | const char *buf, size_t count) | ||
197 | { | 200 | { |
198 | struct net_device *dev = to_net_dev(cdev); | 201 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
199 | struct gfar_private *priv = netdev_priv(dev); | ||
200 | unsigned int length = simple_strtoul(buf, NULL, 0); | 202 | unsigned int length = simple_strtoul(buf, NULL, 0); |
201 | u32 temp; | 203 | u32 temp; |
202 | unsigned long flags; | 204 | unsigned long flags; |
@@ -218,20 +220,19 @@ static ssize_t gfar_set_fifo_threshold(struct class_device *cdev, | |||
218 | return count; | 220 | return count; |
219 | } | 221 | } |
220 | 222 | ||
221 | static ssize_t gfar_show_fifo_starve(struct class_device *cdev, char *buf) | 223 | static ssize_t gfar_show_fifo_starve(struct device *dev, |
224 | struct device_attribute *attr, char *buf) | ||
222 | { | 225 | { |
223 | struct net_device *dev = to_net_dev(cdev); | 226 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
224 | struct gfar_private *priv = netdev_priv(dev); | ||
225 | 227 | ||
226 | return sprintf(buf, "%d\n", priv->fifo_starve); | 228 | return sprintf(buf, "%d\n", priv->fifo_starve); |
227 | } | 229 | } |
228 | 230 | ||
229 | 231 | static ssize_t gfar_set_fifo_starve(struct device *dev, | |
230 | static ssize_t gfar_set_fifo_starve(struct class_device *cdev, | 232 | struct device_attribute *attr, |
231 | const char *buf, size_t count) | 233 | const char *buf, size_t count) |
232 | { | 234 | { |
233 | struct net_device *dev = to_net_dev(cdev); | 235 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
234 | struct gfar_private *priv = netdev_priv(dev); | ||
235 | unsigned int num = simple_strtoul(buf, NULL, 0); | 236 | unsigned int num = simple_strtoul(buf, NULL, 0); |
236 | u32 temp; | 237 | u32 temp; |
237 | unsigned long flags; | 238 | unsigned long flags; |
@@ -253,19 +254,20 @@ static ssize_t gfar_set_fifo_starve(struct class_device *cdev, | |||
253 | return count; | 254 | return count; |
254 | } | 255 | } |
255 | 256 | ||
256 | static ssize_t gfar_show_fifo_starve_off(struct class_device *cdev, char *buf) | 257 | static ssize_t gfar_show_fifo_starve_off(struct device *dev, |
258 | struct device_attribute *attr, | ||
259 | char *buf) | ||
257 | { | 260 | { |
258 | struct net_device *dev = to_net_dev(cdev); | 261 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
259 | struct gfar_private *priv = netdev_priv(dev); | ||
260 | 262 | ||
261 | return sprintf(buf, "%d\n", priv->fifo_starve_off); | 263 | return sprintf(buf, "%d\n", priv->fifo_starve_off); |
262 | } | 264 | } |
263 | 265 | ||
264 | static ssize_t gfar_set_fifo_starve_off(struct class_device *cdev, | 266 | static ssize_t gfar_set_fifo_starve_off(struct device *dev, |
265 | const char *buf, size_t count) | 267 | struct device_attribute *attr, |
268 | const char *buf, size_t count) | ||
266 | { | 269 | { |
267 | struct net_device *dev = to_net_dev(cdev); | 270 | struct gfar_private *priv = netdev_priv(to_net_dev(dev)); |
268 | struct gfar_private *priv = netdev_priv(dev); | ||
269 | unsigned int num = simple_strtoul(buf, NULL, 0); | 271 | unsigned int num = simple_strtoul(buf, NULL, 0); |
270 | u32 temp; | 272 | u32 temp; |
271 | unsigned long flags; | 273 | unsigned long flags; |