aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/misc.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pretzel.yyz.us>2005-06-26 23:38:58 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-06-26 23:38:58 -0400
commit5696c1944a33b4434a9a1ebb6383b906afd43a10 (patch)
tree16fbe6ba431bcf949ee8645510b0c2fd39b5810f /drivers/char/misc.c
parent66b04a80eea60cabf9d89fd34deb3234a740052f (diff)
parent020f46a39eb7b99a575b9f4d105fce2b142acdf1 (diff)
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'drivers/char/misc.c')
-rw-r--r--drivers/char/misc.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 0937544762da..31cf84d69026 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -66,8 +66,6 @@ static unsigned char misc_minors[DYNAMIC_MINORS / 8];
66extern int rtc_DP8570A_init(void); 66extern int rtc_DP8570A_init(void);
67extern int rtc_MK48T08_init(void); 67extern int rtc_MK48T08_init(void);
68extern int pmu_device_init(void); 68extern int pmu_device_init(void);
69extern int tosh_init(void);
70extern int i8k_init(void);
71 69
72#ifdef CONFIG_PROC_FS 70#ifdef CONFIG_PROC_FS
73static void *misc_seq_start(struct seq_file *seq, loff_t *pos) 71static void *misc_seq_start(struct seq_file *seq, loff_t *pos)
@@ -177,10 +175,10 @@ fail:
177 175
178/* 176/*
179 * TODO for 2.7: 177 * TODO for 2.7:
180 * - add a struct class_device to struct miscdevice and make all usages of 178 * - add a struct kref to struct miscdevice and make all usages of
181 * them dynamic. 179 * them dynamic.
182 */ 180 */
183static struct class_simple *misc_class; 181static struct class *misc_class;
184 182
185static struct file_operations misc_fops = { 183static struct file_operations misc_fops = {
186 .owner = THIS_MODULE, 184 .owner = THIS_MODULE,
@@ -238,8 +236,8 @@ int misc_register(struct miscdevice * misc)
238 } 236 }
239 dev = MKDEV(MISC_MAJOR, misc->minor); 237 dev = MKDEV(MISC_MAJOR, misc->minor);
240 238
241 misc->class = class_simple_device_add(misc_class, dev, 239 misc->class = class_device_create(misc_class, dev, misc->dev,
242 misc->dev, misc->name); 240 "%s", misc->name);
243 if (IS_ERR(misc->class)) { 241 if (IS_ERR(misc->class)) {
244 err = PTR_ERR(misc->class); 242 err = PTR_ERR(misc->class);
245 goto out; 243 goto out;
@@ -248,7 +246,7 @@ int misc_register(struct miscdevice * misc)
248 err = devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP, 246 err = devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP,
249 misc->devfs_name); 247 misc->devfs_name);
250 if (err) { 248 if (err) {
251 class_simple_device_remove(dev); 249 class_device_destroy(misc_class, dev);
252 goto out; 250 goto out;
253 } 251 }
254 252
@@ -281,7 +279,7 @@ int misc_deregister(struct miscdevice * misc)
281 279
282 down(&misc_sem); 280 down(&misc_sem);
283 list_del(&misc->list); 281 list_del(&misc->list);
284 class_simple_device_remove(MKDEV(MISC_MAJOR, misc->minor)); 282 class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor));
285 devfs_remove(misc->devfs_name); 283 devfs_remove(misc->devfs_name);
286 if (i < DYNAMIC_MINORS && i>0) { 284 if (i < DYNAMIC_MINORS && i>0) {
287 misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); 285 misc_minors[i>>3] &= ~(1 << (misc->minor & 7));
@@ -302,7 +300,7 @@ static int __init misc_init(void)
302 if (ent) 300 if (ent)
303 ent->proc_fops = &misc_proc_fops; 301 ent->proc_fops = &misc_proc_fops;
304#endif 302#endif
305 misc_class = class_simple_create(THIS_MODULE, "misc"); 303 misc_class = class_create(THIS_MODULE, "misc");
306 if (IS_ERR(misc_class)) 304 if (IS_ERR(misc_class))
307 return PTR_ERR(misc_class); 305 return PTR_ERR(misc_class);
308#ifdef CONFIG_MVME16x 306#ifdef CONFIG_MVME16x
@@ -314,16 +312,10 @@ static int __init misc_init(void)
314#ifdef CONFIG_PMAC_PBOOK 312#ifdef CONFIG_PMAC_PBOOK
315 pmu_device_init(); 313 pmu_device_init();
316#endif 314#endif
317#ifdef CONFIG_TOSHIBA
318 tosh_init();
319#endif
320#ifdef CONFIG_I8K
321 i8k_init();
322#endif
323 if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) { 315 if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
324 printk("unable to get major %d for misc devices\n", 316 printk("unable to get major %d for misc devices\n",
325 MISC_MAJOR); 317 MISC_MAJOR);
326 class_simple_destroy(misc_class); 318 class_destroy(misc_class);
327 return -EIO; 319 return -EIO;
328 } 320 }
329 return 0; 321 return 0;