Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] class: convert drivers/* to use the new class api instead of class_simple

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

+51 -53
+7 -7
drivers/isdn/capi/capi.c
··· 58 58 59 59 /* -------- driver information -------------------------------------- */ 60 60 61 - static struct class_simple *capi_class; 61 + static struct class *capi_class; 62 62 63 63 static int capi_major = 68; /* allocated */ 64 64 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE ··· 1499 1499 return -EIO; 1500 1500 } 1501 1501 1502 - capi_class = class_simple_create(THIS_MODULE, "capi"); 1502 + capi_class = class_create(THIS_MODULE, "capi"); 1503 1503 if (IS_ERR(capi_class)) { 1504 1504 unregister_chrdev(capi_major, "capi20"); 1505 1505 return PTR_ERR(capi_class); 1506 1506 } 1507 1507 1508 - class_simple_device_add(capi_class, MKDEV(capi_major, 0), NULL, "capi"); 1508 + class_device_create(capi_class, MKDEV(capi_major, 0), NULL, "capi"); 1509 1509 devfs_mk_cdev(MKDEV(capi_major, 0), S_IFCHR | S_IRUSR | S_IWUSR, 1510 1510 "isdn/capi20"); 1511 1511 1512 1512 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE 1513 1513 if (capinc_tty_init() < 0) { 1514 - class_simple_device_remove(MKDEV(capi_major, 0)); 1515 - class_simple_destroy(capi_class); 1514 + class_device_destroy(capi_class, MKDEV(capi_major, 0)); 1515 + class_destroy(capi_class); 1516 1516 unregister_chrdev(capi_major, "capi20"); 1517 1517 return -ENOMEM; 1518 1518 } ··· 1539 1539 { 1540 1540 proc_exit(); 1541 1541 1542 - class_simple_device_remove(MKDEV(capi_major, 0)); 1543 - class_simple_destroy(capi_class); 1542 + class_device_destroy(capi_class, MKDEV(capi_major, 0)); 1543 + class_destroy(capi_class); 1544 1544 unregister_chrdev(capi_major, "capi20"); 1545 1545 devfs_remove("isdn/capi20"); 1546 1546
+4 -5
drivers/macintosh/adb.c
··· 77 77 NULL 78 78 }; 79 79 80 - static struct class_simple *adb_dev_class; 80 + static struct class *adb_dev_class; 81 81 82 82 struct adb_driver *adb_controller; 83 83 struct notifier_block *adb_client_list = NULL; ··· 902 902 903 903 devfs_mk_cdev(MKDEV(ADB_MAJOR, 0), S_IFCHR | S_IRUSR | S_IWUSR, "adb"); 904 904 905 - adb_dev_class = class_simple_create(THIS_MODULE, "adb"); 906 - if (IS_ERR(adb_dev_class)) { 905 + adb_dev_class = class_create(THIS_MODULE, "adb"); 906 + if (IS_ERR(adb_dev_class)) 907 907 return; 908 - } 909 - class_simple_device_add(adb_dev_class, MKDEV(ADB_MAJOR, 0), NULL, "adb"); 908 + class_device_create(adb_dev_class, MKDEV(ADB_MAJOR, 0), NULL, "adb"); 910 909 }
+6 -7
drivers/media/dvb/dvb-core/dvbdev.c
··· 56 56 #define nums2minor(num,type,id) ((num << 6) | (id << 4) | type) 57 57 #define MAX_DVB_MINORS (DVB_MAX_ADAPTERS*64) 58 58 59 - struct class_simple *dvb_class; 60 - EXPORT_SYMBOL(dvb_class); 59 + static struct class *dvb_class; 61 60 62 61 static struct dvb_device* dvbdev_find_device (int minor) 63 62 { ··· 235 236 S_IFCHR | S_IRUSR | S_IWUSR, 236 237 "dvb/adapter%d/%s%d", adap->num, dnames[type], id); 237 238 238 - class_simple_device_add(dvb_class, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), 239 - NULL, "dvb%d.%s%d", adap->num, dnames[type], id); 239 + class_device_create(dvb_class, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), 240 + NULL, "dvb%d.%s%d", adap->num, dnames[type], id); 240 241 241 242 dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", 242 243 adap->num, dnames[type], id, nums2minor(adap->num, type, id), ··· 255 256 devfs_remove("dvb/adapter%d/%s%d", dvbdev->adapter->num, 256 257 dnames[dvbdev->type], dvbdev->id); 257 258 258 - class_simple_device_remove(MKDEV(DVB_MAJOR, nums2minor(dvbdev->adapter->num, 259 + class_device_destroy(dvb_class, MKDEV(DVB_MAJOR, nums2minor(dvbdev->adapter->num, 259 260 dvbdev->type, dvbdev->id))); 260 261 261 262 list_del (&dvbdev->list_head); ··· 411 412 412 413 devfs_mk_dir("dvb"); 413 414 414 - dvb_class = class_simple_create(THIS_MODULE, "dvb"); 415 + dvb_class = class_create(THIS_MODULE, "dvb"); 415 416 if (IS_ERR(dvb_class)) { 416 417 retval = PTR_ERR(dvb_class); 417 418 goto error; ··· 428 429 static void __exit exit_dvbdev(void) 429 430 { 430 431 devfs_remove("dvb"); 431 - class_simple_destroy(dvb_class); 432 + class_destroy(dvb_class); 432 433 cdev_del(&dvb_device_cdev); 433 434 unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS); 434 435 }
+7 -7
drivers/net/ppp_generic.c
··· 273 273 static int ppp_disconnect_channel(struct channel *pch); 274 274 static void ppp_destroy_channel(struct channel *pch); 275 275 276 - static struct class_simple *ppp_class; 276 + static struct class *ppp_class; 277 277 278 278 /* Translates a PPP protocol number to a NP index (NP == network protocol) */ 279 279 static inline int proto_to_npindex(int proto) ··· 858 858 printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n"); 859 859 err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops); 860 860 if (!err) { 861 - ppp_class = class_simple_create(THIS_MODULE, "ppp"); 861 + ppp_class = class_create(THIS_MODULE, "ppp"); 862 862 if (IS_ERR(ppp_class)) { 863 863 err = PTR_ERR(ppp_class); 864 864 goto out_chrdev; 865 865 } 866 - class_simple_device_add(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp"); 866 + class_device_create(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp"); 867 867 err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0), 868 868 S_IFCHR|S_IRUSR|S_IWUSR, "ppp"); 869 869 if (err) ··· 876 876 return err; 877 877 878 878 out_class: 879 - class_simple_device_remove(MKDEV(PPP_MAJOR,0)); 880 - class_simple_destroy(ppp_class); 879 + class_device_destroy(ppp_class, MKDEV(PPP_MAJOR,0)); 880 + class_destroy(ppp_class); 881 881 out_chrdev: 882 882 unregister_chrdev(PPP_MAJOR, "ppp"); 883 883 goto out; ··· 2654 2654 if (unregister_chrdev(PPP_MAJOR, "ppp") != 0) 2655 2655 printk(KERN_ERR "PPP: failed to unregister PPP device\n"); 2656 2656 devfs_remove("ppp"); 2657 - class_simple_device_remove(MKDEV(PPP_MAJOR, 0)); 2658 - class_simple_destroy(ppp_class); 2657 + class_device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0)); 2658 + class_destroy(ppp_class); 2659 2659 } 2660 2660 2661 2661 /*
+6 -6
drivers/net/wan/cosa.c
··· 235 235 static int irq[MAX_CARDS+1] = { -1, -1, -1, -1, -1, -1, 0, }; 236 236 237 237 /* for class stuff*/ 238 - static struct class_simple *cosa_class; 238 + static struct class *cosa_class; 239 239 240 240 #ifdef MODULE 241 241 module_param_array(io, int, NULL, 0); ··· 394 394 goto out; 395 395 } 396 396 devfs_mk_dir("cosa"); 397 - cosa_class = class_simple_create(THIS_MODULE, "cosa"); 397 + cosa_class = class_create(THIS_MODULE, "cosa"); 398 398 if (IS_ERR(cosa_class)) { 399 399 err = PTR_ERR(cosa_class); 400 400 goto out_chrdev; 401 401 } 402 402 for (i=0; i<nr_cards; i++) { 403 - class_simple_device_add(cosa_class, MKDEV(cosa_major, i), 403 + class_device_create(cosa_class, MKDEV(cosa_major, i), 404 404 NULL, "cosa%d", i); 405 405 err = devfs_mk_cdev(MKDEV(cosa_major, i), 406 406 S_IFCHR|S_IRUSR|S_IWUSR, 407 407 "cosa/%d", i); 408 408 if (err) { 409 - class_simple_device_remove(MKDEV(cosa_major, i)); 409 + class_device_destroy(cosa_class, MKDEV(cosa_major, i)); 410 410 goto out_chrdev; 411 411 } 412 412 } ··· 427 427 printk(KERN_INFO "Unloading the cosa module\n"); 428 428 429 429 for (i=0; i<nr_cards; i++) { 430 - class_simple_device_remove(MKDEV(cosa_major, i)); 430 + class_device_destroy(cosa_class, MKDEV(cosa_major, i)); 431 431 devfs_remove("cosa/%d", i); 432 432 } 433 - class_simple_destroy(cosa_class); 433 + class_destroy(cosa_class); 434 434 devfs_remove("cosa"); 435 435 for (cosa=cosa_cards; nr_cards--; cosa++) { 436 436 /* Clean up the per-channel data */
+5 -5
drivers/s390/char/tape_class.c
··· 16 16 ); 17 17 MODULE_LICENSE("GPL"); 18 18 19 - struct class_simple *tape_class; 19 + static struct class *tape_class; 20 20 21 21 /* 22 22 * Register a tape device and return a pointer to the cdev structure. ··· 70 70 if (rc) 71 71 goto fail_with_cdev; 72 72 73 - tcd->class_device = class_simple_device_add( 73 + tcd->class_device = class_device_create( 74 74 tape_class, 75 75 tcd->char_device->dev, 76 76 device, ··· 101 101 &tcd->class_device->dev->kobj, 102 102 tcd->mode_name 103 103 ); 104 - class_simple_device_remove(tcd->char_device->dev); 104 + class_device_destroy(tape_class, tcd->char_device->dev); 105 105 cdev_del(tcd->char_device); 106 106 kfree(tcd); 107 107 } ··· 111 111 112 112 static int __init tape_init(void) 113 113 { 114 - tape_class = class_simple_create(THIS_MODULE, "tape390"); 114 + tape_class = class_create(THIS_MODULE, "tape390"); 115 115 116 116 return 0; 117 117 } 118 118 119 119 static void __exit tape_exit(void) 120 120 { 121 - class_simple_destroy(tape_class); 121 + class_destroy(tape_class); 122 122 tape_class = NULL; 123 123 } 124 124
+5 -5
drivers/s390/char/vmlogrdr.c
··· 703 703 .attrs = vmlogrdr_attrs, 704 704 }; 705 705 706 - static struct class_simple *vmlogrdr_class; 706 + static struct class *vmlogrdr_class; 707 707 static struct device_driver vmlogrdr_driver = { 708 708 .name = "vmlogrdr", 709 709 .bus = &iucv_bus, ··· 727 727 goto unregdriver; 728 728 } 729 729 730 - vmlogrdr_class = class_simple_create(THIS_MODULE, "vmlogrdr"); 730 + vmlogrdr_class = class_create(THIS_MODULE, "vmlogrdr"); 731 731 if (IS_ERR(vmlogrdr_class)) { 732 732 printk(KERN_ERR "vmlogrdr: failed to create class.\n"); 733 733 ret=PTR_ERR(vmlogrdr_class); ··· 746 746 747 747 static void 748 748 vmlogrdr_unregister_driver(void) { 749 - class_simple_destroy(vmlogrdr_class); 749 + class_destroy(vmlogrdr_class); 750 750 vmlogrdr_class = NULL; 751 751 driver_remove_file(&vmlogrdr_driver, &driver_attr_recording_status); 752 752 driver_unregister(&vmlogrdr_driver); ··· 786 786 device_unregister(dev); 787 787 return ret; 788 788 } 789 - priv->class_device = class_simple_device_add( 789 + priv->class_device = class_device_create( 790 790 vmlogrdr_class, 791 791 MKDEV(vmlogrdr_major, priv->minor_num), 792 792 dev, ··· 806 806 807 807 static int 808 808 vmlogrdr_unregister_device(struct vmlogrdr_priv_t *priv ) { 809 - class_simple_device_remove(MKDEV(vmlogrdr_major, priv->minor_num)); 809 + class_device_destroy(vmlogrdr_class, MKDEV(vmlogrdr_major, priv->minor_num)); 810 810 if (priv->device != NULL) { 811 811 sysfs_remove_group(&priv->device->kobj, &vmlogrdr_attr_group); 812 812 device_unregister(priv->device);
+6 -6
drivers/usb/core/file.c
··· 68 68 .open = usb_open, 69 69 }; 70 70 71 - static struct class_simple *usb_class; 71 + static struct class *usb_class; 72 72 73 73 int usb_major_init(void) 74 74 { ··· 80 80 goto out; 81 81 } 82 82 83 - usb_class = class_simple_create(THIS_MODULE, "usb"); 83 + usb_class = class_create(THIS_MODULE, "usb"); 84 84 if (IS_ERR(usb_class)) { 85 - err("class_simple_create failed for usb devices"); 85 + err("class_create failed for usb devices"); 86 86 unregister_chrdev(USB_MAJOR, "usb"); 87 87 goto out; 88 88 } ··· 95 95 96 96 void usb_major_cleanup(void) 97 97 { 98 - class_simple_destroy(usb_class); 98 + class_destroy(usb_class); 99 99 devfs_remove("usb"); 100 100 unregister_chrdev(USB_MAJOR, "usb"); 101 101 } ··· 171 171 ++temp; 172 172 else 173 173 temp = name; 174 - intf->class_dev = class_simple_device_add(usb_class, MKDEV(USB_MAJOR, minor), &intf->dev, "%s", temp); 174 + intf->class_dev = class_device_create(usb_class, MKDEV(USB_MAJOR, minor), &intf->dev, "%s", temp); 175 175 if (IS_ERR(intf->class_dev)) { 176 176 spin_lock (&minor_lock); 177 177 usb_minors[intf->minor] = NULL; ··· 220 220 221 221 snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); 222 222 devfs_remove (name); 223 - class_simple_device_remove(MKDEV(USB_MAJOR, intf->minor)); 223 + class_device_destroy(usb_class, MKDEV(USB_MAJOR, intf->minor)); 224 224 intf->class_dev = NULL; 225 225 intf->minor = -1; 226 226 }
+5 -5
drivers/video/fbmem.c
··· 1040 1040 #endif 1041 1041 }; 1042 1042 1043 - static struct class_simple *fb_class; 1043 + static struct class *fb_class; 1044 1044 1045 1045 /** 1046 1046 * register_framebuffer - registers a frame buffer device ··· 1066 1066 break; 1067 1067 fb_info->node = i; 1068 1068 1069 - fb_info->class_device = class_simple_device_add(fb_class, MKDEV(FB_MAJOR, i), 1069 + fb_info->class_device = class_device_create(fb_class, MKDEV(FB_MAJOR, i), 1070 1070 fb_info->device, "fb%d", i); 1071 1071 if (IS_ERR(fb_info->class_device)) { 1072 1072 /* Not fatal */ ··· 1134 1134 registered_fb[i]=NULL; 1135 1135 num_registered_fb--; 1136 1136 fb_cleanup_class_device(fb_info); 1137 - class_simple_device_remove(MKDEV(FB_MAJOR, i)); 1137 + class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); 1138 1138 return 0; 1139 1139 } 1140 1140 ··· 1197 1197 if (register_chrdev(FB_MAJOR,"fb",&fb_fops)) 1198 1198 printk("unable to get major %d for fb devs\n", FB_MAJOR); 1199 1199 1200 - fb_class = class_simple_create(THIS_MODULE, "graphics"); 1200 + fb_class = class_create(THIS_MODULE, "graphics"); 1201 1201 if (IS_ERR(fb_class)) { 1202 1202 printk(KERN_WARNING "Unable to create fb class; errno = %ld\n", PTR_ERR(fb_class)); 1203 1203 fb_class = NULL; ··· 1210 1210 static void __exit 1211 1211 fbmem_exit(void) 1212 1212 { 1213 - class_simple_destroy(fb_class); 1213 + class_destroy(fb_class); 1214 1214 } 1215 1215 1216 1216 module_exit(fbmem_exit);