aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/hw_random
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-07-27 19:16:04 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-01 17:51:59 -0500
commit94fbcded4ea0dc14cbfb222a5c68372f150d1476 (patch)
treefcbf2d5f71a9993666a1c8d1883273f8046f8625 /drivers/char/hw_random
parentcd15422b9f39155e2d9ea56ae95c6f62aa5df42e (diff)
Driver core: change misc class_devices to be real devices
This also ment that some of the misc drivers had to also be fixed up as they were assuming the device was a class_device. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/hw_random')
-rw-r--r--drivers/char/hw_random/core.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 154a81d328c1..ebace201bec6 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -162,7 +162,8 @@ static struct miscdevice rng_miscdev = {
162}; 162};
163 163
164 164
165static ssize_t hwrng_attr_current_store(struct class_device *class, 165static ssize_t hwrng_attr_current_store(struct device *dev,
166 struct device_attribute *attr,
166 const char *buf, size_t len) 167 const char *buf, size_t len)
167{ 168{
168 int err; 169 int err;
@@ -192,7 +193,8 @@ static ssize_t hwrng_attr_current_store(struct class_device *class,
192 return err ? : len; 193 return err ? : len;
193} 194}
194 195
195static ssize_t hwrng_attr_current_show(struct class_device *class, 196static ssize_t hwrng_attr_current_show(struct device *dev,
197 struct device_attribute *attr,
196 char *buf) 198 char *buf)
197{ 199{
198 int err; 200 int err;
@@ -210,7 +212,8 @@ static ssize_t hwrng_attr_current_show(struct class_device *class,
210 return ret; 212 return ret;
211} 213}
212 214
213static ssize_t hwrng_attr_available_show(struct class_device *class, 215static ssize_t hwrng_attr_available_show(struct device *dev,
216 struct device_attribute *attr,
214 char *buf) 217 char *buf)
215{ 218{
216 int err; 219 int err;
@@ -234,20 +237,18 @@ static ssize_t hwrng_attr_available_show(struct class_device *class,
234 return ret; 237 return ret;
235} 238}
236 239
237static CLASS_DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR, 240static DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR,
238 hwrng_attr_current_show, 241 hwrng_attr_current_show,
239 hwrng_attr_current_store); 242 hwrng_attr_current_store);
240static CLASS_DEVICE_ATTR(rng_available, S_IRUGO, 243static DEVICE_ATTR(rng_available, S_IRUGO,
241 hwrng_attr_available_show, 244 hwrng_attr_available_show,
242 NULL); 245 NULL);
243 246
244 247
245static void unregister_miscdev(void) 248static void unregister_miscdev(void)
246{ 249{
247 class_device_remove_file(rng_miscdev.class, 250 device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available);
248 &class_device_attr_rng_available); 251 device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current);
249 class_device_remove_file(rng_miscdev.class,
250 &class_device_attr_rng_current);
251 misc_deregister(&rng_miscdev); 252 misc_deregister(&rng_miscdev);
252} 253}
253 254
@@ -258,20 +259,19 @@ static int register_miscdev(void)
258 err = misc_register(&rng_miscdev); 259 err = misc_register(&rng_miscdev);
259 if (err) 260 if (err)
260 goto out; 261 goto out;
261 err = class_device_create_file(rng_miscdev.class, 262 err = device_create_file(rng_miscdev.this_device,
262 &class_device_attr_rng_current); 263 &dev_attr_rng_current);
263 if (err) 264 if (err)
264 goto err_misc_dereg; 265 goto err_misc_dereg;
265 err = class_device_create_file(rng_miscdev.class, 266 err = device_create_file(rng_miscdev.this_device,
266 &class_device_attr_rng_available); 267 &dev_attr_rng_available);
267 if (err) 268 if (err)
268 goto err_remove_current; 269 goto err_remove_current;
269out: 270out:
270 return err; 271 return err;
271 272
272err_remove_current: 273err_remove_current:
273 class_device_remove_file(rng_miscdev.class, 274 device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current);
274 &class_device_attr_rng_current);
275err_misc_dereg: 275err_misc_dereg:
276 misc_deregister(&rng_miscdev); 276 misc_deregister(&rng_miscdev);
277 goto out; 277 goto out;